-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Accessing modules living in different window object? #1865
Comments
reezom
changed the title
Question: Accessing modules living in different document object?
Question: Accessing modules living in different window object?
Jan 30, 2015
@reezom, if your code actually works then you probably only need a type assertion: module Container {
export function magic() { /*...*/ };
}
interface iFrame extends Window {
Container: typeof Container;
}
module Frame {
function doContainerMagic() {
(<iFrame>window.parent).Container.magic();
}
} |
@NoelAbrahams Thank you, that solves it. module Container {
export function magic() { /*...*/ };
}
module Frame {
function doContainerMagic() {
(<typeof Container>window.parent["Container"]).magic();
}
} |
Yes, that'll work, but may create problems one day when function doContainerMagic() {
window.parent["Container"].magic22();
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What is a good/proper/recommended way to access modules in a different window object?
For example, take the iframe scenario (assuming same domain) below:
"Casting to a module" seems not possible. Would #420 (modules implementing interface) provide a possible solution?
The text was updated successfully, but these errors were encountered: