add binding for indexOf

This commit is contained in:
Matt Long
2018-06-20 17:16:57 -04:00
parent 289f2a88cf
commit 4a96ba3c72
3 changed files with 54 additions and 0 deletions

View File

@ -94,3 +94,15 @@ extern {
}
// Array
#[wasm_bindgen]
extern {
pub type Array;
/// The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
///
/// http://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
#[wasm_bindgen(method, js_name = indexOf)]
pub fn index_of(this: &Array, value: JsValue, from_index: i32) -> i32;
}