Separate event class factory module.
This commit is contained in:
parent
6d1f558c02
commit
9a89e73cf9
17
src/js/lib/event-class.js
Normal file
17
src/js/lib/event-class.js
Normal file
@ -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;
|
||||
}
|
||||
};
|
||||
};
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user