js匿名函數封裝
阿新 • • 發佈:2018-12-06
dem ret type UNC function typeof clas fine export
js匿名函數封裝
(function(root,factory){ typeof exports === ‘object‘ && typeof module !== ‘undefined‘ ? module.exports = factory() : typeof define === ‘function‘ && define.amd ? define(factory) : (root.Demo = factory()); })(this,function(){ function Demo(option){ this._init(option) } Demo.prototype = { constructors: Demo, _init:function(option){ this.name = option.name; this.age = option.age; } } return Demo; });
js匿名函數封裝