Ingvar Stepanyan
db17e9d2a7
Add constructor
property to Object
2019-03-27 14:25:55 +00:00
Alex Crichton
a6fe0cefa8
Migrate all crates to the 2018 edition
...
Most of the CLI crates were already in the 2018 edition, and it turns
out that one of the macro crates was already in the 2018 edition so we
may as well move everything to the 2018 edition!
Always nice to remove those `extern crate` statements nowadays!
This commit also does a `cargo fmt --all` to make sure we're conforming
with style again.
2019-03-26 08:10:53 -07:00
Ingvar Stepanyan
11bb8f03c2
Remove string allocation from try_iter
...
This allows to significantly speed up iteration over small collections, where string encoding is the primary overhead.
Related to #1386 , but works around only this partial case.
2019-03-26 12:22:54 +00:00
Alex Crichton
d49d8c9e1b
Merge pull request #1372 from RReverser/fix-dataview-docs
...
Fix docs for DataView::get*int32*
2019-03-20 13:47:10 -05:00
Ingvar Stepanyan
4e806bab70
Fix docs for DataView::get*int32*
2019-03-20 18:32:34 +00:00
Ingvar Stepanyan
c5260f29aa
Merge TypedArray definitions into a macro
2019-03-20 17:25:35 +00:00
ibaryshnikov
fa0a3610af
issue-1317-typed-array-typo-fixed
2019-03-06 22:12:48 +03:00
Alex Crichton
c49b87b2d8
Merge pull request #1225 from Pauan/get_index
...
Adding in Reflect::get_f64, Reflect::get_u32, Reflect::set_f64, and Reflect::set_u32
2019-02-13 13:10:40 -06:00
Nick Fitzgerald
c8ad85dd0b
Use unwrap_throw
instead of normal unwrap
for JsString -> String conversion
...
Should have less code size.
2019-02-10 13:59:39 -05:00
Pauan
8b6e951e34
Adding in Reflect::get_f64, Reflect::get_u32, Reflect::set_f64, and Reflect::set_u32
2019-02-04 01:32:43 +01:00
Henry
2a6d2004e1
minor typo in js-sys lib.rs
2019-01-24 15:35:21 -08:00
Liam Curry
6226e6959f
js-sys: JSON::stringify_with_replacer[_and_space]
...
This commit adds two new externs for `JSON.stringify`:
`JSON::stringify_with_replacer` and
`JSON::stringify_with_replacer_and_space`.
Fixes #1186
2019-01-16 18:03:03 -05:00
Alex Crichton
f404182c47
Fix a typo
2019-01-07 11:00:15 -08:00
Alex Crichton
2d7f601696
Add conversions between typed arrays and Rust
...
For all typed arrays, this commit adds:
* `TypedArray::view(src: &[Type])`
* `TypedArray::copy_to(&self, dst: &mut [Type])`
The `view` function is unsafe because it doesn't provide any guarantees
about lifetimes or mutability. The `copy_to` function is, however, safe.
Closes #811
2019-01-04 10:42:14 -08:00
Daniel Barney
3858fe773f
fixing a small spelling error
...
I realize that this is just fixing spelling on some comments and a fairly minor correction at that.
2018-12-29 22:26:51 -07:00
Alex Crichton
9effb7c707
Bind more Typed Array constructors in js-sys
...
Bind `new Int8Array(length)`, `new Int8Array(buffer, offset)` and `new
Int8Array(buffer, offset, length)`.
2018-10-16 11:16:22 -07:00
Joni Katajamäki
83f9f54b04
Fix getFloat64 comments
2018-10-15 16:24:49 +03:00
Joni Katajamäki
968b5e0154
Add overloads with endianness parameter to DataView gets and sets
2018-10-15 14:32:17 +03:00
Alex Crichton
41d3a08028
Merge pull request #958 from alexcrichton/no-global-cache
...
js_sys: Use a thread local to cache `global()`
2018-10-10 17:41:41 -07:00
Alex Crichton
e0b73abc7e
Merge pull request #957 from alexcrichton/promise-clone
...
js_sys: Add `#[derive(Clone, Debug)]` to `Promise`
2018-10-10 16:52:57 -07:00
Alex Crichton
105a6bc853
js_sys: Use a thread local to cache global()
...
When we add threads it's not actually valid to have a global cache as
the index is only valid on one thread! Instead let's use a per-thread
cache using `thread_local!` which compiles to basically the same code as
before for single-threaded wasm.
2018-10-10 16:01:32 -07:00
Alex Crichton
e9fa209dcf
js_sys: Add #[derive(Clone, Debug)]
to Promise
...
I think we just forgot this from earlier!
2018-10-10 15:58:47 -07:00
Alex Crichton
f9d2dbd0b6
js-sys: Add bindings for TypedArray.slice
...
This commit adds support for the `slice` function on all `TypedArray`
instances. The `slice` function is similar to `subarray` except that it
actually copies the data, whereas `subarray` just returns a different
view into data.
2018-10-10 15:57:00 -07:00
Nick Fitzgerald
7db28b4548
js-sys: run rustfmt
2018-09-25 14:30:26 -07:00
Nick Fitzgerald
f9cd329b14
js-sys: Add js_sys::try_iter
for iterating over any JsValue
...
Fixes #776
2018-09-25 14:30:26 -07:00
Nick Fitzgerald
e3d2ea2628
js-sys: Catch exceptions thrown in Reflect APIs
...
Proxies passed to Reflect APIs can throw for any of these operations and it is a
bit of a mess.
2018-09-25 14:30:26 -07:00
Nick Fitzgerald
6edb871c36
js-sy: Add a doc comment for js_sys::IntoIter
2018-09-25 11:21:56 -07:00
Nick Fitzgerald
dc22965e71
js-sys: Add doc comment for js_sys::Iter
2018-09-25 11:21:56 -07:00
Alex Crichton
3efe51eb8b
Reorganize and rewrite examples
...
This commit is a large-ish scale reorganization of our examples. The
main goal here is to have a dedicated section of the guide for example,
and all examples will be listed there. Each example's `README` is now
just boilerplate pointing at the guide along with a blurb about how to
run it.
Some examples like `math` and `smorgasboard` have been deleted as they
didn't really serve much purpose, and others like `closures` have been
rewritten with `web-sys` instead of hand-bound bindings.
Overall it's hoped that this puts us in a good and consistent state for
our examples, with all of them being described in the guide, excerpts
are in the guide, and they're all relatively idiomatically using
`web-sys`.
2018-09-20 16:45:30 -07:00
Anton Danilkin
f808594efa
Add String.raw
2018-09-20 00:40:14 +03:00
Michael Hoffmann
f7b511588b
Add binding for Object.entries()
2018-09-19 21:32:05 +02:00
Michael Hoffmann
326e4c0262
Add binding for Object.getPrototypeOf()
2018-09-19 21:10:40 +02:00
Michael Hoffmann
76969bd1e3
Add binding for Object.getOwnPropertySymbols()
2018-09-19 20:58:46 +02:00
Michael Hoffmann
4e18493fd7
Add binding for Object.getOwnPropertyNames()
2018-09-19 20:43:50 +02:00
Alex Crichton
a83d561bb3
Add js_sys::global
2018-09-18 15:40:49 -07:00
Michael Hoffmann
2d91fa11b5
Add binding for Object.getOwnPropertyDescriptors()
2018-09-16 23:02:46 +02:00
Michael Hoffmann
b005e96fd9
Add binding for Object.getOwnPropertyDescriptor()
2018-09-16 22:55:15 +02:00
Michael Hoffmann
191e7dc1fb
Add binding for Object.defineProperties()
2018-09-15 22:30:27 +02:00
Michael Hoffmann
fe6ad5447e
Add binding for Object.defineProperty()
2018-09-12 07:39:39 +02: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
Nick Fitzgerald
bfff31fcb9
js-sys: Expose bindings to WebAssembly.Table.prototype.set
...
Part of #275
2018-09-06 15:02:01 -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
Nick Fitzgerald
fb5e6e9c06
js-sys: Add bindings for WebAssembly.instantiateStreaming
...
Part of #275
2018-09-06 14:47:37 -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
Nick Fitzgerald
cb2aa999c0
js-sys: Define imports for WebAssembly.Instance
and its constructor
...
Part of #670 and #275
2018-09-06 14:16:18 -07:00
Nick Fitzgerald
66d155d708
js-sys: Add extends
to Reflect
...
Part of #670
2018-09-06 13:42:16 -07:00
Nick Fitzgerald
bfff8661c1
js-sys: Add extends
to Math
...
Part of #670
2018-09-06 13:39:30 -07:00
Nick Fitzgerald
5df2347a7a
js-sys: Add extends
to JSON
...
Part of #670
2018-09-06 13:32:31 -07:00