Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
V8 reflection
var reflection = {
getCallStack: function getCallStack() {
var old = Error.prepareStackTrace, e = {};
Error.prepareStackTrace = function (e, cs) { return cs; };
if (Error.captureStackTrace) {
Error.captureStackTrace(e, getCallStack);
e = e.stack;
e.shift();
Error.prepareStackTrace = old;
}
return e;
},
fnInfo: function (callsite) {
return {
name: function () { return callsite.getFunctionName(); },
module: function () { return urlToModuleName(callsite.getScriptNameOrSourceURL()); },
params: function () { return getParams(callsite.getFunction()); }
};
},
getCallingModule: function () {
var stack = reflection.getCallStack();
if (stack.length) {
stack.shift();
return reflection.fnInfo(stack[0]).module();
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.