-
Notifications
You must be signed in to change notification settings - Fork 8
/
cytoscape-avsdf.js
774 lines (604 loc) · 22.6 KB
/
cytoscape-avsdf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("avsdf-base"));
else if(typeof define === 'function' && define.amd)
define(["avsdf-base"], factory);
else if(typeof exports === 'object')
exports["cytoscapeAvsdf"] = factory(require("avsdf-base"));
else
root["cytoscapeAvsdf"] = factory(root["avsdfBase"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Simple, internal Object.assign() polyfill for options objects etc.
module.exports = Object.assign != null ? Object.assign.bind(Object) : function (tgt) {
for (var _len = arguments.length, srcs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
srcs[_key - 1] = arguments[_key];
}
srcs.forEach(function (src) {
Object.keys(src).forEach(function (k) {
return tgt[k] = src[k];
});
});
return tgt;
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
*
* Choose the type of layout that best suits your usecase as a starting point.
*
* A discrete layout is one that algorithmically sets resultant positions. It
* does not have intermediate positions.
*
* A continuous layout is one that updates positions continuously, like a force-
* directed / physics simulation layout.
*/
module.exports = __webpack_require__(4);
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var impl = __webpack_require__(2);
// registers the extension on a cytoscape lib ref
var register = function register(cytoscape) {
if (!cytoscape) {
return;
} // can't register if cytoscape unspecified
cytoscape('layout', 'avsdf', impl); // register with cytoscape.js
};
if (typeof cytoscape !== 'undefined') {
// expose to global cytoscape (i.e. window.cytoscape)
register(cytoscape);
}
module.exports = register;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* This class implements the overall layout process for the
* Adjacent Vertex with Smallest Degree First (AVSDF) algorithm.
* (Circular Drawing Algorithm by Hongmei He & Ondrej Sýkora).
*
* @author Doruk Çakmakçı
* @author Alihan Okka
*
* Copyright: i-Vis (Information Visualization) Research Lab, Bilkent University, 2019 - present
*/
// cytosscape.js-avsdf REQUIRES avsdf-base library elements
var AVSDFLayout = __webpack_require__(0).AVSDFLayout;
var AVSDFNode = __webpack_require__(0).AVSDFNode;
var AVSDFConstants = __webpack_require__(0).AVSDFConstants;
var PointD = __webpack_require__(0).layoutBase.PointD;
var DimensionD = __webpack_require__(0).layoutBase.DimensionD;
// Cytoscape-extention template requirements
// More details can be found in NPM 'slush-cytoscape-extension' package
var assign = __webpack_require__(1);
var ContinuousLayout = __webpack_require__(6);
var isFn = function isFn(fn) {
return typeof fn === 'function';
};
var optFn = function optFn(opt, ele) {
if (isFn(opt)) {
return opt(ele);
} else {
return opt;
}
};
var defaults = {
ready: function ready() {}, // Called on `layoutready`
stop: function stop() {}, // Called on `layoutstop`
refresh: 30, // number of ticks per frame; higher is faster but more jerky
fit: true, // Whether to fit the network view after when done
padding: 10, // Padding on fit
randomize: false, // Whether to enable incremental mode
animate: 'end', // Type of layout animation. The option set is {'during', 'end', false}
animationDuration: 500, // Duration for animate:end
nodeSeparation: 60 // How apart the nodes are
};
/**
* This is the main class that does all the functionality.
* The class is utilized by functions in the continuous-base folder.
*/
var AVSDF = function (_ContinuousLayout) {
_inherits(AVSDF, _ContinuousLayout);
function AVSDF(options) {
_classCallCheck(this, AVSDF);
// Whether node separation value is used
var _this = _possibleConstructorReturn(this, (AVSDF.__proto__ || Object.getPrototypeOf(AVSDF)).call(this, assign({}, defaults, options)));
if (options.nodeSeparation != null) AVSDFConstants.DEFAULT_NODE_SEPARATION = options.nodeSeparation;else AVSDFConstants.DEFAULT_NODE_SEPARATION = defaults.nodeSeparation;
return _this;
}
/**
* Initializing AVSDF elements and arranging the nodes of the graph around the circle
*/
_createClass(AVSDF, [{
key: 'prerun',
value: function prerun() {
var state = this.state; // options object combined with current state
// Initialize AVSDF elements and their requirements
var avsdfLayout = this.avsdfLayout = new AVSDFLayout();
var graphManager = this.graphManager = avsdfLayout.newGraphManager();
var root = this.root = graphManager.addRoot();
var nodes = state.nodes;
var edges = state.edges;
// Getting nodes of cytoscape and converting it to AVSDF structure
this.idToLNode = {};
this.processChildrenList(root, nodes, avsdfLayout);
// Getting edges of cytoscape and transfering it to GraphManager
for (var i = 0; i < edges.length; i++) {
var edge = edges[i];
var sourceNode = this.idToLNode[edge.data("source")];
var targetNode = this.idToLNode[edge.data("target")];
if (sourceNode !== targetNode && sourceNode.getEdgesBetween(targetNode).length === 0) {
var e1 = graphManager.add(avsdfLayout.newEdge(), sourceNode, targetNode);
e1.id = edge.id();
}
}
// Running the AVSDF layout.
// Note: This function doesn't do post-processing. Plus, nodes have to be positioned.
// See AVSDFLayout for details.
avsdfLayout.layout();
// We need to calculate the initial circle position if we want to render it
avsdfLayout.updateNodeCoordinates();
// Post process is iterated over the sorted list of vertex degrees (descending)
this.sortedByDegreeList = avsdfLayout.initPostProcess();
}
/**
* Runs this in each iteration
*/
}, {
key: 'tick',
value: function tick() {
var _this2 = this;
var state = this.state;
var self = this;
// This function is used for getting coordinates from AVSDF elements and passing it to cytoscape
var positions = this.avsdfLayout.getPositionsData();
state.nodes.forEach(function (n) {
var s = _this2.getScratch(n);
// example : put node at random position
s.x = positions[n.data('id')].x;
s.y = positions[n.data('id')].y;
});
if (state.tickIndex >= state.nodes.size()) return true;
this.avsdfLayout.oneStepPostProcess(this.sortedByDegreeList[state.tickIndex]);
this.avsdfLayout.updateNodeAngles();
this.avsdfLayout.updateNodeCoordinates();
}
/**
* Runs this function after the layout is done ticking
*/
}, {
key: 'postrun',
value: function postrun() {}
/**
* Clean up any object refs that could prevent garbage collection, etc.
*/
}, {
key: 'destroy',
value: function destroy() {
_get(AVSDF.prototype.__proto__ || Object.getPrototypeOf(AVSDF.prototype), 'destroy', this).call(this);
return this;
}
/**
* Transition from cytoscape nodes to AVSDF elements
*/
}, {
key: 'processChildrenList',
value: function processChildrenList(parent, children, layout) {
var size = children.length;
for (var i = 0; i < size; i++) {
var theChild = children[i];
var theNode = void 0;
//Label dimensions are NOT included when calculating node dimensions
var dimensions = theChild.layoutDimensions({
nodeDimensionsIncludeLabels: false
});
if (theChild.outerWidth() != null && theChild.outerHeight() != null) {
theNode = parent.add(new AVSDFNode(layout.graphManager, null, new PointD(theChild.position('x') - dimensions.w / 2, theChild.position('y') - dimensions.h / 2), new DimensionD(parseFloat(dimensions.w), parseFloat(dimensions.h))));
} else {
theNode = parent.add(new AVSDFNode(this.graphManager));
}
// Attach id to the layout node
theNode.id = theChild.data("id");
// Attach the paddings of cy node to layout node
theNode.paddingLeft = parseInt(theChild.css('padding'));
theNode.paddingTop = parseInt(theChild.css('padding'));
theNode.paddingRight = parseInt(theChild.css('padding'));
theNode.paddingBottom = parseInt(theChild.css('padding'));
// Map the layout node
this.idToLNode[theChild.data("id")] = theNode;
if (isNaN(theNode.rect.x)) {
theNode.rect.x = 0;
}
if (isNaN(theNode.rect.y)) {
theNode.rect.y = 0;
}
}
}
}]);
return AVSDF;
}(ContinuousLayout);
module.exports = AVSDF;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// general default options for force-directed layout
module.exports = Object.freeze({
animate: true, // whether to show the layout as it's running; special 'end' value makes the layout animate like a discrete layout
refresh: 10, // number of ticks per frame; higher is faster but more jerky
maxIterations: 1000, // max iterations before the layout will bail out
ungrabifyWhileSimulating: false, // so you can't drag nodes during layout
fit: true, // on every layout reposition of nodes, fit the viewport
padding: 30, // padding around the simulation
boundingBox: undefined, // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
// layout event callbacks
ready: function ready() {}, // on layoutready
stop: function stop() {}, // on layoutstop
// positioning options
randomize: false, // use random node positions at beginning of layout
// infinite layout options
infinite: false // overrides all other options for a forces-all-the-time mode
});
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
A generic continuous layout class
*/
var assign = __webpack_require__(1);
var defaults = __webpack_require__(5);
var makeBoundingBox = __webpack_require__(7);
var _require = __webpack_require__(8),
setInitialPositionState = _require.setInitialPositionState,
refreshPositions = _require.refreshPositions,
getNodePositionData = _require.getNodePositionData;
var _require2 = __webpack_require__(9),
multitick = _require2.multitick;
var Layout = function () {
function Layout(options) {
_classCallCheck(this, Layout);
var o = this.options = assign({}, defaults, options);
var s = this.state = assign({}, o, {
layout: this,
nodes: o.eles.nodes(),
edges: o.eles.edges(),
tickIndex: 0,
firstUpdate: true
});
s.animateEnd = o.animate && o.animate === 'end';
s.animateContinuously = o.animate && !s.animateEnd;
}
_createClass(Layout, [{
key: 'getScratch',
value: function getScratch(el) {
var name = this.state.name;
var scratch = el.scratch(name);
if (!scratch) {
scratch = {};
el.scratch(name, scratch);
}
return scratch;
}
}, {
key: 'run',
value: function run() {
var l = this;
var s = this.state;
s.tickIndex = 0;
s.firstUpdate = true;
s.startTime = Date.now();
s.running = true;
s.currentBoundingBox = makeBoundingBox(s.boundingBox, s.cy);
if (s.ready) {
l.one('ready', s.ready);
}
if (s.stop) {
l.one('stop', s.stop);
}
s.nodes.forEach(function (n) {
return setInitialPositionState(n, s);
});
l.prerun(s);
if (s.animateContinuously) {
var ungrabify = function ungrabify(node) {
if (!s.ungrabifyWhileSimulating) {
return;
}
var grabbable = getNodePositionData(node, s).grabbable = node.grabbable();
if (grabbable) {
node.ungrabify();
}
};
var regrabify = function regrabify(node) {
if (!s.ungrabifyWhileSimulating) {
return;
}
var grabbable = getNodePositionData(node, s).grabbable;
if (grabbable) {
node.grabify();
}
};
var updateGrabState = function updateGrabState(node) {
return getNodePositionData(node, s).grabbed = node.grabbed();
};
var onGrab = function onGrab(_ref) {
var target = _ref.target;
updateGrabState(target);
};
var onFree = onGrab;
var onDrag = function onDrag(_ref2) {
var target = _ref2.target;
var p = getNodePositionData(target, s);
var tp = target.position();
p.x = tp.x;
p.y = tp.y;
};
var listenToGrab = function listenToGrab(node) {
node.on('grab', onGrab);
node.on('free', onFree);
node.on('drag', onDrag);
};
var unlistenToGrab = function unlistenToGrab(node) {
node.removeListener('grab', onGrab);
node.removeListener('free', onFree);
node.removeListener('drag', onDrag);
};
var fit = function fit() {
if (s.fit && s.animateContinuously) {
s.cy.fit(s.padding);
}
};
var onNotDone = function onNotDone() {
refreshPositions(s.nodes, s);
fit();
requestAnimationFrame(_frame);
};
var _frame = function _frame() {
multitick(s, onNotDone, _onDone);
};
var _onDone = function _onDone() {
refreshPositions(s.nodes, s);
fit();
s.nodes.forEach(function (n) {
regrabify(n);
unlistenToGrab(n);
});
s.running = false;
l.emit('layoutstop');
};
l.emit('layoutstart');
s.nodes.forEach(function (n) {
ungrabify(n);
listenToGrab(n);
});
_frame(); // kick off
} else {
var done = false;
var _onNotDone = function _onNotDone() {};
var _onDone2 = function _onDone2() {
return done = true;
};
while (!done) {
multitick(s, _onNotDone, _onDone2);
}
s.eles.layoutPositions(this, s, function (node) {
var pd = getNodePositionData(node, s);
return { x: pd.x, y: pd.y };
});
}
l.postrun(s);
return this; // chaining
}
}, {
key: 'prerun',
value: function prerun() {}
}, {
key: 'postrun',
value: function postrun() {}
}, {
key: 'tick',
value: function tick() {}
}, {
key: 'stop',
value: function stop() {
this.state.running = false;
return this; // chaining
}
}, {
key: 'destroy',
value: function destroy() {
return this; // chaining
}
}]);
return Layout;
}();
module.exports = Layout;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function (bb, cy) {
if (bb == null) {
bb = { x1: 0, y1: 0, w: cy.width(), h: cy.height() };
} else {
// copy
bb = { x1: bb.x1, x2: bb.x2, y1: bb.y1, y2: bb.y2, w: bb.w, h: bb.h };
}
if (bb.x2 == null) {
bb.x2 = bb.x1 + bb.w;
}
if (bb.w == null) {
bb.w = bb.x2 - bb.x1;
}
if (bb.y2 == null) {
bb.y2 = bb.y1 + bb.h;
}
if (bb.h == null) {
bb.h = bb.y2 - bb.y1;
}
return bb;
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var assign = __webpack_require__(1);
var setInitialPositionState = function setInitialPositionState(node, state) {
var p = node.position();
var bb = state.currentBoundingBox;
var scratch = node.scratch(state.name);
if (scratch == null) {
scratch = {};
node.scratch(state.name, scratch);
}
assign(scratch, state.randomize ? {
x: bb.x1 + Math.round(Math.random() * bb.w),
y: bb.y1 + Math.round(Math.random() * bb.h)
} : {
x: p.x,
y: p.y
});
scratch.locked = node.locked();
};
var getNodePositionData = function getNodePositionData(node, state) {
return node.scratch(state.name);
};
var refreshPositions = function refreshPositions(nodes, state) {
nodes.positions(function (node) {
var scratch = node.scratch(state.name);
return {
x: scratch.x,
y: scratch.y
};
});
};
module.exports = { setInitialPositionState: setInitialPositionState, getNodePositionData: getNodePositionData, refreshPositions: refreshPositions };
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var nop = function nop() {};
var tick = function tick(state) {
var s = state;
var l = state.layout;
var tickIndicatesDone = l.tick(s);
if (s.firstUpdate) {
if (s.animateContinuously) {
// indicate the initial positions have been set
s.layout.emit('layoutready');
}
s.firstUpdate = false;
}
s.tickIndex++;
var duration = Date.now() - s.startTime;
return !s.infinite && tickIndicatesDone;
};
var multitick = function multitick(state) {
var onNotDone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : nop;
var onDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : nop;
var done = false;
var s = state;
for (var i = 0; i < s.refresh; i++) {
done = !s.running || tick(s);
if (done) {
break;
}
}
if (!done) {
onNotDone();
} else {
onDone();
}
};
module.exports = { tick: tick, multitick: multitick };
/***/ })
/******/ ]);
});