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 (instance === undefined) { |
| 9 postMessage("error!"); |
| 10 return; |
| 11 } |
| 12 var entrypoint = instance.exports["increment"]; |
| 13 |
| 14 if (typeof entrypoint !== "function") { |
| 15 postMessage("error!"); |
| 16 return; |
| 17 } |
| 18 |
| 19 var ret = entrypoint(42); |
| 20 postMessage(ret); |
| 21 } |
OLD | NEW |