Open maikelmclauflin opened 6 years ago
basic code is as follows
var Constructors = {}; var api = { register: register, extend: extend, core: extendCore, content: extendContent, Constructors: Constructors }; fn(api); return api; function extendCore(name, obj) { return extend('core', name, obj); } function extendContent(name, obj) { return extend('content', name, obj); } function extend(from, to, obj_) { var obj = obj_ || {}; obj.extends = prefix(from); obj.prototype = Constructors[from].prototype; return register(to, obj); } function register(name, obj) { var constructor = xtag.register(prefix(name), obj); Constructors[name] = constructor; return constructor; } function forOwn(obj, fn) { return Object.keys(obj).forEach(function (key) { fn(obj[key], key, obj); }); } function prefix(name) { return 'skit-' + name; } }(xtag, Promise, function (skit) { skit.register('core', { lifecycle: { created: function (e) { console.log('here'); }, removed: function () {}, inserted: function () {}, attributeChanged: function () {} }, methods: { // open ended }, events: { // open ended } }); skit.core('content', { lifecycle: { created: function () { console.log('there'); }, removed: function () {}, inserted: function () {}, attributeChanged: function () {} }, methods: { // open ended }, events: { // open ended } }); }));``` errors on second call then console log here is called 2x
This is much, much easier and reliable in v2 - landing imminent on master
basic code is as follows