Skip to content

Instantly share code, notes, and snippets.

@dragthor
Created April 18, 2016 21:18
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 dragthor/8ca90a0cd019c1fcb3f45eec7f893904 to your computer and use it in GitHub Desktop.
Save dragthor/8ca90a0cd019c1fcb3f45eec7f893904 to your computer and use it in GitHub Desktop.
'use strict';
!function($) {
class MyZurbPlugin {
/**
* Creates a new instance of an myzurbplugin.
* @class
* @fires MyZurbPlugin#init
* @param {jQuery} element - jQuery object to make into an myzurbplugin.
* @param {Object} options - a plain object with settings to override the default options.
*/
constructor(element, options) {
console.log("constructor");
this.$element = element;
this.options = $.extend({}, MyZurbPlugin.defaults, this.$element.data(), options);
this._init();
Foundation.registerPlugin(this, 'MyZurbPlugin');
}
/**
* Initializes the myzurbplugin.
* @private
*/
_init() {
this._events();
}
/**
* Adds event handlers for items within the myzurbplugin.
* @private
*/
_events() {
console.log("events");
}
/**
* Destroys an instance of an myzurbplugin.
* @fires MyZurbPlugin#destroyed
* @function
*/
destroy() {
Foundation.unregisterPlugin(this);
console.log("destroy");
}
}
MyZurbPlugin.defaults = { };
// Window exports
Foundation.plugin(MyZurbPlugin, 'MyZurbPlugin');
}(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment