As Chetan Sastri suggested in his answer, you can check for the existence of [native code] inside the gated function:
Object.keys(window).filter(function(x) { if (!(window[x] instanceof Function)) return false; return !/\[native code\]/.test(window[x].toString()) ? true : false; });
Or simply:
Object.keys(window).filter(function(x) { return window[x] instanceof Function && !/\[native code\]/.test(window[x].toString()); });
in chrome you can get all non-local variables and functions:
Object.keys(window);
razzak Aug 09 '14 at 8:31 2014-08-09 08:31
source share