mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
AnimatedEach: configure which events to animate
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// XXX another full pass on this all.
|
||||
AnimatedEach = {
|
||||
apply: function (el) {
|
||||
apply: function (el, events) {
|
||||
events = events || ['insert', 'remove', 'move'];
|
||||
|
||||
var animateIn = function (n, parent, next, onComplete) {
|
||||
parent.insertBefore(n, next);
|
||||
var $n = $(n);
|
||||
@@ -87,22 +89,32 @@ AnimatedEach = {
|
||||
}
|
||||
};
|
||||
|
||||
$(el)[0].$uihooks = {
|
||||
insertElement: function (n, parent, next) {
|
||||
// xcxc chained hooks?
|
||||
$(el)[0].$uihooks = {};
|
||||
|
||||
if (_.contains(events, 'insert')) {
|
||||
$(el)[0].$uihooks.insertElement = function (n, parent, next) {
|
||||
runOrQueueIfMoving(function () {
|
||||
var onComplete = dequeuePlanned ? null : dequeue;
|
||||
dequeuePlanned = true;
|
||||
animateIn(n, parent, next, onComplete);
|
||||
});
|
||||
},
|
||||
removeElement: function (n) {
|
||||
};
|
||||
}
|
||||
|
||||
if (_.contains(events, 'remove')) {
|
||||
$(el)[0].$uihooks.removeElement = function (n) {
|
||||
runOrQueueIfMoving(function () {
|
||||
var onComplete = dequeuePlanned ? null : dequeue;
|
||||
dequeuePlanned = true;
|
||||
animateOut(n, onComplete);
|
||||
});
|
||||
},
|
||||
moveElement: function (n, parent, next) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (_.contains(events, 'move')) {
|
||||
$(el)[0].$uihooks.moveElement = function (n, parent, next) {
|
||||
runOrQueue(function () {
|
||||
moveActive = true;
|
||||
|
||||
@@ -143,7 +155,7 @@ AnimatedEach = {
|
||||
dequeue();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user