I don't see why they couldn't just name it global. There's the "let's not conflict"-argument, and "let's fight around with existing types".
But in all honesty... there's not much you can "assume" about the global object anyways, you will still have to check if (global.feature) for most features if you're building a cross-platform lib, and I'm not sure how globalThis would help with that.
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
"Attempts were made to ship under the name global, but it turns out that this does, in fact, break some existing websites." per the spec github.com/tc39/proposal-global
Nobody will ever be happy with the name
globalThis
😂Seems really useful though!
Yeaaa... usefulness is an 11/10 but name scheme is about a -1/10
I don't see why they couldn't just name it
global
. There's the "let's not conflict"-argument, and "let's fight around with existing types".But in all honesty... there's not much you can "assume" about the global object anyways, you will still have to check
if (global.feature)
for most features if you're building a cross-platform lib, and I'm not sure howglobalThis
would help with that."Attempts were made to ship under the name global, but it turns out that this does, in fact, break some existing websites." per the spec github.com/tc39/proposal-global
Thank you for sharing! ✌️