Skip to content
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

feat(index): move isInitialized to aurelia-pal #16

Merged
merged 2 commits into from
Dec 1, 2016

Conversation

niieani
Copy link
Contributor

@niieani niieani commented Nov 21, 2016

It makes sense to have isInitialized in aurelia-pal, not in each individual -pal repository, otherwise you can initialize it multiple times with different PALs by mistake, which is probably not the desired behavior. I've added a reset() function just in case somebody wants to purposefully reinitialize PAL with a different version.

Related PRs for all PALs:

niieani added a commit to aurelia/pal-nodejs that referenced this pull request Nov 22, 2016
/**
* The runtime's history API.
*/
history: Object;
history: typeof window.history;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct for history and location? I get that Element isn't an instance of Element but is the type itself but history and location are the instances of history and location.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EisenbergEffect Yeah, this is correct. typeof in TypeScript doesn't mean "the class of X", but simply "same type as X". So "typeof window.history" is the type of an instance of history.

Copy link
Contributor Author

@niieani niieani Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MeirionHughes I've checked this. The reason last one came out wrong is you have an error in your example. Last example should be:

let foo = new Foo();
let foo2: typeof foo = foo;

Since you used typeof Foo instead of typeof foo you got the ctor of Foo, not referenced type of the variable foo.

Going back to the actual problem, history is a property of the window object. So typeof window.history is the type of the variable on the Window object, i.e. type of the instance of History.

Copy link

@MeirionHughes MeirionHughes Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... never mind; its fine because the typeof target is an instance, so it grabs the type.

Copy link
Contributor

@EisenbergEffect EisenbergEffect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need some clarification on my question. Otherwise, I can merge this. Let me know.

@EisenbergEffect EisenbergEffect merged commit edb6663 into aurelia:master Dec 1, 2016
@niieani niieani deleted the isInitialized branch December 1, 2016 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants