single

implements the singleton pattern

function single(function source);

Parameters

sourcefunctionthe constructor function

Returns

functionthe constructor function

Example

var myobj = function(){ ... };
myobj = webix.single(myobj);
 
var t1 = new myobj();
var t2 = new myobj(); //t2 === t1

Back to top