diff --git a/src/js/lib/event-class.js b/src/js/lib/event-class.js new file mode 100644 index 0000000..6ccf351 --- /dev/null +++ b/src/js/lib/event-class.js @@ -0,0 +1,17 @@ +/* Copyright (c) 2015 Hyunje Alex Jun and other contributors + * Licensed under the MIT License + */ +'use strict'; + +var incrementingId = 0; +module.exports = function () { + var id = incrementingId++; + return function (eventName) { + var className = '.perfect-scrollbar-' + id; + if (typeof eventName === 'undefined') { + return className; + } else { + return eventName + className; + } + }; +}; diff --git a/src/js/plugin/ps.js b/src/js/plugin/ps.js index 77fa206..324be22 100644 --- a/src/js/plugin/ps.js +++ b/src/js/plugin/ps.js @@ -5,21 +5,9 @@ var cls = require('../lib/class') , defaultSettings = require('./default-setting') + , eventClassFactory = require('../lib/event-class') , h = require('../lib/helper'); -var incrementingId = 0; -var eventClassFactory = function () { - var id = incrementingId++; - return function (eventName) { - var className = '.perfect-scrollbar-' + id; - if (typeof eventName === 'undefined') { - return className; - } else { - return eventName + className; - } - }; -}; - module.exports = function (element, settingOrCommand) { var settings = h.clone(defaultSettings); var $this = $(element);