-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
web: Convert demo to typescript and copy the new extension-player styling over #14093
Conversation
b8d4d29
to
1166862
Compare
web/packages/demo/src/index.ts
Outdated
const overlay = document.getElementById("overlay"); | ||
const authorContainer = document.getElementById("author-container"); | ||
const author = document.getElementById("author"); | ||
const main = document.getElementById("player-container")!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In https://github.com/ruffle-rs/ruffle/blob/master/web/packages/extension/src/player.ts#L25, this was renamed playerContainer
. That name is probably better since that matches the id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. I renamed it back just to help work with the diff, but I've renamed it again now
web/packages/demo/src/index.ts
Outdated
const main = document.getElementById("player-container")!; | ||
const overlay = document.getElementById("overlay")!; | ||
const authorContainer = document.getElementById("author-container")!; | ||
const author = <HTMLLinkElement>document.getElementById("author"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to use the prefix type cast operator instead of as
(here and elsewhere)? The as
operator is preferred according to https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-6.html#new-tsx-file-extension-and-as-operator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix it here and add a lint in a future PR to enforce as
, as we use a lot of angle casting currently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is needed to make the "Select File" button work:
ruffle/web/packages/extension/src/player.ts
Lines 272 to 276 in cad1621
document | |
.getElementById("local-file-label")! | |
.addEventListener("click", () => { | |
document.getElementById("local-file")!.click(); | |
}); |
Made it hide the logo when the screen is <=600px wide |
The demo now has the improvements from #13473, and uses the actual API through typescript