Javascript Library.
Commands 0 |
---|
Store and execute functions.
_z([functions]);
Returns: _z(function/s) Object
_z([functions]).addThis([functions2]);
Returns: _z([functions, functions2]) Object
_z([functions]).exec( boolean );
Returns: _z([functions]) Object
<script>
// function
function setDocTitle() {
document.title = "Way 2";
}
// create new functions store (empty)
var Myfn =_z(); // _z([])
// add function to store
Myfn.addThis(() => { console.log("Way 1"); });
// add other function to store
Myfn.addThis(setDocTitle);
// add other function to store
Myfn.addThis((function() {
this.title = "Way 3";
}).bind(document));
// add other function
Myfn.addThis( console.log.bind(console, ["way 4"]) );
Myfn.exec(false); // _z( function/s list ); no execution
Myfn.exec(); // execute all stored function/s
Myfn.last().exec(); // execute last stored function
Myfn.first().exec(false); // get first stored function
</script>
Warning: If the store created like: z(FUNCTION) the function will be executed immediately. _( MUST BE IN ARRAY )
Please read Execute function after the document is finished loading