Commit Graph

1815 Commits

Author SHA1 Message Date
Alex Crichton
e5af22ee4e
Merge pull request #814 from brisad/object-define-property
Add binding for Object.defineProperty()
2018-09-12 09:13:03 -07:00
Michael Hoffmann
fe6ad5447e Add binding for Object.defineProperty() 2018-09-12 07:39:39 +02:00
Nick Fitzgerald
1872e84a8a guide: Add section on working with duck-typed interfaces 2018-09-11 16:40:32 -07:00
Nick Fitzgerald
a311c29f1d examples: Add an example of using duck-typed interfaces 2018-09-11 16:29:25 -07:00
Alex Crichton
9ca024a812
Merge pull request #792 from afdw/master
Add support for variadic arguments in WebIDL
2018-09-11 16:05:56 -07:00
Alex Crichton
89989b5973
Merge pull request #812 from fitzgen/guide-untyped-properties
guide: Add section on accessing properties of untyped values
2018-09-11 15:55:11 -07:00
Nick Fitzgerald
27a7008764 guide: Add section on accessing properties of untyped values
Part of #616
2018-09-11 15:26:51 -07:00
Anton Danilkin
096848199e Introduce a constant 2018-09-11 23:10:03 +03:00
Alex Crichton
1d2d397f55
Merge pull request #808 from fitzgen/web-sys-in-the-guide
web-sys gets its own section in the guide
2018-09-11 10:08:06 -07:00
Nick Fitzgerald
3f92607be2
Merge pull request #810 from Tarnadas/doc/js-sys-function
doc: Add number suffix hint for JS function calls
2018-09-11 10:04:20 -07:00
Nick Fitzgerald
8124cffeba
Merge pull request #809 from Tarnadas/master
doc: Add nightly feature hint for closures
2018-09-11 10:02:53 -07:00
Laurentiu Nicola
89005f3469 Examples: use html-webpack-plugin 2018-09-11 08:42:22 +03:00
Mario Reder
84a477d78d doc: Add number suffix hint for JS function calls 2018-09-11 07:25:08 +02:00
Mario Reder
e6fe9cf353 doc: Add nightly feature hint for closures
resolves #767
2018-09-11 07:06:21 +02:00
Laurentiu Nicola
8ffa24bfe5 Guide: explain how to deploy the application 2018-09-11 07:33:24 +03:00
Nick Fitzgerald
f6b199cfb0 web-sys: Crate metadata should point to the web-sys section of the wasm-bindgen guide 2018-09-10 17:56:03 -07:00
Nick Fitzgerald
86796f8a03 guide: Add a user-facing web-sys section 2018-09-10 17:51:44 -07:00
Nick Fitzgerald
723ed6e856 examples(fetch): Tidy up the fetch example 2018-09-10 17:50:55 -07:00
Nick Fitzgerald
42ea38187f examples(webaudio): Tidy up the webaudio example 2018-09-10 17:50:34 -07:00
Nick Fitzgerald
e730ee9a62 guide: update publishing new releases page 2018-09-10 15:37:12 -07:00
Nick Fitzgerald
1a39e4e737 guide: Fix nesting of contributing pages 2018-09-10 15:32:39 -07:00
Anton Danilkin
9f4ed536df Use js_sys::Array, generate _n methods for ergonomics 2018-09-11 00:37:59 +03:00
Alex Crichton
9147e3211e
Merge pull request #805 from alexcrichton/callback-interfaces
Implement WebIDL callback interfaces
2018-09-10 12:48:24 -07:00
Alex Crichton
8181f7fa95 Implement WebIDL callback interfaces
This commit implements callback interfaces for WebIDL, the final WebIDL
construct that we were unconditionally ignoring! Callback interfaces are
implemented as dictionaries of callbacks. Single-operation callback interfaces
are also expanded when flattening to accept a `Function` as well, in accordance
with the WebIDL spec.

New features have been added to `web-sys` for all the new callback interface
types. Additionally the `EventTarget.webidl` was tweaked to not have
`EventListener?` as this is required for all functional usage and there's no
need to keep that sort of web browser compat here.

Closes #258
2018-09-10 12:00:50 -07:00
Alex Crichton
2cf82bc0b3
Merge pull request #803 from alexcrichton/fix-required
Change how filtering is done in WebIDL
2018-09-10 11:59:36 -07:00
Alex Crichton
116a19962f Change how filtering is done in WebIDL
Instead of actually modifying the `FirstPassRecord` let's instead just skip
relevant entries when we come across them. This should help us retain knowledge
that `optional SomeImportedType arg` can be bound even though `SomeImportedType`
may not exist.

One small tweak was needed to modify the AST afterwards to remove `extends`
annotations which aren't actually defined, but other than that this should...

