forked from ThaUnknown/jassub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpre-worker.js
34 lines (29 loc) · 854 Bytes
/
pre-worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* eslint-disable no-global-assign, no-unused-vars, prefer-const, no-extend-native */
/* global out, err, updateMemoryViews, wasmMemory */
function assert (c, m) {
if (!c) throw m
}
let asm = null
out = text => {
if (text === 'JASSUB: No usable fontconfig configuration file found, using fallback.') {
console.debug(text)
} else {
console.log(text)
}
}
err = text => {
if (text === 'Fontconfig error: Cannot load default config file: No such file: (null)') {
console.debug(text)
} else {
console.error(text)
}
}
// patch EMS function to include Uint8Clamped, but call old function too
updateMemoryViews = (_super => {
return () => {
_super()
self.wasmMemory = wasmMemory
self.HEAPU8C = new Uint8ClampedArray(wasmMemory.buffer)
self.HEAPU8 = new Uint8Array(wasmMemory.buffer)
}
})(updateMemoryViews)