-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjQueryPlugin.js
48 lines (38 loc) · 1.02 KB
/
jQueryPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*global $, window, CanvasLoader, jQuery */
/*jslint browser:true, devel:true */
(function ($, undefined) {
'use strict';
$.myPluginName = function (el, options) {
var plugin = this,
init, preInit, postInit, defaults = {
activated: function () {},
before: function () {},
after: function () {},
ready: function () {}
};
init = function () {
// Merge into new var
var extOptions = $.extend(true, defaults, options);
plugin.el = $(el);
extOptions.activated();
preInit();
console.log('-> myPluginName Init');
postInit();
};
preInit = function () {
console.log('-> myPluginName PreInit');
};
postInit = function () {
console.log('-> myPluginName PostInit');
};
/**
* Call the init
*/
init();
};
$.fn.myPluginName = function (options) {
return this.each(function () {
(new $.myPluginName(this, options));
});
};
}(jQuery));