[Glitch] Provides legacy fallback for browser that don't support regex flag v
Port 28b0e5ee78 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
1 parent
a6f0ec160e
commit
b8f66e1d33
4 files changed
+54
-21
No files matched your search
@@ -20,5 +20,16 @@ export function loadPolyfills() {
|
||||
loadIntlPolyfills(),
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- those properties might not exist in old browsers, even if they are always here in types
|
||||
needsExtraPolyfills && importExtraPolyfills(),
|
||||
loadEmojiPolyfills(),
|
||||
]);
|
||||
}
|
||||
|
||||
// In the case of no /v support, rely on the emojibase data.
|
||||
async function loadEmojiPolyfills() {
|
||||
if (!('unicodeSets' in RegExp.prototype)) {
|
||||
emojiRegexPolyfill = (await import('emojibase-regex/emoji')).default;
|
||||
}
|
||||
}
|
||||
|
||||
// Null unless polyfill is needed.
|
||||
export let emojiRegexPolyfill: RegExp | null = null;
|
||||
Reference in new issue
Block a user