Skip to content

Instantly share code, notes, and snippets.

@markcarrrr
Last active August 29, 2015 13:59
Show Gist options
  • Save markcarrrr/10541935 to your computer and use it in GitHub Desktop.
Save markcarrrr/10541935 to your computer and use it in GitHub Desktop.
primish class
/* https://github.com/DimitarChristoff/primish/ */
/* requires: [primish.js, options.js] */
/* Example... */
var App = App = {};
;(function(Class, window, document){
"use strict";
App.Widget = Class({
options: {
title: "My Widget"
},
implement: [options],
constructor: function(element, options){
this.element = element;
this.setOptions(options);
this.setWidget();
},
setWidget: function(){
this.element.innerHTML = this.options.title;
}
});
App.Widget.Extended = Class({
extend: App.Widget,
options: {
titleExtend: "My Widget Extended"
},
constructor: function(element, options){
this.element = element;
this.setOptions(options);
this.setWidgetExtended();
},
setWidgetExtended: function(){
this.element.innerHTML = this.options.titleExtend;
}
});
var instance = new App.Widget.Extended(element, {
title: "New My Widget"
});
}).apply(App, [primish, window, document]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment