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

Globals to add #2

Open
4 of 6 tasks
chicoxyzzy opened this issue Nov 15, 2018 · 6 comments
Open
4 of 6 tasks

Globals to add #2

chicoxyzzy opened this issue Nov 15, 2018 · 6 comments

Comments

@chicoxyzzy
Copy link
Contributor

chicoxyzzy commented Nov 15, 2018

List of globals to add:

@styfle
Copy link
Contributor

styfle commented Dec 21, 2018

Does Promise belong in the globals list?

@ljharb
Copy link

ljharb commented Dec 21, 2018

That’s already a language builtin; what needs to be added?

@littledan
Copy link
Owner

setTimeout

@joyeecheung
Copy link

joyeecheung commented Dec 22, 2018

The full range of global timer functions in Node.js:

  • clearImmediate
  • clearInterval
  • clearTimeout
  • setImmediate
  • setInterval
  • setTimeout

There are also queueMicrotask which is experimental, and WebAssembly which comes from V8. (Node.js's console is not entirely from V8 depending on where you are accessing it)

@joyeecheung
Copy link

Also Node.js implements parts of the Performance Timing API but it's still experimental and I don't recall plans to make it a global. It is intentionally different from the browser in some cases (e.g. nodejs/node#19563)

@joyeecheung
Copy link

joyeecheung commented Dec 22, 2018

BTW this script can be used to find Node.js-specific globals:

'use strict';

const vm = require('vm');
const globalsFromVM = JSON.parse(
  JSON.stringify(
    vm.runInNewContext('Reflect.ownKeys(globalThis)')
  )
);

const globalsFromNode = [];
for (const key of Reflect.ownKeys(globalThis)) {
  if (!globalsFromVM.includes(key)) {
    globalsFromNode.push(key);
  }
}

console.log(globalsFromNode.map(key => String(key)).join('\n'))

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

5 participants