Extending : Client State Extension : Extending navigation engine to register command handler
  
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 UNICOM® Digital Transformation Toolkit (UDTT™) navigation engine and register their own command handlers.
The navigation engine provided by UDTT is located in the file ‘NavagationEngine.js’. In this JS library file there is a function named ‘postCreate’, which is invoked after the engine created and all the widgets are loaded for the first time. The extended command should be registered in this method as the code snippet below.
This graphic is described in the surrounding text.
So alpha developers should follow the two steps below to complete the task.
1 Extend the ‘NavagationEngine’ of the product code, and then override the function named ‘postCreate’.
This graphic is described in the surrounding text.
2 Define the 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.
This graphic is described in the surrounding text.
3 Register the handlers defined above into the extended navigation engine. This is the same as the code style of the UDTT navigation engine.
This graphic is described in the surrounding text.
See also
Client State Extension