cross-plateforme namespace closure
by toubia95
CSS
/* sources :
* http://www.richardrodger.com/2013/09/27/how-to-make-simple-node-js-modules-work-in-the-browser/#.VOdF53aBTDo
* et
* http://addyosmani.com/blog/essential-js-namespacing/
*/
/* le ; au début des fonctions permet de mieux gérer la concaténation ??? */
JavaScript
;(function ($, undefined) {
$.func = function () {
console.log("func !");
};
$.value = "otherfunc !";
})(typeof exports === 'undefined' ? this.bms = this.bms || {} : exports);
;(function ($, undefined) {
$.otherfunc = function () {
console.log(this.value);
};
})(typeof exports === 'undefined' ? this.bms = this.bms || {} : exports);
bms.func(); // func !
bms.otherfunc(); // otherfunc !