Classes
Methods
-
<static> singleton(SingletonObject, singletonFunctionName) → {Object}
-
Makes the given object's creation only be with a singleton method.
Parameters:
Name Type Argument Description SingletonObject
Object A Object to be a singleton.
singletonFunctionName
string <optional>
singleton function name. default is 'getInstance'.
- Since:
-
- 2.0.0
Returns:
The given object including a singlton method.
- Type
- Object
Example
var object = $class({ $constructor : function() { } run : function() { }; }); object = caph.pattern.singleton(object); object.getInstance().run();