mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Spark._currentRenderer not an EnvironmentVariable
This isn't the kind of dynamic var that should persist into timer callbacks, it should just be on the stack. Also cuts dependence of spark on dynamics.
This commit is contained in:
@@ -8,7 +8,6 @@ PACKAGES_DIR=`dirname $0`/../packages
|
||||
|
||||
echo 'Meteor = {};'
|
||||
cat $PACKAGES_DIR/uuid/uuid.js
|
||||
cat $PACKAGES_DIR/meteor/dynamics_browser.js
|
||||
cat $PACKAGES_DIR/deps/deps.js
|
||||
cat $PACKAGES_DIR/liverange/liverange.js
|
||||
cat $PACKAGES_DIR/universal-events/listener.js
|
||||
|
||||
@@ -29,7 +29,20 @@
|
||||
|
||||
Spark = {};
|
||||
|
||||
Spark._currentRenderer = new Meteor.EnvironmentVariable;
|
||||
Spark._currentRenderer = (function () {
|
||||
var current = null;
|
||||
return {
|
||||
get: function () {
|
||||
return current;
|
||||
},
|
||||
withValue: function (v, func) {
|
||||
var previous = current;
|
||||
current = v;
|
||||
try { return func(); }
|
||||
finally { current = previous; }
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
Spark._TAG = "_spark_" + Meteor.uuid();
|
||||
// XXX document contract for each type of annotation?
|
||||
|
||||
Reference in New Issue
Block a user