perf(itemSliding): improve performance

This commit is contained in:
Adam Bradley
2015-11-18 23:32:25 -06:00
parent 564b674ba7
commit b2d9e1d8a3
5 changed files with 55 additions and 37 deletions

View File

@@ -35,7 +35,10 @@ export class Gesture {
}
this.hammertime.on(type, cb);
(this._callbacks[type] || (this._callbacks[type] = [])).push(cb);
//this.element.addEventListener(type, cb);
}
off(type, cb) {
this.hammertime.off(type, this._callbacks[type] ? cb : null);
}
listen() {
@@ -46,7 +49,6 @@ export class Gesture {
if (this.hammertime) {
for (let type in this._callbacks) {
for (let i = 0; i < this._callbacks[type].length; i++) {
//this.element.removeEventListener(type, this._callbacks[type][i]);
this.hammertime.off(type, this._callbacks[type]);
}
}