JSFiddle - React, Tailwind, and code Playground
by LyndseyB
JavaScript
var GunnerApp = {
name: "GunnerApp",
init: function init(plugins) {
var _this = this;
plugins.forEach(function (plugin) {
GunnerApp[plugin].call(_this);
});
},
WriteMsg: function (msg) {
msg = msg || 'Hello lyndsey!';
console.log(msg);
return this; // return GunnerApp so that we can chain methods!
},
AnotherCoolMethod: function() {
console.log('this is a coool method');
return this;
}
};
GunnerApp.init(['WriteMsg']);
// we can also do this...
GunnerApp.WriteMsg('hello').AnotherCoolMethod().WriteMsg('!!!');