Message from JavaScript discussions
January 2017
— Is there any way to force a scope closure over a pre defined callback?
Ie for
var thing = "hello";
var myCallback = function () {
console.log(thing);
}
is there any way to invoke the callback in a way that removes
thing
from the scope
— Instead of "hello" I want undefined
— I don't think so. The most similar thing could be redefining with let the variables you would use inside the function.
— But that is not on a pre defined callback
— Hmm, thought so
— I wanted to see if I could restrict what enters the callback scope
— Guess a big warning sign that says "don't put shit in here" will suffice
— Floofies I think that you could enforce that with webworkers
— That depends, I let the developer supply their own callback
—
dataStore.addAction("myAction", function (state, parameters) {
state.prop = "value";
return state;
});
— I don't want them putting in other sources of data