Extending navigation engine to register command handler

After the client state is activated in the server side, a command will be added into the response data and sent back to the client side. Then the navigation engine will invoke different target command handler to handle the related command in the reply data. In order to correctly response to the command and invoke the associated client operation logics, alpha developers should extend the navigation engine of BTT product and register their own command handlers.

About this task

The navigation engine provided by BTT product is located in the file ‘NavagationEngine.js’. And in this JS library file there is a function named ‘postCreate’, which will be invoked after the engine created and all the widgets loaded for the first time. The extended command should be registered in this method as the code snippet below.

So alpha developers should follow the two steps below to complete the task.

Procedure

  1. Firstly, alpha developers should extend the ‘NavagationEngine’ of the product code, and then override the function named ‘postCreate’.

  2. And secondly, alpha developers should define their command handlers which will be invoked by the navigation engine. The following code shows a sample of device control, which will invoke the printer to print current form. And you can fine more sample handlers in the sample project.

  3. Finally, alpha developers should register the handlers defined above into the extended navigation engine. This is the same as the code style of the navigation engine of BTT product.