Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add WindowOrWorkerGlobalScope #430

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

Merged
merged 7 commits into from
Aug 22, 2021

Conversation

japgolly
Copy link
Contributor

@japgolly japgolly commented Nov 14, 2020

Supersedes #416.

Additionally, this fixes the following:

  • IDBEnvironment removed because it's officially obsolete and "although
    it may still work in some browsers, its use is discouraged since it
    could be removed at any time".

  • indexedDB now wrapped in js.UndefOr because it's not always available

  • indexedDB added to WorkerGlobalScope

  • caches return type changed from js.Any to js.UndefOr[CacheStorage]

  • caches added to Window

  • CacheStorage moved into experiment.cachestorage as it's available from
    Window too

  • Add missing methods to window and web-worker scopes:

    • crossOriginIsolated
    • isSecureContext
    • origin

Ref: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope

@japgolly
Copy link
Contributor Author

Oh no. I now see two things.

  1. There is overlap with PR Add WindowOrWorkerGlobalScope #416. I didn't even see it until I raised this PR.
  2. I only added the properties and not the methods. (sigh)

Regarding the surface area of this PR that intersects with #416, this PR is more accurately typed. The only concern with this PR is that it is incomplete. We can either merge this first and then follow up with a revised #416, or combine this and #416 to form a new PR. @sjrd please let us know which you'll allow and we'll make it happen.

@exoego Happy to work together to combine our PRs, or if you couldn't be bothered anymore, I'm happy to integrate your PR into mine. Yours did come first after all :D よろしくお願いします

@exoego
Copy link
Contributor

exoego commented Nov 14, 2020

@japgolly I am fine if I close #416 and you make this PR complete by bringing some missing parts from #416 😄

@japgolly
Copy link
Contributor Author

japgolly commented Nov 14, 2020

np @exoego I'll combine our PRs in the next few days. 👍 And thanks for your work there. I've got so much other work to be doing so I think I'd cry if I myself had to write all the new facades in your PR 😅

@japgolly japgolly marked this pull request as draft November 16, 2020 01:52
@japgolly
Copy link
Contributor Author

I'll combine our PRs in the next few days

A few days, a month, they're the same thing right? Hmmm.... Moving on. I've merged #416 into this PR and made a few little fixes. This is good to go now.

@japgolly japgolly marked this pull request as ready for review December 15, 2020 02:00
@exoego
Copy link
Contributor

exoego commented Mar 21, 2021

@japgolly Could you update this PR so that @sjrd may review ?

@japgolly
Copy link
Contributor Author

Yeah I have already. I did on 15th Dec 2020. There's a comment right above yours @exoego 😄

@japgolly japgolly force-pushed the WindowOrWorkerGlobalScope branch from 8acd9d0 to 71126c1 Compare March 21, 2021 22:40
@japgolly
Copy link
Contributor Author

Did a rebase.

@sjrd
Copy link
Member

sjrd commented Aug 8, 2021

For scalajs-dom 2.x, which doesn't have to support Scala.js 0.6.x, a much better alternative to defining WindowOrWorkerGlobalScope is to simply define its members as @js.native members of the dom package object. For example, like how fetch is defined in
https://github.com/scala-js/scala-js-dom/pull/458/files#diff-492b8ef836683ba613a558252a12fa68f30e3fd2a220fc21a1082a1d7319fe2e

@armanbilge armanbilge force-pushed the WindowOrWorkerGlobalScope branch from 6017ef4 to 71126c1 Compare August 10, 2021 02:00
@armanbilge armanbilge changed the base branch from master to series/1.x August 10, 2021 02:00
@japgolly japgolly marked this pull request as draft August 12, 2021 23:54
@japgolly japgolly added this to the v1.2.0 milestone Aug 13, 2021
Additionally, this fixes the following:

* IDBEnvironment removed because it's officially obsolete and "although
  it may still work in some browsers, its use is discouraged since it
  could be removed at any time".

* indexedDB now wrapped in js.UndefOr because it's not always available

* indexedDB added to WorkerGlobalScope

* caches return type changed from js.Any to js.UndefOr[CacheStorage]

* caches added to Window

* CacheStorage moved into experiment.cachestorage as it's available from
  Window too

* Add missing methods to window and web-worker scopes:
  * crossOriginIsolated
  * isSecureContext
  * origin

Ref: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
commit c794a67
Author: exoego <[email protected]>
Date:   Thu Jun 25 12:21:53 2020 +0900

    Add WindowOrWorkerGlobalScope
@japgolly japgolly force-pushed the WindowOrWorkerGlobalScope branch from 71126c1 to db424e9 Compare August 20, 2021 03:17
@armanbilge
Copy link
Member

@japgolly is this binary compatible? I don't think this change is:

CacheStorage moved into experiment.cachestorage as it's available from Window too

I think the rest would be okay though. So either undo just the CacheStorage change and merge or put off to 2.0?

@japgolly
Copy link
Contributor Author

@armanbilge Nah it's not. I'll update this soon (not today though) for compat.

@japgolly japgolly requested a review from armanbilge August 22, 2021 23:04
@japgolly japgolly marked this pull request as ready for review August 22, 2021 23:04
@japgolly
Copy link
Contributor Author

Ready to go @armanbilge !

@armanbilge
Copy link
Member

armanbilge commented Aug 22, 2021

This is a huge one so I'm just going to check changes with bincompat implications and assume you got the facade types right and/or they can be fixed compatibly in the future.

@armanbilge armanbilge merged commit 2227462 into scala-js:series/1.x Aug 22, 2021
@japgolly japgolly deleted the WindowOrWorkerGlobalScope branch August 22, 2021 23:55
@japgolly
Copy link
Contributor Author

Thanks @armanbilge ! 🚀

@armanbilge
Copy link
Member

Thanks to you!! This was an important one :)

Do you think we might get 1.2 out today?

@japgolly
Copy link
Contributor Author

Ooooo do you want to? Are we ready? Anything else you want to add before we do? The only thing left on my list is to get #424 merged in for 1.2.0. I'm not sure if I'll get to it day though, feel free to take that one over if you want. Apart from the experimental question, I was also planning to just test arg = "UTF-8" instead of arg = js.native in something that actually runs and just see what happens.

@armanbilge
Copy link
Member

@japgolly did you see my comment #424 (comment)? It's explained in the Scala.js docs (it's essentially equivalent to arg = js.native).

Ooooo do you want to? Are we ready? Anything else you want to add before we do?

I think so! The most important question for me is did we break anything, which I don't think so. If we forgot something or there are more nice-to-haves, theoretically we could do a 1.2.1 or 1.3 etc. I really really hope that getting a release out with all these merged PRs will encourage the community to become more engaged :)

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.

4 participants