Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active November 30, 2017 20:28
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 cvazac/00068f42ec4356312a1a8e0007171478 to your computer and use it in GitHub Desktop.
Save cvazac/00068f42ec4356312a1a8e0007171478 to your computer and use it in GitHub Desktop.
;(function() {
function getNatives(objects) {
if (typeof objects === 'string') {
objects = [objects]
}
var natives = {}
if (objects.length) {
var iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = 'javascript:false'
document.getElementsByTagName('script')[0].parentNode.appendChild(iframe)
for (var i = 0; i < objects.length; i++) {
natives[objects[i]] = iframe.contentWindow[objects[i]]
}
iframe.parentNode.removeChild(iframe)
}
return natives
}
module.exports = getNatives;
})();
[![Analytics](https://ga-beacon.appspot.com/UA-89789001-2/natives)](https://github.com/igrigorik/ga-beacon)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment