Skip to content

HashChangeEvent missing #53

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

Closed
tindzk opened this issue Oct 3, 2014 · 4 comments
Closed

HashChangeEvent missing #53

tindzk opened this issue Oct 3, 2014 · 4 comments

Comments

@tindzk
Copy link
Contributor

tindzk commented Oct 3, 2014

There should be a HashChangeEvent. I defined it as follows:

case class HashChangeEvent(newURL: String, oldURL: String)
@sjrd
Copy link
Member

sjrd commented Oct 3, 2014

Shouldn't it rather be

trait HashChangeEvent extends js.Object {
  val newURL: String
  val oldURL: String
}

?

@tindzk
Copy link
Contributor Author

tindzk commented Oct 3, 2014

What's the advantage of inheriting from js.Object?

@sjrd
Copy link
Member

sjrd commented Oct 3, 2014

It's not a matter of advantage or disadvantage. If this represents a JavaScript object, it must inherit from js.Object, otherwise things will just blow up. The compiler treats differently types extending js.Object than those that do not.
See the doc about JavaScript interop.

Btw, it should even inherit from Event.

@tindzk
Copy link
Contributor Author

tindzk commented Oct 3, 2014

Ok, thanks for the information. I saw some Scala.JS code which used case classes in order to cast native objects to them. As this worked fine in my case, I thought that was the way to go.

By the way, I made a pull request with some additions a few weeks ago. Could you have a look at it?

tindzk added a commit to tindzk/scala-js-dom that referenced this issue Oct 7, 2014
tindzk added a commit to tindzk/scala-js-dom that referenced this issue Oct 7, 2014
@sjrd sjrd closed this as completed Oct 7, 2014
Visbone pushed a commit to Visbone/scala-js-dom that referenced this issue Mar 18, 2021
losefish added a commit to losefish/didactic-fiesta that referenced this issue May 17, 2025
sinpaoutc added a commit to sinpaoutc/lucij that referenced this issue May 19, 2025
manu-182002 added a commit to manu-182002/VaibhavBhapkar that referenced this issue May 24, 2025
oguzturker8sdfep added a commit to oguzturker8sdfep/imranvisualpath1 that referenced this issue May 24, 2025
aikobin2008 added a commit to aikobin2008/hasyimibharb that referenced this issue May 26, 2025
FaceGuerrero added a commit to FaceGuerrero/Log3 that referenced this issue Jun 10, 2025
BriansMoore added a commit to BriansMoore/SKGlebaj that referenced this issue Jun 10, 2025
elicepix added a commit to elicepix/sparkfun that referenced this issue Jun 10, 2025
NunuOslo added a commit to NunuOslo/compreso that referenced this issue Jun 10, 2025
XSIFrances added a commit to XSIFrances/memorable that referenced this issue Jun 12, 2025
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

No branches or pull requests

2 participants