Implement Gamepad API

This commit is contained in:
Imanol Fernandez 2017-03-29 15:41:40 +02:00
parent 69eda6a60c
commit 0158b5b2af
27 changed files with 1193 additions and 96 deletions

View file

@ -32,7 +32,9 @@ unsafe fn update_or_create_typed_array(cx: *mut JSContext,
match src {
Some(data) => {
if dst.get().is_null() {
let _ = Float32Array::create(cx, CreateWith::Slice(data), dst.handle_mut());
rooted!(in (cx) let mut array = ptr::null_mut());
let _ = Float32Array::create(cx, CreateWith::Slice(data), array.handle_mut());
(*dst).set(array.get());
} else {
typedarray!(in(cx) let array: Float32Array = dst.get());
if let Ok(mut array) = array {