OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 onmessage = function(e) { | |
6 var compiled_module = e.data; | |
7 var instance = new WebAssembly.Instance(compiled_module); | |
8 if (typeof instance === "undefined") { | |
jsbell
2016/08/18 16:48:02
nit: why not just `instance === undefined` ?
Mircea Trofin
2016/08/18 17:34:08
Acknowledged.
Mircea Trofin
2016/08/18 23:02:59
Done.
| |
9 postMessage("error!"); | |
10 return; | |
11 } | |
12 var entrypoint = instance.exports["increment"]; | |
13 | |
14 if (typeof entrypoint != "function") { | |
jsbell
2016/08/18 16:48:02
nit: might as well be consistent and use !==
Mircea Trofin
2016/08/18 17:34:08
Acknowledged.
Mircea Trofin
2016/08/18 23:02:59
Done.
| |
15 postMessage("error!"); | |
16 return; | |
17 } | |
18 | |
19 var ret = entrypoint(42); | |
20 if (ret != 43) { | |
21 postMessage("didn't get 43"); | |
jsbell
2016/08/18 16:48:02
Do you want a return after this postMessage too, s
Mircea Trofin
2016/08/18 17:34:08
Acknowledged.
Mircea Trofin
2016/08/18 23:02:59
Actually, don't need to post that string, can just
| |
22 } | |
23 postMessage(ret); | |
24 } | |
OLD | NEW |