Andrew Chin
2c72eabea1
Make the list of examples alphabetical, and add webaudio and fetch examples
2018-08-19 18:41:02 -04:00
Andrew Chin
9d7c0af08f
Initial example for the Fetch API
2018-08-19 18:41:02 -04:00
Alex Crichton
4c1bf937f2
Move the unsize
feature behind a nightly
Cargo feature
...
This should fully stabilize the `wasm-bindgen` crate, preparing us for stable
Rust!
2018-08-19 14:45:59 -07:00
Alex Crichton
305ecb7910
Remove nll
feature from webaudio
example
2018-08-19 14:42:25 -07:00
Alex Crichton
d4297ad2d3
Remove use_extern_macros
features
...
This has now been stabilized!
2018-08-19 14:33:01 -07:00
Andrew Chin
4a994da904
Show how to use web-sys::console::log from the console_log example
2018-08-17 22:54:59 -04:00
Andrew Chin
4f18e21659
Initial example of using the WebAudio APIs from web-sys
...
Part of #443
2018-08-17 07:02:48 -04:00
Nick Fitzgerald
34363aff12
example: Add an example of drawing a smiley face with canvas
...
Adapted from https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_shapes
2018-08-15 17:40:39 -07:00
Nick Fitzgerald
b1e3101fd4
guide: Add examples for number slices
2018-08-14 17:42:47 -07:00
Nick Fitzgerald
fea41b4a87
guide: also allow Option<bool>
2018-08-14 17:34:16 -07:00
Nick Fitzgerald
9c9e53485a
guide: Add examples of boxed number slices
2018-08-14 17:15:01 -07:00
Nick Fitzgerald
8043baac69
guide: Add examples for working with numbers to types section
2018-08-14 15:45:25 -07:00
Nick Fitzgerald
602b63c1b0
guide: Add working with pointers example to types section
2018-08-14 15:24:43 -07:00
Nick Fitzgerald
d1b2299340
guide: Add Box<[JsValue]>
example to supported types section
2018-08-13 17:08:18 -07:00
Nick Fitzgerald
60307e81f9
guide: Add JsValue
example to supported types section
2018-08-13 16:57:29 -07:00
Nick Fitzgerald
fedd1a5440
guide: Add bool
example to supported types section
2018-08-13 16:55:05 -07:00
Nick Fitzgerald
975a122d6d
guide: Add a char
example to the supported types section
2018-08-13 16:24:39 -07:00
Nick Fitzgerald
74dc8874e1
guide: add String
example usage to supported types
2018-08-13 16:20:25 -07:00
Nick Fitzgerald
fa72afe286
guide: Add str
examples to supported types section
2018-08-13 16:12:58 -07:00
Nick Fitzgerald
8e19645006
guide: Add exported rust type examples to reference
2018-08-13 16:03:02 -07:00
Nick Fitzgerald
e87498e939
guide: Start adding example usage to "supported types" section
2018-08-10 16:56:40 -07:00
Nick Fitzgerald
64591ef403
Js sys use &str arguments ( #555 )
...
* js-sys: imports should take &str parameters instead of &JsString
* js-sys: Imports should take Option<&str> instead of Option<String>
2018-07-25 18:50:30 -05:00
Nick Fitzgerald
61fc8d2567
Js sys once over ( #550 )
...
* js-sys: Return `f64` instead of `Number`
* js-sys: remove trailing whitespace
* js-sys: Ensure that all imported types derive Clone and Debug
* js-sys: Imported functions should always take JS object arguments by-ref
2018-07-25 16:33:44 -05:00
Alex Crichton
906cd7adcc
Remove usage of wasm_import_module
feature
...
This is now stabilized! Also tweak usage of it to the stable version.
2018-07-21 19:00:40 -07:00
Alex Crichton
13cee9e264
Fix closures example
2018-07-20 12:09:30 -07:00
Alex Crichton
6eef5f7b52
Move the js
module to a js_sys
crate ( #512 )
...
* Move the `js` module to a `js_sys` crate
* Update js-sys tests to pass again
* Update binding_to_unimplemented_apis_doesnt_break_everything
Remove its dependency on the `js` module
* Update metadata for js-sys
* Fix the `closures` example
2018-07-19 14:30:58 -05:00
Alex Crichton
a949482e3a
Remove usage of #[wasm_custom_section] ( #509 )
...
This has been stabilized on nightly as `#[link_section]`, so no need for an
unstable attribute any more. Yay!
2018-07-19 08:57:18 -05:00
Alex Crichton
ed05c7b945
Fix compile on latest nightly ( #489 )
2018-07-17 09:11:30 -05:00
Richard Dodd (dodj)
07d16ec892
fix link
2018-07-15 18:33:28 +00:00
Marcin Baraniecki
a5b8c45d28
adds julia set example ( #419 )
...
* adds julia set example
* fixes indentation in *.js files
* fixes *.js formatting
* fixes a typo in function arguments signature
2018-07-08 10:57:19 -05:00
Frank Hassanabad
6561fba947
Applied eslint from main .eslintrc to examples ( #418 )
...
* Changed eslintrc to be JSON file (Most projects use JSON version)
* Added .eslintignore to ingore node_modules from subdirectories such as examples
* Ran eslint --fix examples to fix all examples
* Added npm script for running eslint against examples
* Added npm script for running eslint against generated *out* code
* Hooked npm scripts into travis ci to prevent examples from becoming inconsistent with future PR's
2018-07-08 01:02:10 -05:00
limira
04e29db588
Correct link to WebIDL issue ( #402 )
2018-07-06 11:09:48 -05:00
konstin
66096804ce
Fix the constructor explanation in the guide ( #372 )
2018-07-03 09:24:43 -05:00
R. Andrew Ohana
9127a0419f
rustfmt all the things
2018-06-27 22:42:34 -07:00
Sendil Kumar
ef27cb6392
Add date constructor
2018-06-26 16:55:40 +02:00
Robert Masen
19d6cf1488
Copy doc comments from Rust to JS ( #265 )
...
* backend comments complete
* better matching
* gen comments
* Add example
* Move test bindings gen to own fn
* move build step into build fn
* add fn to read js, refactor gen_bindings/test to allow for this
* Add comments test
* Update readmes
* add comments to travis
* fix broken tests
* +x on build.sh
* fix wbg cmd in build.sh
* Address fitzgen's comments
2018-06-15 09:20:56 -07:00
Sven SAULEAU
b67df02d01
feat: bump webpack
2018-06-06 10:07:02 +02:00
Alex Crichton
151acf8eb3
Add an example of importing non-browser functions
...
Closes #208
2018-05-23 12:14:12 -07:00
Robert Masen
4ddd93d75d
add char support ( #206 )
...
* add char support
* add char test
* remove __wbindgen_char fns
* re-order travis script
* update serve script
* remove binds to unused char functions
* add more wide character items to chars list
* remove unused code
* add char to readme
* remove built file
2018-05-22 12:34:41 -05:00
Sven SAULEAU
fe60d48825
fix: bump webpack
2018-05-08 19:35:58 +02:00
Alex Crichton
d04f8c7119
No more need for chrome workarounds!
2018-05-07 07:36:38 -07:00
Alex Crichton
dadcff15ef
Add an example of wasm2asm
and wasm-bindgen
...
This commit adds an example of executing the `wasm2asm` tool to generate asm.js
output instead of WebAssembly. This is often useful when supporting older
browsers, such as IE 11, that doesn't have native support for WebAssembly.
2018-04-30 13:29:34 -07:00
robert masen
6a6be7ef88
update comment to be more descriptive
2018-04-23 11:32:57 -05:00
robert masen
79a49b2a56
update fetch to take a string parameter
2018-04-23 09:04:30 -05:00
Robert Masen
cbccd2028d
include fetch arg for wasm2es6js
2018-04-23 08:41:02 -05:00
Alex Crichton
947386ee57
Add an example of a minimal wasm module
2018-04-20 22:38:22 -07:00
Alex Crichton
574e54a89d
Add an example of --no-modules
in action
2018-04-19 07:21:09 -07:00
Danielle Pham
a01c5ce9f1
WebAssemblyly => WebAssembly
2018-04-17 19:25:55 -04:00
Alex Crichton
158b95c29b
Add WebAssembly Studio links to examples/README
...
Should hopefully make it much easier to get off the ground running and
exploring!
2018-04-17 13:51:01 -07:00
Alex Crichton
a558fa49a0
Fix closures example build script
2018-04-09 15:02:20 -07:00
Alex Crichton
a3e5485b86
Add examples/documentation for closures
2018-04-09 14:34:21 -07:00
Alex Crichton
f60b5d9968
Typo!
2018-04-03 08:43:51 -07:00
Alex Crichton
6811059935
Add a link to Webpack's fix
2018-04-03 08:21:56 -07:00
Alex Crichton
30b1964255
Bump all crates to 0.2
2018-04-03 07:10:07 -07:00
Alex Crichton
64dc1e8b45
Fix compilation of examples on Travis
2018-03-29 08:59:08 -07:00
Alex Crichton
02b7021053
Leverage new rustc wasm features
...
This commit leverages two new attributes in the Rust compiler,
`#[wasm_custom_section]` and `#[wasm_import_module]`. These two attributes allow
removing a lot of hacks found in wasm-bindgen and also allows removing the
requirement of `wasm-opt` to remove the unused data sections.
This does require two new nightly features but we already required the
`proc_macro` nightly feature and these will hopefully be stabilized before that
feature!
2018-03-24 10:36:19 -07:00
Alex Crichton
dd83e54b67
Fix build script of wasm-in-wasm
2018-03-22 21:15:21 -07:00
Alex Crichton
7ebc428646
Implement a js_name
customization
...
This'll allow binding multiple signatures of a JS function as well as otherwise
changing the name of the JS function you're calling from the Rust function that
you're defining.
Closes #72
2018-03-22 19:05:14 -07:00
Alex Crichton
a8045fbbe9
Use custom setter string in dom
example
...
That way we can stick with idiomatic Rust!
2018-03-22 18:24:57 -07:00
Alex Crichton
4716752991
Add an example of namespaced APIs
...
By creating wasm modules from Rust!
2018-03-22 17:39:48 -07:00
Alex Crichton
0e1fee5ddd
Rename namespace
to js_namespace
...
Along the way remove the namespace in Rust as this ended up causing too many
problems, alas! The `js_namespace` attribute now almost exclusively modifies the
JS bindings, hence the "js" in the name now.
2018-03-22 17:03:51 -07:00
Alex Crichton
b00f8c5a28
Add an example of the performance
API
2018-03-21 10:21:21 -07:00
Alex Crichton
758bb3c2c3
Add an example using Math
2018-03-21 10:03:40 -07:00
Alex Crichton
4a4f8b18b6
Rename static
to namespace
...
This commit renames the `static` attribute to `namespace` and simultaneously
reduces and expands the scope. The `namespace` attribute can now be applied to
all imports in addition to functions, and it no longer recognizes full typed
paths but rather just a bare identifier. The `namespace` attribute will generate
a Rust namespace to invoke the item through if one doesn't already exist (aka
bindign a type).
2018-03-21 09:55:16 -07:00
Alex Crichton
dd054fa357
Add an example of DOM access
2018-03-21 08:26:00 -07:00
Alex Crichton
d8e5930799
Add an example of console.log
...
Also clean up some other exampels
2018-03-09 10:25:48 -08:00
Sendil Kumar
d5ac523fe2
feat: rename generated file to have bg instead of wasm
2018-03-05 22:25:14 +01:00
Alex Crichton
644e96cd46
Tweak layout for Chrome
2018-03-05 02:51:10 -08:00
Sophie Alpert
67411f519c
Add workaround for hello_world running in Chrome
...
Fixes #50 .
2018-03-03 10:46:43 -08:00
Alex Crichton
98b9bee876
Add some comments to the hello-world example
2018-03-02 20:32:48 -08:00
Alex Crichton
4ebb3df330
Add a smorgasboard example
2018-03-02 20:19:39 -08:00
Alex Crichton
4aa6793b9e
Rewrite the README using Webpack
...
Right now Webpack probably has the most mature support for loading wasm modules,
so let's show off how to do that! Additionally this commits hello world as an
example to the repository.
2018-03-02 20:12:00 -08:00