function define(prop, value) {
Object.defineProperty( /* context of caller */ , prop, {value: value});
}
function F() {
define('x', 42);
}
var f = new F();
Is there a way to get context (inline commented in code above) of the calling function?
It works fine if I bind to this (replace comment to this
) and inside F
constructor declare var def = define.bind(this);