Closes #802
2018-09-10 11:58:31 -07:00
Alex Crichton
be4ead7c8a
Merge pull request #797 from alexcrichton/iterator
Implement the `Iterator` trait for JS iterators
2018-09-10 11:40:56 -07:00
Alex Crichton
1565951a0b
Merge pull request #804 from alexcrichton/bigint
Expand LongLong to `(i32 or f64)` instead of `i64`
2018-09-10 11:40:35 -07:00
Alex Crichton
b7d7d28418 Expand LongLong to (i32 or f64) instead of i64
This commit tweaks WebIDL expansion of the "long long" and "unsigned long long"
types to expand to a union of an 32-bit integer and a double. This reflects how
almost none of the APIs on the web today actually work with a `BigInt` (what the
previous Rust type of `i64` translates to) and how JS itself fundamentally
operates with these APIs.

Eventually this may not be necessary if we can natively connect to C++ engines
with the `i64` type, but until that day comes this should provide more useful
interfaces as they shoudl work in all browsers.

Closes #800
2018-09-10 11:40:20 -07:00
Alex Crichton
f2608d3155 Implement the Iterator trait for JS iterators
This commit implements the standard library's `Iterator` trait for the
`js_sys::Iterator` type, using the iterator protocol described on [MDN]

Closes #777

[MDN]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
2018-09-10 10:38:04 -07:00
Anton Danilkin
14eb317509 Merge remote-tracking branch 'upstream/master' 2018-09-07 13:46:20 +03:00
Alex Crichton
f18b10ca52 Bump to 0.2.21 2018-09-06 22:10:11 -07:00
Alex Crichton
e632dd3fda Parse names before we take the module
Otherwise when we try to parse the names there's no module with contents!
2018-09-06 22:08:04 -07:00
Alex Crichton
fcfc3e32fe
Merge pull request #796 from alexcrichton/callback-types
Implement support for WebIDL `Callback` types
2018-09-06 19:51:18 -07:00
Alex Crichton
457efc0f31 Implement support for WebIDL Callback types
This commit adds support for the WebIDL `Callback` type by translating all
callbacks to the `js_sys::Function` type. This will enable passing raw JS values
into callbacks as well as Rust valus using the `Closure` type.

This commit doesn't currently implement "callback interfaces" in WebIDL, that's
left for a follow-up commit.
2018-09-06 19:50:46 -07:00
Alex Crichton
1cd2229c66
Merge pull request #795 from fitzgen/lots-more-js-sys-bindings
Lots more js-sys bindings
2018-09-06 16:42:18 -07:00
Alex Crichton
d279fe81e7 Try to fix AppVeyor 2018-09-06 16:22:19 -07:00
Alex Crichton
b2afe15c66
Merge pull request #794 from alexcrichton/syn-next
Update syn to 0.15
2018-09-06 15:39:00 -07:00
Alex Crichton
6e319509e5 Don't test all web-sys features on Windows
Unfortunately this blows the command line limit and will fail CI
2018-09-06 15:07:04 -07:00
Nick Fitzgerald
bfff31fcb9 js-sys: Expose bindings to WebAssembly.Table.prototype.set
Part of #275
2018-09-06 15:02:01 -07:00
Alex Crichton
8f9514d216 Update syn to 0.15
New and faster parsers!
2018-09-06 15:01:24 -07:00
Nick Fitzgerald
8dbb0fc5f2 js-sys: Expose bindings to WebAssembly.Table.prototype.grow
Par of #275
2018-09-06 14:58:46 -07:00
Nick Fitzgerald
2d4f36c9da js-sys: Add bindings to WebAssembly.Table.prototype.get
Part of #275
2018-09-06 14:54:49 -07:00
Alex Crichton
e67397ec27
Merge pull request #793 from alexcrichton/bump
Bump to 0.2.20
2018-09-06 14:49:54 -07:00
Alex Crichton
9d5898ab48 Bump to 0.2.20 2018-09-06 14:49:43 -07:00
Alex Crichton
630ac1c169
Merge pull request #791 from alexcrichton/closure-jsval
Implement `AsRef<JsValue> for Closure<T>`
2018-09-06 14:49:03 -07:00
Nick Fitzgerald
fb5e6e9c06 js-sys: Add bindings for WebAssembly.instantiateStreaming
Part of #275
2018-09-06 14:47:37 -07:00
Alex Crichton
5a3cd893e0 Implement AsRef<JsValue> for Closure<T>
This commit adds an implementation of `AsRef<JsValue>` for the `Closure<T>`
type. Previously this was not possible because the `JsValue` didn't actually
exist until the closure was passed to JS, but the implementation has been
changed to ... something a bit more unconventional. The end result, however, is
that `Closure<T>` now always contains a `JsValue`.

The end result of this work is intended to be a precursor to binding callbacks
in `web-sys` as `JsValue` everywhere but still allowing usage with `Closure<T>`.
2018-09-06 14:46:59 -07:00
Nick Fitzgerald
021cbbab71 js-sys: Add bindings for WebAssembly.instantiate
Part of #275
2018-09-06 14:35:45 -07:00
Nick Fitzgerald
8b5f5a7560 js-sys: Add exports getter to WebAssembly.Instance
Part of #275
2018-09-06 14:16:28 -07:00