Last active
November 30, 2017 20:28
-
-
Save cvazac/00068f42ec4356312a1a8e0007171478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(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