CAPH
The root namespace caph also has several utility methods. Those utility functions are 'equal', 'namespace', 'extend, 'clone' and so on. Using equal function, a user can get a boolean result from checking whether two given objects are identical or not. Using namespace function, a user can bind an object with a namespace string given. Using extend function, a user can get an extended object based on two objects given. Also, Using clone function, a user can get a a cloned object using an object given as a parameter.
Constructor
Class | ||
Description | ||
The constructor of dummy class, in order to create class object. | ||
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
var cls = new caph.Class(); |
Methods
equal | ||
Description | ||
Returns a boolean result from checking whether two given objects are identical or not. | ||
Parameters | ■a - Object - a value to be compared with b-value. ■b - Object - a value to be compared with a-value. | |
Return | ■Boolean - true : if equals - false : otherwise | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var a = 1; var b = 1; var c = 2; var isAEqualsToB = caph.equal(a, b); console.log(isAEqualsToB); // Displays 'true' var isAEqualsToC = caph.equal(a, c); console.log(isAEqualsToC); // Displays 'false' |
Class | ||
Description | ||
(Constructor) The constructor of dummy class, in order to create class object. | ||
Parameters | ■Void | |
Return | ■Object - The instance of class | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var cls = new caph.Class(); |
extend | ||
Description | ||
Returns an extended object based on two objects given. | ||
Parameters | ■base - Object - a base object to extend. ■ext - Object - an object to make the extended object with the base object. | |
Return | ■Object - An object extended. | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var foo = {BACKSPACE: 8, TAB: 9, ENTER: 13, LEFT: 37 }; var bar = {RIGHT: 38}; caph.extend(foo, bar); // console.log(foo) displays // {BACKSPACE: 8, TAB: 9, ENTER: 13, LEFT: 37, RIGHT: 38} console.log(foo); |
clone | ||
Description | ||
Returns a cloned object using an object given as a parameter. | ||
Parameters | ■obj - Object - an object to be cloned. | |
Return | ■Object - An object cloned. | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var obj = {'a', 'b'}; var clonedObject = caph.clone(obj); |
namespace | ||
Description | ||
Binds an object with a namespace string given. Once the object is bound, then it becomes accessible through the defined namespace. | ||
Parameters | ■ns - String - a string to define the namespace. ■obj - Object - an object to be bound with the namespace. ■base (Optional) - Object - an object to set a root object. In case that it's omitted, the global "window" object is the base. | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var objA = { get : function() { return 0; } } caph.namespace("caph.example", { "Foo" : objA }); caph.example.Foo.get(); // Returns 0 |
getRevision | ||
Description | ||
Returns the "Framework Revision". | ||
Parameters | ■Void | |
Return | ■String - The revision string of the framework | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var revisionString = caph.getRevision(); |
getVersion | ||
Description | ||
Returns the "Framework Version". | ||
Parameters | ■Void | |
Return | ■String - The version string of the framework | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var versionString = caph.getVersion(); |
noConflict | ||
Description | ||
Restores the old references of the framework which are saved during the framework initialization. | ||
Parameters | ■Void | |
Return | ■Object - caph's root namespace object | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
window.caph = { 'foo' : 'bar' }; window.baz = caph.noConflict(); |