mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(listView): cleanup element references
This commit is contained in:
@@ -171,7 +171,15 @@
|
||||
|
||||
|
||||
// Kill the current drag
|
||||
if(_this._lastDrag) {
|
||||
_this._lastDrag.buttons = null;
|
||||
_this._lastDrag.content = null;
|
||||
}
|
||||
_this._lastDrag = _this._currentDrag;
|
||||
if(_this._currentDrag) {
|
||||
_this._currentDrag.buttons = null;
|
||||
_this._currentDrag.content = null;
|
||||
}
|
||||
_this._currentDrag = null;
|
||||
|
||||
// We are done, notify caller
|
||||
@@ -207,6 +215,13 @@
|
||||
this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, '+y+'px, 0)';
|
||||
};
|
||||
|
||||
ReorderDrag.prototype.deregister = function() {
|
||||
this.listEl = null;
|
||||
this.el = null;
|
||||
this.scrollEl = null;
|
||||
this.scrollView = null;
|
||||
};
|
||||
|
||||
ReorderDrag.prototype.start = function(e) {
|
||||
var content;
|
||||
|
||||
@@ -331,6 +346,10 @@
|
||||
|
||||
this.onReorder && this.onReorder(this.el, this._currentDrag.startIndex, finalIndex);
|
||||
|
||||
this._currentDrag = {
|
||||
placeholder: null,
|
||||
content: null
|
||||
};
|
||||
this._currentDrag = null;
|
||||
doneCallback && doneCallback();
|
||||
};
|
||||
@@ -376,13 +395,24 @@
|
||||
// Start the drag states
|
||||
this._initDrag();
|
||||
},
|
||||
|
||||
/**
|
||||
* Be sure to cleanup references.
|
||||
*/
|
||||
deregister: function() {
|
||||
this.el = null;
|
||||
this.listEl = null;
|
||||
this.scrollEl = null;
|
||||
this.scrollView = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Called to tell the list to stop refreshing. This is useful
|
||||
* if you are refreshing the list and are done with refreshing.
|
||||
*/
|
||||
stopRefreshing: function() {
|
||||
var refresher = this.el.querySelector('.list-refresher');
|
||||
refresher.style.height = '0px';
|
||||
refresher.style.height = '0';
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -449,6 +479,7 @@
|
||||
clearDragEffects: function() {
|
||||
if(this._lastDragOp) {
|
||||
this._lastDragOp.clean && this._lastDragOp.clean();
|
||||
this._lastDragOp.deregister && this._lastDragOp.deregister();
|
||||
this._lastDragOp = null;
|
||||
}
|
||||
},
|
||||
@@ -457,6 +488,9 @@
|
||||
//ionic.views.ListView.__super__._initDrag.call(this);
|
||||
|
||||
// Store the last one
|
||||
if(this._lastDragOp) {
|
||||
this._lastDragOp.deregister && this._lastDragOp.deregister();
|
||||
}
|
||||
this._lastDragOp = this._dragOp;
|
||||
|
||||
this._dragOp = null;
|
||||
|
||||
Reference in New Issue
Block a user