GeezerVison is showing github.com — WinterTC Minimum Common Web Platform API Alignment · Issue #10297 · NativeScript/NativeScript
WinterTC Minimum Common Web Platform API Alignment #10297DescriptionIs your feature request related to a problem? Please describe.
In addition to what the NativeScript runtimes provide, they should also provide all the common interfaces and global objects expected from any state of the art JavaScript runtime. WinterCG is a community group doing excellent work in this space to help runtime interoperability of APIs across runtimes.
Describe the solution you'd like
Ensure compliance with at least the minimum specification:
Interfaces:
Global methods / properties:
globalThis
Please accept these terms
Reacted by Juan de Dios Martínez Vallejo, Dj, Angel D. Munoz, Daniel Herr, Jason, Yevhenii Herasymchuk and Paul O Reacted by Angel D. Munoz, Yevhenii Herasymchuk and Paul O ActivityMrSnoozles commented on Feb 24, 2024 @NathanWalker I needed queueMicrotask for the latest Vue Apollo Client to work. I polyfilled it using
import queueMicrotask from "queue-microtask";
global.queueMicrotask ??= queueMicrotask;
which works perfectly. The queue-microtask library is effectively 5 lines of code, so that could be added easily as well. Reacted by Nathan Walker and Martin Honermeyer Reacted by Juan de Dios Martínez Vallejo dangrima90 commented on Feb 26, 2024 @NathanWalker I've a question about the polyfills that will be eventually implemented. I see that in the list above there's no mention of Intl API. My main point of interest is the NumberFormat class, as currently to support number formatting via .toLocaleString(), or be to able to use formatToParts(), polyfills have to be used (such as format js polyfills).
Is this something out of scope for this update please? NathanWalker commented on May 6, 2024 ContributorAuthor More actions @dangrima90 Intl will be an optional package you could include when your app needs it vs. being built into runtime by default. jasongitmail commented on Jul 19, 2024 @NathanWalker Interesting to note (if only for others searching issues like me) that Intl.NumberFormat() partially works in the NativeScript runtime currently, making it seem buggy.
I was attempting to use it to detect whether a dot or comma thousands separator should be used, but NativeScript always formats with a , thousands separator (for every locale I've tried), whereas the same code in Chrome on MacOS will use a dot thousands separator when appropriate for the locale.
// const locale = Device.language; // e.g. 'en-US'
// const locale = 'pt-BR'; // should use dot as thousands separator
const locale = 'NL'; // should use dot as thousands separator
// Format a number and extract the thousand separator
const numberFormat = new Intl.NumberFormat(locale);
const formattedNumber = numberFormat.format(1_000);
const thousandSeparator = formattedNumber.charAt(1);
console.log('locale', locale);
console.log(`Formatted Number: ${formattedNumber}`);
console.log(`Thousand Separator: ${thousandSeparator}`);
Expected result (Chrome MacOS)
 changed the title [-]WinterCG Minimum Common Web Platform API Alignment[/-] [+]WinterTC Minimum Common Web Platform API Alignment[/+] on Jan 17, 2025
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|