source: node_modules/d3-transition/src/transition/end.js

Last change on this file was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 835 bytes
Line 
1import {set} from "./schedule.js";
2
3export default function() {
4 var on0, on1, that = this, id = that._id, size = that.size();
5 return new Promise(function(resolve, reject) {
6 var cancel = {value: reject},
7 end = {value: function() { if (--size === 0) resolve(); }};
8
9 that.each(function() {
10 var schedule = set(this, id),
11 on = schedule.on;
12
13 // If this node shared a dispatch with the previous node,
14 // just assign the updated shared dispatch and we’re done!
15 // Otherwise, copy-on-write.
16 if (on !== on0) {
17 on1 = (on0 = on).copy();
18 on1._.cancel.push(cancel);
19 on1._.interrupt.push(cancel);
20 on1._.end.push(end);
21 }
22
23 schedule.on = on1;
24 });
25
26 // The selection was empty, resolve end immediately
27 if (size === 0) resolve();
28 });
29}
Note: See TracBrowser for help on using the repository browser.