Skip to content

Commit ca27d60

Browse files
committed
chore: build
1 parent 6b19a04 commit ca27d60

File tree

6 files changed

+14
-141
lines changed

6 files changed

+14
-141
lines changed

dist/jassub-worker-modern.wasm

1.27 KB
Binary file not shown.

dist/jassub-worker.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jassub-worker.wasm

1.16 KB
Binary file not shown.

dist/jassub-worker.wasm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/worker.js

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,5 @@
1-
/* eslint-disable no-extend-native */
2-
// @ts-ignore
31
import WASM from 'wasm'
42

5-
// polyfills for old or weird engines
6-
7-
if (!String.prototype.startsWith) {
8-
String.prototype.startsWith = function (s, p = 0) {
9-
return this.substring(p, s.length) === s
10-
}
11-
}
12-
13-
if (!String.prototype.includes) {
14-
String.prototype.includes = function (s, p) {
15-
return this.indexOf(s, p) !== -1
16-
}
17-
}
18-
19-
if (!Uint8Array.prototype.slice) {
20-
Uint8Array.prototype.slice = function (b, e) {
21-
return new Uint8Array(this.subarray(b, e))
22-
}
23-
}
24-
25-
function toAbsoluteIndex (index, length) {
26-
const integer = index >> 0
27-
return integer < 0 ? Math.max(integer + length, 0) : Math.min(integer, length)
28-
}
29-
30-
if (!Uint8Array.prototype.fill) {
31-
Int8Array.prototype.fill = Int16Array.prototype.fill = Int32Array.prototype.fill = Uint8Array.prototype.fill = Uint16Array.prototype.fill = Uint32Array.prototype.fill = Float32Array.prototype.fill = Float64Array.prototype.fill = Array.prototype.fill = function (value) {
32-
if (this == null) throw new TypeError('this is null or not defined')
33-
34-
const O = Object(this)
35-
36-
const length = O.length >>> 0
37-
38-
const argumentsLength = arguments.length
39-
let index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length)
40-
const end = argumentsLength > 2 ? arguments[2] : undefined
41-
const endPos = end === undefined ? length : toAbsoluteIndex(end, length)
42-
while (endPos > index) O[index++] = value
43-
return O
44-
}
45-
}
46-
47-
if (!Uint8Array.prototype.copyWithin) {
48-
Int8Array.prototype.copyWithin = Int16Array.prototype.copyWithin = Int32Array.prototype.copyWithin = Uint8Array.prototype.copyWithin = Uint16Array.prototype.copyWithin = Uint32Array.prototype.copyWithin = Float32Array.prototype.copyWithin = Float64Array.prototype.copyWithin = Array.prototype.copyWithin = function (target, start) {
49-
const O = Object(this)
50-
const len = O.length >>> 0
51-
52-
let to = toAbsoluteIndex(target, len)
53-
let from = toAbsoluteIndex(start, len)
54-
const end = arguments.length > 2 ? arguments[2] : undefined
55-
let count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to)
56-
let inc = 1
57-
if (from < to && to < from + count) {
58-
inc = -1
59-
from += count - 1
60-
to += count - 1
61-
}
62-
while (count-- > 0) {
63-
if (from in O) O[to] = O[from]
64-
else delete O[to]
65-
to += inc
66-
from += inc
67-
} return O
68-
}
69-
}
70-
71-
if (!Date.now) Date.now = () => new Date().getTime()
72-
// @ts-ignore
73-
if (!('performance' in self)) self.performance = { now: () => Date.now() }
74-
75-
// implement console methods if they're missing
76-
if (typeof console === 'undefined') {
77-
const msg = (command, a) => {
78-
postMessage({
79-
target: 'console',
80-
command,
81-
content: JSON.stringify(Array.prototype.slice.call(a))
82-
})
83-
}
84-
// @ts-ignore
85-
self.console = {
86-
log: function () {
87-
msg('log', arguments)
88-
},
89-
debug: function () {
90-
msg('debug', arguments)
91-
},
92-
info: function () {
93-
msg('info', arguments)
94-
},
95-
warn: function () {
96-
msg('warn', arguments)
97-
},
98-
error: function () {
99-
msg('error', arguments)
100-
}
101-
}
102-
console.log('Detected lack of console, overridden console')
103-
}
104-
105-
let promiseSupported = typeof Promise !== 'undefined'
106-
107-
// some engines report that Promise resolve isn't a function... what?...
108-
if (promiseSupported) {
109-
try {
110-
let res
111-
// eslint-disable-next-line no-new
112-
new Promise(resolve => { res = resolve })
113-
res()
114-
} catch (error) {
115-
promiseSupported = false
116-
}
117-
}
118-
119-
// very bad promise polyfill, it's absolutely minimal just to make emscripten work
120-
// in engines that don't have promises, Promise should never be used otherwise
121-
if (!promiseSupported) {
122-
// @ts-ignore
123-
self.Promise = function (cb) {
124-
let then = () => {}
125-
cb(a => setTimeout(() => then(a), 0))
126-
return { then: fn => then = fn }
127-
}
128-
}
129-
1303
const read_ = (url, ab) => {
1314
const xhr = new XMLHttpRequest()
1325
xhr.open('GET', url, false)
@@ -170,7 +43,7 @@ self.addFont = ({ font }) => asyncWrite(font)
17043
const findAvailableFonts = font => {
17144
font = font.trim().toLowerCase()
17245

173-
if (font.startsWith('@')) font = font.substring(1)
46+
if (font[0] === '@') font = font.substring(1)
17447

17548
if (fontMap_[font]) return
17649

0 commit comments

Comments
 (0)