API Reference

mirrorJS

mirrorJS core object

1
{app: Object, servers: Object, widgets: Object, connectors: Object, ui: Object}

 


 

mirrorJS.app.local(uiHandler, startupHandler, conf)

Local application (the backend and the frontend communicate and live locally)

  • uiHandler: an instance of mirrorJS.ui.connectors.local
  • startupHandler: the entry point of the application
  • conf: application configuration
1
2
3
var myApp = new mirrorJS.app.local(
   new mirrorJS.ui.connectors.local( "html" /*, loopback */ ), 
       function(){});

Sample local application

 


 

mirrorJS.app.remote(uiHandler, alias, conf)

Client-side of a client-server application. The frontend (this) connects to the backend (mirrorJS.app.server) using the specified ui-connector (uiHandler) and run the application specified by “alias

  • uiHandler: an instance of mirrorJS.ui.connectors.local
  • alias: the application to run
  • conf: application configuration
1
2
3
4
5
6
7
8
9
var myApp = new mirrorJS.app.local(
var conf = {
            host: "127.0.0.1",
            port: 9999
    };
var myApp = new mirrorJS.app.remote(
        new mirrorJS.ui.connectors.local( "html",
            new mirrorJS.connectors.SockJS(conf)),
        "designer" );

In the above sample we will use a local ui-connector to conenct to a remote SockJS server.
 


 

mirrorJS.app.server(uiHandler, startupHandler, conf)

Server-side of a client-server application. This type of applications run in the backend (this) and send to the frontend (mirrorJS.app.remote) the messages needed to render the application.

  • uiHandler: an instance of mirrorJS.ui.connectors.remote
  • startupHandler: the entry point of the application
  • conf: application configuration
1
2
3
var myApp = new mirrorJS.app.local(
new mirrorJS.app.server(new mirrorJS.ui.connectors.remote(connection), 
   function(){});

Sample SockJS Application Server

 


 

mirrorJS.servers.SockJS(conf)

SockJS Application server

1
2
3
4
var mirrorJS = require("../mirror/mirror");
global.__base_path = __dirname + "/";
mirrorJS.widgets.controller.installAll();
var myAppServer = new mirrorJS.servers.SockJS( mirrorJS.servers.readConf(global.__base_path + "mirror.conf", true) );

 


 

mirrorJS.servers.Socket(conf)

Socket Application server

1
2
3
4
var mirrorJS = require("../mirror/mirror");
global.__base_path = __dirname + "/";
mirrorJS.widgets.controller.installAll();
var myAppServer = new mirrorJS.servers.Socket( mirrorJS.servers.readConf(global.__base_path + "mirror.conf", true) );

 


 

mirrorJS.connectors.SockJS(conf)

SockJS connector

1
2
3
4
5
6
var conf = {	
    host: "127.0.0.1",
    port: 9999
};
var myApp = new mirrorJS.app.remote(
    new mirrorJS.ui.connectors.local("html", new mirrorJS.connectors.SockJS(conf)), "test1" );

 


 

mirrorJS.connectors.Socket(conf)

Socket connector

1
2
3
4
5
6
var conf = {	
    host: "127.0.0.1",
    port: 9999
};
var myApp = new mirrorJS.app.remote(
    new mirrorJS.ui.connectors.local("html", new mirrorJS.connectors.Socket(conf)), "test1" );

Leave a Reply

Your email address will not be published. Required fields are marked *