Created
May 27, 2014 12:48
-
-
Save pjanik/61d041fc34b05cb81a1b 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 Foo() { | |
this.bigData = new Array(5000000).join("XXXXX"); | |
this.smallData = "bla bla"; | |
} | |
Foo.prototype.m = function() { | |
var smallData = this.smallData; | |
$(window).on('click', function() { | |
console.log(smallData); | |
}); | |
}; | |
window.f = new Foo(); | |
window.f.m(); | |
delete window.f; | |
}()); | |
// VS | |
(function() { | |
function Bar() { | |
var bigData = new Array(5000000).join("XXXXX"); | |
var smallData = "bla bla"; | |
return { | |
m: function() { | |
$(window).on('click', function() { | |
console.log(smallData); | |
}); | |
} | |
}; | |
} | |
window.b = new Bar(); | |
window.b.m(); | |
delete window.b; | |
}()); | |
// VS | |
(function() { | |
function Bar() { | |
var bigData = new Array(5000000).join("XXXXX"); | |
var smallData = "bla bla"; | |
return { | |
m: function() { | |
$(window).on('click', function() { | |
console.log(smallData); | |
bigData += "X"; | |
}); | |
} | |
}; | |
} | |
window.b = new Bar(); | |
window.b.m(); | |
delete window.b; | |
}()); | |
// VS | |
(function() { | |
function Bar() { | |
var bigData = new Array(5000000).join("XXXXX"); | |
var smallData = "bla bla"; | |
return { | |
m: function() { | |
$(window).on('click', function() { | |
console.log(smallData); | |
}); | |
}, | |
n: function() { | |
bigData += "X"; | |
} | |
}; | |
} | |
window.b = new Bar(); | |
window.b.m(); | |
delete window.b; | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment