3 var ps = require('../main');
4 var psInstances = require('../plugin/instances');
6 function mountJQuery(jQuery) {
7 jQuery.fn.perfectScrollbar = function (settingOrCommand) {
8 return this.each(function () {
9 if (typeof settingOrCommand === 'object' ||
10 typeof settingOrCommand === 'undefined') {
11 // If it's an object or none, initialize.
12 var settings = settingOrCommand;
14 if (!psInstances.get(this)) {
15 ps.initialize(this, settings);
18 // Unless, it may be a command.
19 var command = settingOrCommand;
21 if (command === 'update') {
23 } else if (command === 'destroy') {
31 if (typeof define === 'function' && define.amd) {
32 // AMD. Register as an anonymous module.
33 define(['jquery'], mountJQuery);
35 var jq = window.jQuery ? window.jQuery : window.$;
36 if (typeof jq !== 'undefined') {
41 module.exports = mountJQuery;