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:
David Greenspan
2012-09-16 01:22:21 -07:00
parent 10fdc9b261
commit e8256ef866
2 changed files with 14 additions and 2 deletions

View File

@@ -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

View File

@@ -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?