749 lines
23 KiB
JavaScript
749 lines
23 KiB
JavaScript
//////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// This is a generated file. You can view the original //
|
|
// source in your browser if your browser supports source maps. //
|
|
// Source maps are supported by all recent versions of Chrome, Safari, //
|
|
// and Firefox, and by Internet Explorer 11. //
|
|
// //
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
(function () {
|
|
|
|
/* Imports */
|
|
var Meteor = Package.meteor.Meteor;
|
|
var global = Package.meteor.global;
|
|
var meteorEnv = Package.meteor.meteorEnv;
|
|
var meteorInstall = Package.modules.meteorInstall;
|
|
var meteorBabelHelpers = Package['babel-runtime'].meteorBabelHelpers;
|
|
var Promise = Package.promise.Promise;
|
|
var Symbol = Package['ecmascript-runtime-client'].Symbol;
|
|
var Map = Package['ecmascript-runtime-client'].Map;
|
|
var Set = Package['ecmascript-runtime-client'].Set;
|
|
|
|
/* Package-scope variables */
|
|
var Tracker, Deps;
|
|
|
|
var require = meteorInstall({"node_modules":{"meteor":{"tracker":{"tracker.js":function(){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/tracker/tracker.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
/////////////////////////////////////////////////////
|
|
// Package docs at http://docs.meteor.com/#tracker //
|
|
/////////////////////////////////////////////////////
|
|
|
|
/**
|
|
* @namespace Tracker
|
|
* @summary The namespace for Tracker-related methods.
|
|
*/
|
|
Tracker = {};
|
|
/**
|
|
* @namespace Deps
|
|
* @deprecated
|
|
*/
|
|
|
|
Deps = Tracker; // http://docs.meteor.com/#tracker_active
|
|
|
|
/**
|
|
* @summary True if there is a current computation, meaning that dependencies on reactive data sources will be tracked and potentially cause the current computation to be rerun.
|
|
* @locus Client
|
|
* @type {Boolean}
|
|
*/
|
|
|
|
Tracker.active = false; // http://docs.meteor.com/#tracker_currentcomputation
|
|
|
|
/**
|
|
* @summary The current computation, or `null` if there isn't one. The current computation is the [`Tracker.Computation`](#tracker_computation) object created by the innermost active call to `Tracker.autorun`, and it's the computation that gains dependencies when reactive data sources are accessed.
|
|
* @locus Client
|
|
* @type {Tracker.Computation}
|
|
*/
|
|
|
|
Tracker.currentComputation = null;
|
|
|
|
function setCurrentComputation(c) {
|
|
Tracker.currentComputation = c;
|
|
Tracker.active = !!c;
|
|
}
|
|
|
|
function _debugFunc() {
|
|
// We want this code to work without Meteor, and also without
|
|
// "console" (which is technically non-standard and may be missing
|
|
// on some browser we come across, like it was on IE 7).
|
|
//
|
|
// Lazy evaluation because `Meteor` does not exist right away.(??)
|
|
return typeof Meteor !== "undefined" ? Meteor._debug : typeof console !== "undefined" && console.error ? function () {
|
|
console.error.apply(console, arguments);
|
|
} : function () {};
|
|
}
|
|
|
|
function _maybeSuppressMoreLogs(messagesLength) {
|
|
// Sometimes when running tests, we intentionally suppress logs on expected
|
|
// printed errors. Since the current implementation of _throwOrLog can log
|
|
// multiple separate log messages, suppress all of them if at least one suppress
|
|
// is expected as we still want them to count as one.
|
|
if (typeof Meteor !== "undefined") {
|
|
if (Meteor._suppressed_log_expected()) {
|
|
Meteor._suppress_log(messagesLength - 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _throwOrLog(from, e) {
|
|
if (throwFirstError) {
|
|
throw e;
|
|
} else {
|
|
var printArgs = ["Exception from Tracker " + from + " function:"];
|
|
|
|
if (e.stack && e.message && e.name) {
|
|
var idx = e.stack.indexOf(e.message);
|
|
|
|
if (idx < 0 || idx > e.name.length + 2) {
|
|
// check for "Error: "
|
|
// message is not part of the stack
|
|
var message = e.name + ": " + e.message;
|
|
printArgs.push(message);
|
|
}
|
|
}
|
|
|
|
printArgs.push(e.stack);
|
|
|
|
_maybeSuppressMoreLogs(printArgs.length);
|
|
|
|
for (var i = 0; i < printArgs.length; i++) {
|
|
_debugFunc()(printArgs[i]);
|
|
}
|
|
}
|
|
} // Takes a function `f`, and wraps it in a `Meteor._noYieldsAllowed`
|
|
// block if we are running on the server. On the client, returns the
|
|
// original function (since `Meteor._noYieldsAllowed` is a
|
|
// no-op). This has the benefit of not adding an unnecessary stack
|
|
// frame on the client.
|
|
|
|
|
|
function withNoYieldsAllowed(f) {
|
|
if (typeof Meteor === 'undefined' || Meteor.isClient) {
|
|
return f;
|
|
} else {
|
|
return function () {
|
|
var args = arguments;
|
|
|
|
Meteor._noYieldsAllowed(function () {
|
|
f.apply(null, args);
|
|
});
|
|
};
|
|
}
|
|
}
|
|
|
|
var nextId = 1; // computations whose callbacks we should call at flush time
|
|
|
|
var pendingComputations = []; // `true` if a Tracker.flush is scheduled, or if we are in Tracker.flush now
|
|
|
|
var willFlush = false; // `true` if we are in Tracker.flush now
|
|
|
|
var inFlush = false; // `true` if we are computing a computation now, either first time
|
|
// or recompute. This matches Tracker.active unless we are inside
|
|
// Tracker.nonreactive, which nullfies currentComputation even though
|
|
// an enclosing computation may still be running.
|
|
|
|
var inCompute = false; // `true` if the `_throwFirstError` option was passed in to the call
|
|
// to Tracker.flush that we are in. When set, throw rather than log the
|
|
// first error encountered while flushing. Before throwing the error,
|
|
// finish flushing (from a finally block), logging any subsequent
|
|
// errors.
|
|
|
|
var throwFirstError = false;
|
|
var afterFlushCallbacks = [];
|
|
|
|
function requireFlush() {
|
|
if (!willFlush) {
|
|
// We want this code to work without Meteor, see debugFunc above
|
|
if (typeof Meteor !== "undefined") Meteor._setImmediate(Tracker._runFlush);else setTimeout(Tracker._runFlush, 0);
|
|
willFlush = true;
|
|
}
|
|
} // Tracker.Computation constructor is visible but private
|
|
// (throws an error if you try to call it)
|
|
|
|
|
|
var constructingComputation = false; //
|
|
// http://docs.meteor.com/#tracker_computation
|
|
|
|
/**
|
|
* @summary A Computation object represents code that is repeatedly rerun
|
|
* in response to
|
|
* reactive data changes. Computations don't have return values; they just
|
|
* perform actions, such as rerendering a template on the screen. Computations
|
|
* are created using Tracker.autorun. Use stop to prevent further rerunning of a
|
|
* computation.
|
|
* @instancename computation
|
|
*/
|
|
|
|
Tracker.Computation =
|
|
/*#__PURE__*/
|
|
function () {
|
|
function Computation(f, parent, onError) {
|
|
if (!constructingComputation) throw new Error("Tracker.Computation constructor is private; use Tracker.autorun");
|
|
constructingComputation = false; // http://docs.meteor.com/#computation_stopped
|
|
|
|
/**
|
|
* @summary True if this computation has been stopped.
|
|
* @locus Client
|
|
* @memberOf Tracker.Computation
|
|
* @instance
|
|
* @name stopped
|
|
*/
|
|
|
|
this.stopped = false; // http://docs.meteor.com/#computation_invalidated
|
|
|
|
/**
|
|
* @summary True if this computation has been invalidated (and not yet rerun), or if it has been stopped.
|
|
* @locus Client
|
|
* @memberOf Tracker.Computation
|
|
* @instance
|
|
* @name invalidated
|
|
* @type {Boolean}
|
|
*/
|
|
|
|
this.invalidated = false; // http://docs.meteor.com/#computation_firstrun
|
|
|
|
/**
|
|
* @summary True during the initial run of the computation at the time `Tracker.autorun` is called, and false on subsequent reruns and at other times.
|
|
* @locus Client
|
|
* @memberOf Tracker.Computation
|
|
* @instance
|
|
* @name firstRun
|
|
* @type {Boolean}
|
|
*/
|
|
|
|
this.firstRun = true;
|
|
this._id = nextId++;
|
|
this._onInvalidateCallbacks = [];
|
|
this._onStopCallbacks = []; // the plan is at some point to use the parent relation
|
|
// to constrain the order that computations are processed
|
|
|
|
this._parent = parent;
|
|
this._func = f;
|
|
this._onError = onError;
|
|
this._recomputing = false;
|
|
var errored = true;
|
|
|
|
try {
|
|
this._compute();
|
|
|
|
errored = false;
|
|
} finally {
|
|
this.firstRun = false;
|
|
if (errored) this.stop();
|
|
}
|
|
} // http://docs.meteor.com/#computation_oninvalidate
|
|
|
|
/**
|
|
* @summary Registers `callback` to run when this computation is next invalidated, or runs it immediately if the computation is already invalidated. The callback is run exactly once and not upon future invalidations unless `onInvalidate` is called again after the computation becomes valid again.
|
|
* @locus Client
|
|
* @param {Function} callback Function to be called on invalidation. Receives one argument, the computation that was invalidated.
|
|
*/
|
|
|
|
|
|
var _proto = Computation.prototype;
|
|
|
|
_proto.onInvalidate = function () {
|
|
function onInvalidate(f) {
|
|
var _this = this;
|
|
|
|
if (typeof f !== 'function') throw new Error("onInvalidate requires a function");
|
|
|
|
if (this.invalidated) {
|
|
Tracker.nonreactive(function () {
|
|
withNoYieldsAllowed(f)(_this);
|
|
});
|
|
} else {
|
|
this._onInvalidateCallbacks.push(f);
|
|
}
|
|
}
|
|
|
|
return onInvalidate;
|
|
}();
|
|
/**
|
|
* @summary Registers `callback` to run when this computation is stopped, or runs it immediately if the computation is already stopped. The callback is run after any `onInvalidate` callbacks.
|
|
* @locus Client
|
|
* @param {Function} callback Function to be called on stop. Receives one argument, the computation that was stopped.
|
|
*/
|
|
|
|
|
|
_proto.onStop = function () {
|
|
function onStop(f) {
|
|
var _this2 = this;
|
|
|
|
if (typeof f !== 'function') throw new Error("onStop requires a function");
|
|
|
|
if (this.stopped) {
|
|
Tracker.nonreactive(function () {
|
|
withNoYieldsAllowed(f)(_this2);
|
|
});
|
|
} else {
|
|
this._onStopCallbacks.push(f);
|
|
}
|
|
}
|
|
|
|
return onStop;
|
|
}(); // http://docs.meteor.com/#computation_invalidate
|
|
|
|
/**
|
|
* @summary Invalidates this computation so that it will be rerun.
|
|
* @locus Client
|
|
*/
|
|
|
|
|
|
_proto.invalidate = function () {
|
|
function invalidate() {
|
|
var _this3 = this;
|
|
|
|
if (!this.invalidated) {
|
|
// if we're currently in _recompute(), don't enqueue
|
|
// ourselves, since we'll rerun immediately anyway.
|
|
if (!this._recomputing && !this.stopped) {
|
|
requireFlush();
|
|
pendingComputations.push(this);
|
|
}
|
|
|
|
this.invalidated = true; // callbacks can't add callbacks, because
|
|
// this.invalidated === true.
|
|
|
|
for (var i = 0, f; f = this._onInvalidateCallbacks[i]; i++) {
|
|
Tracker.nonreactive(function () {
|
|
withNoYieldsAllowed(f)(_this3);
|
|
});
|
|
}
|
|
|
|
this._onInvalidateCallbacks = [];
|
|
}
|
|
}
|
|
|
|
return invalidate;
|
|
}(); // http://docs.meteor.com/#computation_stop
|
|
|
|
/**
|
|
* @summary Prevents this computation from rerunning.
|
|
* @locus Client
|
|
*/
|
|
|
|
|
|
_proto.stop = function () {
|
|
function stop() {
|
|
var _this4 = this;
|
|
|
|
if (!this.stopped) {
|
|
this.stopped = true;
|
|
this.invalidate();
|
|
|
|
for (var i = 0, f; f = this._onStopCallbacks[i]; i++) {
|
|
Tracker.nonreactive(function () {
|
|
withNoYieldsAllowed(f)(_this4);
|
|
});
|
|
}
|
|
|
|
this._onStopCallbacks = [];
|
|
}
|
|
}
|
|
|
|
return stop;
|
|
}();
|
|
|
|
_proto._compute = function () {
|
|
function _compute() {
|
|
this.invalidated = false;
|
|
var previous = Tracker.currentComputation;
|
|
setCurrentComputation(this);
|
|
var previousInCompute = inCompute;
|
|
inCompute = true;
|
|
|
|
try {
|
|
withNoYieldsAllowed(this._func)(this);
|
|
} finally {
|
|
setCurrentComputation(previous);
|
|
inCompute = previousInCompute;
|
|
}
|
|
}
|
|
|
|
return _compute;
|
|
}();
|
|
|
|
_proto._needsRecompute = function () {
|
|
function _needsRecompute() {
|
|
return this.invalidated && !this.stopped;
|
|
}
|
|
|
|
return _needsRecompute;
|
|
}();
|
|
|
|
_proto._recompute = function () {
|
|
function _recompute() {
|
|
this._recomputing = true;
|
|
|
|
try {
|
|
if (this._needsRecompute()) {
|
|
try {
|
|
this._compute();
|
|
} catch (e) {
|
|
if (this._onError) {
|
|
this._onError(e);
|
|
} else {
|
|
_throwOrLog("recompute", e);
|
|
}
|
|
}
|
|
}
|
|
} finally {
|
|
this._recomputing = false;
|
|
}
|
|
}
|
|
|
|
return _recompute;
|
|
}();
|
|
/**
|
|
* @summary Process the reactive updates for this computation immediately
|
|
* and ensure that the computation is rerun. The computation is rerun only
|
|
* if it is invalidated.
|
|
* @locus Client
|
|
*/
|
|
|
|
|
|
_proto.flush = function () {
|
|
function flush() {
|
|
if (this._recomputing) return;
|
|
|
|
this._recompute();
|
|
}
|
|
|
|
return flush;
|
|
}();
|
|
/**
|
|
* @summary Causes the function inside this computation to run and
|
|
* synchronously process all reactive updtes.
|
|
* @locus Client
|
|
*/
|
|
|
|
|
|
_proto.run = function () {
|
|
function run() {
|
|
this.invalidate();
|
|
this.flush();
|
|
}
|
|
|
|
return run;
|
|
}();
|
|
|
|
return Computation;
|
|
}(); //
|
|
// http://docs.meteor.com/#tracker_dependency
|
|
|
|
/**
|
|
* @summary A Dependency represents an atomic unit of reactive data that a
|
|
* computation might depend on. Reactive data sources such as Session or
|
|
* Minimongo internally create different Dependency objects for different
|
|
* pieces of data, each of which may be depended on by multiple computations.
|
|
* When the data changes, the computations are invalidated.
|
|
* @class
|
|
* @instanceName dependency
|
|
*/
|
|
|
|
|
|
Tracker.Dependency =
|
|
/*#__PURE__*/
|
|
function () {
|
|
function Dependency() {
|
|
this._dependentsById = Object.create(null);
|
|
} // http://docs.meteor.com/#dependency_depend
|
|
//
|
|
// Adds `computation` to this set if it is not already
|
|
// present. Returns true if `computation` is a new member of the set.
|
|
// If no argument, defaults to currentComputation, or does nothing
|
|
// if there is no currentComputation.
|
|
|
|
/**
|
|
* @summary Declares that the current computation (or `fromComputation` if given) depends on `dependency`. The computation will be invalidated the next time `dependency` changes.
|
|
If there is no current computation and `depend()` is called with no arguments, it does nothing and returns false.
|
|
Returns true if the computation is a new dependent of `dependency` rather than an existing one.
|
|
* @locus Client
|
|
* @param {Tracker.Computation} [fromComputation] An optional computation declared to depend on `dependency` instead of the current computation.
|
|
* @returns {Boolean}
|
|
*/
|
|
|
|
|
|
var _proto2 = Dependency.prototype;
|
|
|
|
_proto2.depend = function () {
|
|
function depend(computation) {
|
|
var _this5 = this;
|
|
|
|
if (!computation) {
|
|
if (!Tracker.active) return false;
|
|
computation = Tracker.currentComputation;
|
|
}
|
|
|
|
var id = computation._id;
|
|
|
|
if (!(id in this._dependentsById)) {
|
|
this._dependentsById[id] = computation;
|
|
computation.onInvalidate(function () {
|
|
delete _this5._dependentsById[id];
|
|
});
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
return depend;
|
|
}(); // http://docs.meteor.com/#dependency_changed
|
|
|
|
/**
|
|
* @summary Invalidate all dependent computations immediately and remove them as dependents.
|
|
* @locus Client
|
|
*/
|
|
|
|
|
|
_proto2.changed = function () {
|
|
function changed() {
|
|
for (var id in meteorBabelHelpers.sanitizeForInObject(this._dependentsById)) {
|
|
this._dependentsById[id].invalidate();
|
|
}
|
|
}
|
|
|
|
return changed;
|
|
}(); // http://docs.meteor.com/#dependency_hasdependents
|
|
|
|
/**
|
|
* @summary True if this Dependency has one or more dependent Computations, which would be invalidated if this Dependency were to change.
|
|
* @locus Client
|
|
* @returns {Boolean}
|
|
*/
|
|
|
|
|
|
_proto2.hasDependents = function () {
|
|
function hasDependents() {
|
|
for (var id in meteorBabelHelpers.sanitizeForInObject(this._dependentsById)) {
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
return hasDependents;
|
|
}();
|
|
|
|
return Dependency;
|
|
}(); // http://docs.meteor.com/#tracker_flush
|
|
|
|
/**
|
|
* @summary Process all reactive updates immediately and ensure that all invalidated computations are rerun.
|
|
* @locus Client
|
|
*/
|
|
|
|
|
|
Tracker.flush = function (options) {
|
|
Tracker._runFlush({
|
|
finishSynchronously: true,
|
|
throwFirstError: options && options._throwFirstError
|
|
});
|
|
};
|
|
/**
|
|
* @summary True if we are computing a computation now, either first time or recompute. This matches Tracker.active unless we are inside Tracker.nonreactive, which nullfies currentComputation even though an enclosing computation may still be running.
|
|
* @locus Client
|
|
* @returns {Boolean}
|
|
*/
|
|
|
|
|
|
Tracker.inFlush = function () {
|
|
return inFlush;
|
|
}; // Run all pending computations and afterFlush callbacks. If we were not called
|
|
// directly via Tracker.flush, this may return before they're all done to allow
|
|
// the event loop to run a little before continuing.
|
|
|
|
|
|
Tracker._runFlush = function (options) {
|
|
// XXX What part of the comment below is still true? (We no longer
|
|
// have Spark)
|
|
//
|
|
// Nested flush could plausibly happen if, say, a flush causes
|
|
// DOM mutation, which causes a "blur" event, which runs an
|
|
// app event handler that calls Tracker.flush. At the moment
|
|
// Spark blocks event handlers during DOM mutation anyway,
|
|
// because the LiveRange tree isn't valid. And we don't have
|
|
// any useful notion of a nested flush.
|
|
//
|
|
// https://app.asana.com/0/159908330244/385138233856
|
|
if (Tracker.inFlush()) throw new Error("Can't call Tracker.flush while flushing");
|
|
if (inCompute) throw new Error("Can't flush inside Tracker.autorun");
|
|
options = options || {};
|
|
inFlush = true;
|
|
willFlush = true;
|
|
throwFirstError = !!options.throwFirstError;
|
|
var recomputedCount = 0;
|
|
var finishedTry = false;
|
|
|
|
try {
|
|
while (pendingComputations.length || afterFlushCallbacks.length) {
|
|
// recompute all pending computations
|
|
while (pendingComputations.length) {
|
|
var comp = pendingComputations.shift();
|
|
|
|
comp._recompute();
|
|
|
|
if (comp._needsRecompute()) {
|
|
pendingComputations.unshift(comp);
|
|
}
|
|
|
|
if (!options.finishSynchronously && ++recomputedCount > 1000) {
|
|
finishedTry = true;
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (afterFlushCallbacks.length) {
|
|
// call one afterFlush callback, which may
|
|
// invalidate more computations
|
|
var func = afterFlushCallbacks.shift();
|
|
|
|
try {
|
|
func();
|
|
} catch (e) {
|
|
_throwOrLog("afterFlush", e);
|
|
}
|
|
}
|
|
}
|
|
|
|
finishedTry = true;
|
|
} finally {
|
|
if (!finishedTry) {
|
|
// we're erroring due to throwFirstError being true.
|
|
inFlush = false; // needed before calling `Tracker.flush()` again
|
|
// finish flushing
|
|
|
|
Tracker._runFlush({
|
|
finishSynchronously: options.finishSynchronously,
|
|
throwFirstError: false
|
|
});
|
|
}
|
|
|
|
willFlush = false;
|
|
inFlush = false;
|
|
|
|
if (pendingComputations.length || afterFlushCallbacks.length) {
|
|
// We're yielding because we ran a bunch of computations and we aren't
|
|
// required to finish synchronously, so we'd like to give the event loop a
|
|
// chance. We should flush again soon.
|
|
if (options.finishSynchronously) {
|
|
throw new Error("still have more to do?"); // shouldn't happen
|
|
}
|
|
|
|
setTimeout(requireFlush, 10);
|
|
}
|
|
}
|
|
}; // http://docs.meteor.com/#tracker_autorun
|
|
//
|
|
// Run f(). Record its dependencies. Rerun it whenever the
|
|
// dependencies change.
|
|
//
|
|
// Returns a new Computation, which is also passed to f.
|
|
//
|
|
// Links the computation to the current computation
|
|
// so that it is stopped if the current computation is invalidated.
|
|
|
|
/**
|
|
* @callback Tracker.ComputationFunction
|
|
* @param {Tracker.Computation}
|
|
*/
|
|
|
|
/**
|
|
* @summary Run a function now and rerun it later whenever its dependencies
|
|
* change. Returns a Computation object that can be used to stop or observe the
|
|
* rerunning.
|
|
* @locus Client
|
|
* @param {Tracker.ComputationFunction} runFunc The function to run. It receives
|
|
* one argument: the Computation object that will be returned.
|
|
* @param {Object} [options]
|
|
* @param {Function} options.onError Optional. The function to run when an error
|
|
* happens in the Computation. The only argument it receives is the Error
|
|
* thrown. Defaults to the error being logged to the console.
|
|
* @returns {Tracker.Computation}
|
|
*/
|
|
|
|
|
|
Tracker.autorun = function (f, options) {
|
|
if (typeof f !== 'function') throw new Error('Tracker.autorun requires a function argument');
|
|
options = options || {};
|
|
constructingComputation = true;
|
|
var c = new Tracker.Computation(f, Tracker.currentComputation, options.onError);
|
|
if (Tracker.active) Tracker.onInvalidate(function () {
|
|
c.stop();
|
|
});
|
|
return c;
|
|
}; // http://docs.meteor.com/#tracker_nonreactive
|
|
//
|
|
// Run `f` with no current computation, returning the return value
|
|
// of `f`. Used to turn off reactivity for the duration of `f`,
|
|
// so that reactive data sources accessed by `f` will not result in any
|
|
// computations being invalidated.
|
|
|
|
/**
|
|
* @summary Run a function without tracking dependencies.
|
|
* @locus Client
|
|
* @param {Function} func A function to call immediately.
|
|
*/
|
|
|
|
|
|
Tracker.nonreactive = function (f) {
|
|
var previous = Tracker.currentComputation;
|
|
setCurrentComputation(null);
|
|
|
|
try {
|
|
return f();
|
|
} finally {
|
|
setCurrentComputation(previous);
|
|
}
|
|
}; // http://docs.meteor.com/#tracker_oninvalidate
|
|
|
|
/**
|
|
* @summary Registers a new [`onInvalidate`](#computation_oninvalidate) callback on the current computation (which must exist), to be called immediately when the current computation is invalidated or stopped.
|
|
* @locus Client
|
|
* @param {Function} callback A callback function that will be invoked as `func(c)`, where `c` is the computation on which the callback is registered.
|
|
*/
|
|
|
|
|
|
Tracker.onInvalidate = function (f) {
|
|
if (!Tracker.active) throw new Error("Tracker.onInvalidate requires a currentComputation");
|
|
Tracker.currentComputation.onInvalidate(f);
|
|
}; // http://docs.meteor.com/#tracker_afterflush
|
|
|
|
/**
|
|
* @summary Schedules a function to be called during the next flush, or later in the current flush if one is in progress, after all invalidated computations have been rerun. The function will be run once and not on subsequent flushes unless `afterFlush` is called again.
|
|
* @locus Client
|
|
* @param {Function} callback A function to call at flush time.
|
|
*/
|
|
|
|
|
|
Tracker.afterFlush = function (f) {
|
|
afterFlushCallbacks.push(f);
|
|
requireFlush();
|
|
};
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}}}}},{
|
|
"extensions": [
|
|
".js",
|
|
".json"
|
|
]
|
|
});
|
|
require("/node_modules/meteor/tracker/tracker.js");
|
|
|
|
/* Exports */
|
|
Package._define("tracker", {
|
|
Tracker: Tracker,
|
|
Deps: Deps
|
|
});
|
|
|
|
})();
|