Module contains orbx actions allowing an interactions between prototype and children
- Source:
Methods
(inner) coldFn(fn, name) → {Void}
- Source:
Take function and attache it to current object binding it. Executing function will change only the object and not its child. Other words if you call this function from child it will change prototype object value
Example
const test = Object.create(actions);
test.value = 0;
test.coldFn(function add(){ this.value++ });
test.add(); // test.value === 1;
const test2 = Object.create(test);
test2.add() // test2.value === undefined && test.value === 2
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | callback function that will be set by given name |
name |
String | function name if function is anonymus |
Returns:
- Type
- Void
(inner) hotFn(fn, name) → {Void}
- Source:
Take function and attache it to current object checking if existing name exists on prototype chain
Example
const test = Object.create(actions);
test.value = 0;
test.hotFn(function add(){ this.value++ });
const test2 = Object.create(test);
test2.value = 0;
test.add() // test.value === 1 && test2.value === 0
test2.add() // test.value === 1 && test2.value === 1
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | callback function that will be set by given name |
name |
String | function name if function is anonymus |
Returns:
- Type
- Void