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)
- An issues with with statements HOT 1
- Hermes should throw an exception when BigInts use unsigned shift HOT 2
- Hermes should throw an exception when Maxium BigInt size exceed HOT 1
- simplifySwitchInst in SimplifyCFG ignores negative zero HOT 1
- iOS App submission will require a privacy manifest and signature HOT 6
- Possible memory leak HOT 30
- Compile failure with optimized ASan builds HOT 4
- Thread 6: "Exception NSException * "Unhandled JS Exception: Error: invalid host, js engine: hermes" HOT 32
- Parser: improve error message when await is used in non-async functions or instead of async
- JSRangeErrorException setting maximumFractionDigits to 0 with Intl.NumberFormat currency style HOT 1
- Unreachable in ES6 is reachable. HOT 1
- Update documentation on using custom Hermes builds HOT 3
- Building Static Hermes on Windows HOT 4
- Problems finding libraries with fresh compile under windows HOT 3
- Conversion of large array to a Set seems slow HOT 3
- React Native & Hermes: Is Additional Code Obfuscation Beneficial? HOT 1
- Array.protoype.indexOf() Performance Regression HOT 3
- 'hermes-engine' uses the unencrypted 'http' protocol to transfer the Pod.
- hermes-eslint missing `__defineGeneric` in context `getScope` HOT 1
- Date constructor accept wrong ISO 8601 date HOT 2
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.