Last active
August 29, 2015 13:59
-
-
Save markcarrrr/10541935 to your computer and use it in GitHub Desktop.
primish class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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