-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworker.js
More file actions
52 lines (41 loc) · 1.29 KB
/
worker.js
File metadata and controls
52 lines (41 loc) · 1.29 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
importScripts('./await-async.js')
importScripts('./rpc.js')
importScripts('./dom-proxy.js')
let ia32
let host
let window
let document
self.addEventListener('message', event => {
var data = event.data
if (data.command === 'init') {
ia32 = data.ia32
const proxy = DomProxy.create(ia32, () => self)
current = proxy.current
window = proxy.getRemote(data.host)
document = window.document
self.test = '1'
console.log(window.location.href)
console.log(window.document.title)
console.log(window.document === window.document)
window.run = function () {
window.alert('how the fuck?')
var el = document.createElement("div")
el.textContent = "click me"
console.log('break')
el.addEventListener('click', () => {
window.alert('callback in worker')
})
document.body.appendChild(el)
// In worker 0
self.callbackFromWorker1()
console.log(document.body.innerHTML)
console.log('yep')
console.log(Object.keys(window))
console.log(Object.keys(document))
}
self.postMessage({
command: 'ready',
current
})
}
})