File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 182182 * @return {Promise<bool> } True if the browser can render emoji, false if it cannot.
183183 */
184184 async function browserSupportsEmojiOptimized ( type ) {
185- if ( typeof OffscreenCanvas !== "undefined" ) {
186- const blob = new Blob (
187- [
188- emojiSetsRenderIdentically . toString ( ) +
189- browserSupportsEmoji . toString ( ) +
190- `postMessage(browserSupportsEmoji(${ JSON . stringify ( type ) } ))` ,
191- ] ,
192- { type : "text/javascript" }
193- ) ;
185+ if ( typeof OffscreenCanvas !== 'undefined' ) {
186+ const workerScript =
187+ `const emojiSetsRenderIdentically = ${ emojiSetsRenderIdentically . toString ( ) } ;` +
188+ `const browserSupportsEmoji = ${ browserSupportsEmoji . toString ( ) } ;` +
189+ `postMessage(browserSupportsEmoji(${ JSON . stringify ( type ) } ))` ;
190+ const blob = new Blob ( [ workerScript ] , { type : 'text/javascript' } ) ;
194191 const worker = new Worker ( URL . createObjectURL ( blob ) ) ;
195192 return await new Promise ( function ( resolve ) {
196193 worker . onmessage = function ( event ) {
You can’t perform that action at this time.
0 commit comments