Separate event class factory module.

This commit is contained in:
Hyunje Alex Jun 2015-01-24 12:55:13 +00:00
parent 6d1f558c02
commit 9a89e73cf9
2 changed files with 18 additions and 13 deletions

17
src/js/lib/event-class.js Normal file
View 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;
}
};
};

View File

@ -5,21 +5,9 @@
var cls = require('../lib/class') var cls = require('../lib/class')
, defaultSettings = require('./default-setting') , defaultSettings = require('./default-setting')
, eventClassFactory = require('../lib/event-class')
, h = require('../lib/helper'); , 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) { module.exports = function (element, settingOrCommand) {
var settings = h.clone(defaultSettings); var settings = h.clone(defaultSettings);
var $this = $(element); var $this = $(element);