Skip to content

Instantly share code, notes, and snippets.

@cgrand
Last active September 6, 2017 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgrand/8fb659c8c7e7d436410633fe98418aa4 to your computer and use it in GitHub Desktop.
Save cgrand/8fb659c8c7e7d436410633fe98418aa4 to your computer and use it in GitHub Desktop.
Introspectable js scope
// assuming b is a local
// rewrite
function(a) { return a + b; }
// to
Object.defineProperty(function(a) { return a + b; }, "$scope", {value: function() { return {"b": b}; }})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment