Материал из Module developer
Pay attention that the creation of the listener and calling of the event begin with "B.", as they are included in i3 lite API.
In such a way weemplat of the script for the static module with the server. This template is located in the script part of the panel module. And the script part of the server module is empty in this case. When adding this script the server will be the first priority and commands will be sent to it if it is available. If not, they will be snt to the panel.
Example of the ready server script which also can be used as a template:
IR.AddListener(IR.EVENT_MODULE_START, 0, function(moduleID, busID){
var module = B.getModule(moduleID);
var device = module.getDevice("DuoTecno Network");
var server = IR.GetDevice("iRidium Server");
server.Connect();
device.Connect();
B.AddListener(B.EVENT_CONNECT_TO_SERVER_AVAILABLE, 0, function () {
device.Disconnect();
})
B.AddListener(B.EVENT_CONNECT_TO_SERVER_NOT_AVAILABLE, 0, function () {
device.Connect();
})
});
