Created
April 18, 2016 21:18
-
-
Save dragthor/8ca90a0cd019c1fcb3f45eec7f893904 to your computer and use it in GitHub Desktop.
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
'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