Skip to content

Instantly share code, notes, and snippets.

@jsermeno
Created September 11, 2011 02:36
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 jsermeno/1209094 to your computer and use it in GitHub Desktop.
Save jsermeno/1209094 to your computer and use it in GitHub Desktop.
Window, Self, and Web Workers
if ( window.Blob === undefined ) {
// attach library custom implementation
} else {
// use native implementation
}
function qux() {
var that = this;
that.bar = false;
document.getElementById('foo').addEventListener('click', function(){
that.bar = true;
}, false);
}
function qux() {
var self = this;
self.bar = false;
document.getElementById('foo').addEventListener('click', function(){
self.bar = true;
}, false);
}
if ( self.Blob === undefined ) {
// attach library custom implementation
} else {
// use native implementation
}
var root = this;
if ( typeof module !== 'undefined' && module.exports ) {
module.exports = _;
_._ = _;
} else {
root['_'] = _;
}
if ( typeof Blob === 'undefined' ) {
// attach library custom implementation
} else {
// use native implementation
}
window.open('http://www.google.com', 'googlePopup', 'status=1, toolbar=1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment