Commit Graph

183 Commits

Author SHA1 Message Date
Andrew Chin
153acdb4fd Fix webaudio example
The rust set_* functions except numbers, not strings.
2019-01-28 23:54:40 -05:00
Alex Crichton
78c4075e40 Bump to 0.2.33 2019-01-18 15:32:17 -08:00
Alex Crichton
32c611d16d Convert all examples to using wasm-pack
This commit migrates all our examples to using `wasm-pack build` to
compile their code and run `wasm-bindgen`. This should make it a bit
easier to understand the examples as there's less to follow during the
build step.

Webpack projects are all using `@wasm-tool/wasm-pack-plugin` as well so
the build step is simple `npm run serve`. Other examples which retain
`build.sh` are just using `wasm-pack build` now
2019-01-17 08:37:32 -08:00
Nick Fitzgerald
31fdede9fc Bump to 0.2.32 2019-01-16 13:11:13 -08:00
Alex Crichton
b04f60cf2b Bump to 0.2.31 2019-01-09 09:17:50 -08:00
Alex Crichton
fbf000a508 Bump to 0.2.30 2019-01-07 07:47:07 -08:00
Alex Crichton
fcee465692 Add a comment about memory management 2018-12-19 12:00:42 -08:00
Roberto Vidal
08680276ae Fixes outdated links 2018-12-13 15:25:15 +01:00
LachezarLechev
f29f78e302 [examples] performance - remove one more unnecessary import 2018-12-12 08:16:36 +01:00
LachezarLechev
a211e4af9c [examples] performance - port to rust 2018 2018-12-12 08:14:08 +01:00
LachezarLechev
55f199ee77 [examples] paint - port to rust 2018 2018-12-12 08:12:51 +01:00
LachezarLechev
e1d11fda95 [examples] no_modules - port to rust 2018 2018-12-12 08:11:18 +01:00
LachezarLechev
dd82cd4722 [examples] julia_set - port to rust 2018 2018-12-12 08:10:02 +01:00
Alex Crichton
82b322a12f
Merge pull request from T5uku5hi/port-examples-to-rust-2018
Port dom, fetch, guide-supported-types-examples, import_js examples to Rust 2018 edition
2018-12-11 16:37:16 -06:00
T5uku5hi
b6db977795 removed extern crate lines 2018-12-12 07:14:26 +09:00
T5uku5hi
0003fc9115 remove unnecessary lines 2018-12-12 06:56:09 +09:00
André Luis Leal Cardoso Junior
9aa15bf600 Update wasm2js to rust 2018 2018-12-11 19:31:50 -02:00
André Luis Leal Cardoso Junior
bfcecb426e Update raytrace-parallel to rust 2018 2018-12-11 19:28:11 -02:00
T5uku5hi
7cf2942e25 [examples] import_js - port to rust 2018 2018-12-12 00:53:11 +09:00
T5uku5hi
56b3e0a318 run cargo fix --edition-idioms 2018-12-12 00:51:23 +09:00
T5uku5hi
48cc61147b [examples] guide-supported-types-examples - port to rust 2018 2018-12-12 00:50:41 +09:00
T5uku5hi
2d9dcf6ace run cargo fix --edition-idioms 2018-12-12 00:48:10 +09:00
T5uku5hi
f148164cd3 [examples] fetch - port to rust 2018 2018-12-12 00:47:22 +09:00
T5uku5hi
b2afc0e38a run cargo fix --edition-idioms 2018-12-12 00:40:00 +09:00
André Luis Leal Cardoso Junior
2c30818b7c Update todomvc example to the 2018 edition 2018-12-11 13:39:36 -02:00
T5uku5hi
493130ee36 [examples] dom - port to rust 2018 2018-12-12 00:39:22 +09:00
André Luis Leal Cardoso Junior
a8fb4c3bf8 Update wasm-in-wasm example to the 2018 edition 2018-12-11 13:36:24 -02:00
André Luis Leal Cardoso Junior
00d4c6b5a5 Update webaudio example to the 2018 edition 2018-12-11 13:36:08 -02:00
André Luis Leal Cardoso Junior
67c99a8b08 Update webgl example to the 2018 edition 2018-12-11 13:35:48 -02:00
Alex Crichton
639724a85e
Merge pull request from elpiel/port-examples-to-rust-2018
Port examples - console-log, closures and duck-typed-interfaces to Rust 2018
2018-12-11 08:53:35 -05:00
LachezarLechev
90ed520394 [examples] closure - remove unnecessary use statement 2018-12-11 14:50:27 +01:00
André Luis Leal Cardoso Junior
c6a9d4851a Remove extra web_sys call 2018-12-11 11:50:25 -02:00
André Luis Leal Cardoso Junior
ceb269b28a run cargo fix --edition-idioms 2018-12-11 08:53:21 -02:00
LachezarLechev
573c14118a [examples] duck-typed-interfaces - port to rust 2018 2018-12-11 08:45:26 +01:00
LachezarLechev
7107a896da [examples] closures - port to rust 2018 2018-12-11 08:39:49 +01:00
LachezarLechev
26737a2888 [examples] console_log - port to rust 2018 2018-12-11 08:37:53 +01:00
André Luis Leal Cardoso Junior
88c8b9059e Add edition 2018 to Cargo.toml 2018-12-10 23:44:59 -02:00
Nick Fitzgerald
77ddf5ebcd examples: Add a requestAnimationFrame loop example 2018-12-10 12:50:19 -08:00
Alex Crichton
63e3ba722d Bump to 0.2.29 2018-12-04 06:04:47 -08:00
Daniel Schindler
53c65039b9 Change module import 2018-12-03 11:37:30 +01:00
Daniel Schindler
a25925346a Add index.css to build 2018-12-02 21:22:37 +01:00
ibaryshnikov
2cdc45cef7 fixed link to compiled raytrace-parallel in examples 2018-11-30 23:36:27 +03:00
Daniel Schindler
caac2eba53 Add #[wasm_bindgen(start)], plugins to webpack config, Update deps 2018-11-30 17:42:36 +01:00
Alex Crichton
a2aa28e4d3 Add a #[wasm_bindgen(start)] attribute
This commit adds a new attribute to `#[wasm_bindgen]`: `start`. The
`start` attribute can be used to indicate that a function should be
executed when the module is loaded, configuring the `start` function of
the wasm executable. While this doesn't necessarily literally configure
the `start` section, it does its best!

Only one crate in a crate graph may indicate `#[wasm_bindgen(start)]`,
so it's not recommended to be used in libraries but only end-user
applications. Currently this still must be used with the `crate-type =
["cdylib"]` annotation in `Cargo.toml`.

The implementation here is somewhat tricky because of the circular
dependency between our generated JS and the wasm file that we emit. This
circular dependency makes running initialization routines (like the
`start` shim) particularly fraught with complications because one may
need to run before the other but bundlers may not necessarily respect
it. Workarounds have been implemented for various emission strategies,
for example calling the start function directly after exports are wired
up with `--no-modules` and otherwise working around what appears to be
a Webpack bug with initializers running in a different order than we'd
like. In any case, this in theory doesn't show up to the end user!

Closes 
2018-11-28 22:11:15 -08:00
Alex Crichton
48f4adfa8c Run rustfmt over everything 2018-11-27 12:07:59 -08:00
Alex Crichton
4a70198143
Merge pull request from jonathanKingston/todo-clean
Remove compiler warnings in todo example
2018-11-27 11:52:47 -06:00
ibaryshnikov
873898e6c0 updated no_modules example to show web-sys usage 2018-11-27 14:44:57 +01:00
Jonathan Kingston
d59716ba5b Remove compiler warnings in todo example, simplify usage of elements into element.rs and fix a bug with focus not working on edit. 2018-11-25 00:29:28 +00:00
Alex Crichton
22ca15f81e Bump to 0.2.28 2018-11-12 09:28:01 -08:00
Alex Crichton
5b76a6291e Implement Deref for all imported JS types
This commit implements the first half of [RFC ] where the `Deref`
trait is implemented for all imported types. The target of `Deref` is
either the first entry of the list of `extends` attribute or `JsValue`.

All examples using `.as_ref()` with various `web-sys` types have been
updated to the more ergonomic deref casts now. Additionally the
`web-sys` generation of the `extends` array has been fixed slightly to
explicitly list implementatoins in the hierarchy order to ensure the
correct target for `Deref` is chosen.

[RFC ]: https://github.com/rustwasm/rfcs/blob/master/text/005-structural-and-deref.md
2018-11-08 11:01:34 -08:00