Try loading as AMD module or fall back to default loading
The actual plugin class
The namespace for the plugins
Default options for the plugin. Redefine this dictionary in extending classes to specify default options. These options can be overriden using 'data-' attributes, or by passing them directly to the constructor.
The default constructor calls the initialize method with the specified method, sets the element, and binds events to the elements. Remember to call super in subclasses if you want to maintain behaviour.
element
Object: the element the plugin is applied tooptions
Object: the options for the plugin initializationreturns the element
Wrapper method for the initialization process.
options
Object: the options for the plugin initializationMethod to initialize the plugin instance with the given options.
options
Object: the options for the plugin initializationReset the instance using its old options if they exist
Wrapper method for the event binding.
Attach events to the widget.
Reset the plugin for re-initialisation.
options
Object: the options to reset the plugin withDestroy the plugin.
Cleanup the plugin and remove remaining references.
Install the plugin into the JS library. Remember to call install in the plugin class as:
Plugin.install([pluginName],[namespace],[initFunction])
pluginName
String: the name of the pluginnamespace
String: an optional namespace for the plugininit
Function: some initialization code to execute after the plugin
was loadedInstall as JS library function
Iterate over all elements of the selector and add the plugin
Load default options
Override with options specfied as 'data-'' attributes
Override with options specified in the direct call
Do not create a new instance if one exists
Call internal instance methods
Re-initialize the plugin with new options
Create a new instance
Attach the plugin to the data attribute of the element
Add a listener for jQuery's remove event
Call plugin specific cleanup
AbstractPlugin
The
AbstractPlugin
class provides an abstraction for JS library plugins. It defines the basic methods and logic all plugins should have, and handles installing the plugin into the JS library.author: Julien Ramboz
version: 1.0
references: jQuery CoffeeScript plugin