Skip to content

Instantly share code, notes, and snippets.

@davidpadbury
Created March 3, 2011 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidpadbury/852716 to your computer and use it in GitHub Desktop.
Save davidpadbury/852716 to your computer and use it in GitHub Desktop.
; $(function (mstats, $) {
$.widget('mstats.fillupsPane', {
options: {
active: false,
id: null
},
_init: function () {
mstats.fillupsPane = this;
mstats.pubsub.subscribe(mstats.events.vehicle.fillups.data, this._newFillupsDataHandler, this);
this._fetchData();
},
fetchData: function (vid) {
this.options.id = vid;
this._fetchData();
},
_fetchData: function () {
var vid = (this.options.id) ? '/' + this.options.id : '';
mstats.dataManager.fetchData(mstats.endpoint.fillup.data + vid);
},
// Large bulk of code excluded...
destroy: function () {
$.Widget.prototype.destroy.apply(this, arguments); // default destroy
mstats.pubsub.unsubscribe(mstats.events.vehicle.fillups.data, this._newFillupsDataHandler, this);
}
});
} (this.mstats = this.mstats || {}, jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment