Comments (6)
d088f6f adds this.
from hermes.
globalThis is the only standard JS global :-) the others are part of node or browsers.
from hermes.
While globalThis
isn't part of the standard yet (still in Stage 3 of the TC39 proposal process), it's already gained some amount of adoption and it seems reasonable to plan to add it to Hermes. We'll work on adding the property to the global object soon.
If you need access to the global object before globalThis
is added to Hermes, you can use the Function constructor (which will be a little slower but should produce the correct output):
let global = (new Function('return this'))();
from hermes.
@avp it's shipping in every browser https://twitter.com/mathias/status/1151140681374547969 so the stage isn't really relevant; it'll be stage 4 relatively soon. Glad to hear you're adding it :-)
from hermes.
Itβs a shame that globalThis
is a property that is writable, if it was a keyword we could compile it to GetGlobalObject
in HBC.
from hermes.
@dulinriley see item 2: https://github.com/tc39/proposal-global/blob/master/NAMING.md#constraints
from hermes.
Related Issues (20)
- fatal: unable to access 'http://github.com/facebook/hermes.git/' HOT 2
- I hope Static Hermes supported Windows, Linux, and MacOS. HOT 2
- Local debug and release build throws a type error HOT 3
- I hope it was possible for Static Hermes to native AOT compile all the existing NPM modules. HOT 1
- Intl.DateTimeFormat does not support 'Europe/Kyiv' timezone HOT 2
- It would be good for Static Hermes if it could use pure JavaScript code(that has no type annotations) with automatic type guessing like "var" code in Dart, or ":=" in Go. HOT 7
- Using Intl with standalone Hermes app HOT 2
- Support for top level await HOT 1
- iphoneos framework very large size issue (build-apple-framework.sh) HOT 7
- [Debugger] Incorrect scope variable information for variable initialized in for-loop HOT 3
- Race Condition between HadesGC and HermesInternal.getEpilogues() Causes Segfault
- Assertion `IDom && "Reached the top of the tree!"' failed in ./hermes/lib/Optimizer/Scalar/Mem2Reg.cpp HOT 1
- prettier plugin: Infinite loop for malformed graphql relay query
- Closures caputure external variable errors HOT 9
- [Profiler] First sample sometimes has timestamp of zero HOT 1
- The Code Sentry scan reports code vulnerabilities - facebook/hermes HOT 2
- Short-hand methods don't have prototype / construct HOT 8
- Linking static hermes HOT 4
- spread arguments throw "constructor not callable" when `Array` variable declared HOT 1
- `atob` is less forgiving with padding than JSC, Node and browser based implementations HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hermes.