Remove unused Intl.Segmenter polyfill (#1789)
This commit is contained in:
parent
4bf1719092
commit
9fb20517ae
4 changed files with 1 additions and 24 deletions
|
@ -1,5 +1,4 @@
|
|||
import 'fast-text-encoding'
|
||||
import Graphemer from 'graphemer'
|
||||
// @ts-ignore no decl -prf
|
||||
import findLast from 'array.prototype.findlast'
|
||||
export {}
|
||||
|
@ -54,18 +53,3 @@ globalThis.atob = (str: string): string => {
|
|||
}
|
||||
return result
|
||||
}
|
||||
|
||||
const splitter = new Graphemer()
|
||||
globalThis.Intl = globalThis.Intl || {}
|
||||
|
||||
// @ts-ignore we're polyfilling -prf
|
||||
globalThis.Intl.Segmenter =
|
||||
// @ts-ignore we're polyfilling -prf
|
||||
globalThis.Intl.Segmenter ||
|
||||
class Segmenter {
|
||||
constructor() {}
|
||||
// NOTE
|
||||
// this is not a precisely correct polyfill but it's sufficient for our needs
|
||||
// -prf
|
||||
segment = splitter.iterateGraphemes
|
||||
}
|
||||
|
|
|
@ -9,12 +9,8 @@ window.setImmediate = (cb: () => void) => setTimeout(cb, 0)
|
|||
|
||||
// @ts-ignore not on the TS signature due to bad support -prf
|
||||
if (!globalThis.Intl?.Segmenter) {
|
||||
// NOTE loading as a separate script to reduce main bundle size, as this is only needed in FF -prf
|
||||
const script = document.createElement('script')
|
||||
script.setAttribute('src', '/static/js/intl-segmenter-polyfill.min.js')
|
||||
document.head.appendChild(script)
|
||||
|
||||
// loading emoji mart data
|
||||
// TODO: This condition doesn't make sense; emojimart has nothing to do with Intl.
|
||||
const emojiMartScript = document.createElement('script')
|
||||
emojiMartScript.setAttribute('src', '/static/js/emoji-mart-data.js')
|
||||
document.head.appendChild(emojiMartScript)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue