INDEX

Context

The context can be a global context or a window object of a web page. The context can also be an instance of Function object.

The context is used in the start and connect methods of the SpaceifyApplication class and in the start method of the Spacelet class. The context is also used in the exposeRpcMethod and callRpc methods of the Service class.

Context examples for the SpaceifyApplication and Spacelet classes

The context is an object implementing start and fail methods.

Passing the global contexts or the window objects this as the context.

var spaceify = new SpaceifyApplication();
spaceify.start(this);

this.start = function()
  {}
  
this.fail = function()
  {}

/* 
Using the this keyword in the function defination is not
necessary within the global or the window object context.

function start()
  {}
  
function fail()
  {}
*/

Passing a function instance as the context.

function MySpacelet()
  {
  this.start = function()
    {
    }

  this.fail = function()
    {
    }
  }
  
var spacelet = new Spacelet();
spacelet.start(new MySpacelet());
Close
copyright © Spaceify.org 2014