Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Environments/Platforms/Implementations #320

Open
thecotne opened this issue Dec 12, 2020 · 1 comment
Open

Environments/Platforms/Implementations #320

thecotne opened this issue Dec 12, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@thecotne
Copy link
Contributor

because javascript has insane number of different implementations where it can be executed (e.g. chrome, firefox, nodejs, deno, njs) and all of those implementations have different versions and user/developer will want to have set of environments that need to be supported (checked against)

also there are web workers which have different environment (no DOM, no window, etc) and it should be possible to check web worker code correctly

proposal

we can define global variables, function, classes, etc. in environment like this

// environment NameOfEnvironment (version comparisonOperator versionNumber)
environment chrome (version >= 86.0) {
   function showOpenFilePicker() {}
}

so we have showOpenFilePicker but we know it's only available in chrome@>=86 and we know that before using it we need to check if we are in correct environment either by checking existence of showOpenFilePicker or by checking something else that would refine our environment to be chrome@>=86

@thecotne
Copy link
Contributor Author

we can add corejs and babel as environments as well so we know when polyfill is missing (or when specific polyfill is needed)

also this will be good for developers who target specific environments for example chrome extension developer who is targeting chrome@>=86 does not need to check existence of showOpenFilePicker

@JSMonk JSMonk added the enhancement New feature or request label Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants