Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27364] TiAPI: Support globalThis

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, iOS, Windows
Labelsn/a
ReporterEwan Harris
AssigneeEwan Harris
Created2019-08-29T13:45:33.000+0000
Updated2019-09-02T09:32:04.000+0000

Description

Description

Spec document: https://github.com/tc39/proposal-global I believe we will want to implement the globalThis proposal to ensure JS code written that uses this works in Titanium. It is important to note that as it this is specced at the ECMAScript level our JS Engines (v8 and JSCore) will also implement this. Therefore we may wish to follow the polyfill outlined in that repo and ensure that we only define globalThis in environments where it is already defined v8 implemented in release 71 https://v8.dev/blog/v8-release-71 It looks like WebKit implemented in late 2018 https://bugs.webkit.org/show_bug.cgi?id=165171 We might be able to use [test262](https://github.com/tc39/test262) to verify our changes are spec compliant This should be easy to add via the ti.main.js setup we have

Comments

  1. Hans Knöchel 2019-09-02

    Is this really required and requested by the users? I don't think anyone "needs" this right now. Besides, it worries me that the ti.main is filled with any kind of "useful" polyfills although approx. 1 % of all Titanium users actually need it. Especially iOS worries me, since Android can precompile that file but iOS can't. Please prioritize between the actual need and performance in real word apps.
  2. Ewan Harris 2019-09-02

    [~hknoechel], this was actually bought up on slack in the last few weeks. But this isn't a "feature request" per se, it's something we have to do to make sure we're tracking the standards compliance. If you're pulling in code from npm, it's possible that some of that code might be using globalThis
  3. Hans Knöchel 2019-09-02

    Are there statistics on how many people actually use npm deps? And the performance impacts of the ti.main introduction since 7.5.0? This is very important for performance-critical apps.

JSON Source