-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpluginName.js
More file actions
45 lines (41 loc) · 1.15 KB
/
pluginName.js
File metadata and controls
45 lines (41 loc) · 1.15 KB
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
/*!
{{@pluginName}} v0.1.0 (https://github.com/TechTarget/{{@pluginName}})
Author: Morgan Wigmanich <okize123@gmail.com> (http://github.com/okize)
Copyright (c) 2013 | Licensed under the MIT license
http://www.opensource.org/licenses/mit-license.php
*/
(function(factory) {
if (typeof define === 'function' && define.amd) {
return define(['jquery'], factory);
} else {
return factory(jQuery);
}
})(function($) {
'use strict';
var Plugin, defaults, pluginName;
pluginName = '{{@pluginName}}';
defaults = {
property: true
};
Plugin = (function() {
function Plugin(element, options) {
this.element = element;
this.options = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.el = $(this.element);
this.init();
}
Plugin.prototype.init = function() {
return console.log('{{@pluginName}} initialized');
};
return Plugin;
})();
$.fn[pluginName] = function(options) {
return this.each(function() {
if (!$.data(this, 'plugin_#{pluginName}')) {
$.data(this, 'plugin_#{pluginName}', new Plugin(this, options));
}
});
};
});