Last active
December 23, 2015 23:09
-
-
Save richistron/6708002 to your computer and use it in GitHub Desktop.
Respuesta a Cristian Camilo Chaparro
This file contains hidden or 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
/* | |
No se si en en entendí to pregunta, pero me suena a estos posibles casos | |
*/ | |
// Herencia de un objeto | |
// padre | |
var Parent = (function(){ | |
// constructor | |
function Parent(){}; | |
// propiedad true | |
Parent.prototype.item = true; | |
// regresa el objeto al decir "new Parent" | |
return Parent; | |
})(); | |
// hijo | |
var Child = (function(super){ | |
// extiende a super | |
Child.prototype = new super; | |
// constructor | |
function Child(){}; | |
return Child; | |
})(Parent); | |
/* | |
A lo que yo creo que te refieres es a acceder al scope de otro clusure. | |
*/ | |
// archivo 1 | |
(function(){ | |
var App = {}; | |
App.propiedad1 = true; | |
window.App = App; | |
})() | |
// archivo 2 | |
(function(){ | |
var App = window.App || {}; | |
App.propiedad2 = true; | |
console.log(App.propiedad1); | |
console.log(App.propiedad2); | |
window.App = App; | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment