mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-05-05 10:32:16 +00:00
* Tweak the implementation of heap closures This commit updates the implementation of the `Closure` type to internally store an `Rc` and be suitable for dropping a `Closure` during the execution of the closure. This is currently needed for promises but may be generally useful as well! * Support asynchronous tests This commit adds support for executing tests asynchronously. This is modeled by tests returning a `Future` instead of simply executing inline, and is signified with `#[wasm_bindgen_test(async)]`. Support for this is added through a new `wasm-bindgen-futures` crate which is a binding between the `futures` crate and JS `Promise` objects. Lots more details can be found in the details of the commit, but one of the end results is that the `web-sys` tests are now entirely contained in the same test suite and don't need `npm install` to be run to execute them! * Review tweaks * Add some bindings for `Function.call` to `js_sys` Name them `call0`, `call1`, `call2`, ... for the number of arguments being passed. * Use oneshots channels with `JsFuture` It did indeed clean up the implementation!
28 lines
821 B
HTML
28 lines
821 B
HTML
<html>
|
|
<head>
|
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
|
|
</head>
|
|
<body>
|
|
<pre id='output'>Loading scripts...</pre>
|
|
<script>
|
|
const orig_console_log = console.log;
|
|
const orig_console_error = console.error;
|
|
console.log = function() {
|
|
if (window.console_log_redirect)
|
|
window.console_log_redirect(orig_console_log, arguments);
|
|
else
|
|
orig_console_log.apply(this, arguments);
|
|
};
|
|
console.error = function() {
|
|
if (window.console_error_redirect)
|
|
window.console_error_redirect(orig_console_error, arguments);
|
|
else
|
|
orig_console_error.apply(this, arguments);
|
|
};
|
|
|
|
window.__wbg_test_invoke = f => f();
|
|
</script>
|
|
<script src='run.js' type=module></script>
|
|
</body>
|
|
</html>
|