chrome 69 support

This commit is contained in:
Toshit Chawda 2024-09-07 11:42:11 -07:00
parent cc21e6c4a2
commit 07a304e9c6
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
4 changed files with 16 additions and 9 deletions

View file

@ -339,6 +339,12 @@ export function ws_key() {
crypto.getRandomValues(key);
return btoa(Array.from(key).map(String.fromCharCode).join(''));
}
export function from_entries(entries){
var ret = {};
for(var i = 0; i < entries.length; i++) ret[entries[i][0]] = entries[i][1];
return ret;
}
"#)]
extern "C" {
pub fn object_get(obj: &Object, key: &str) -> JsValue;
@ -350,6 +356,9 @@ extern "C" {
fn entries_of_object_inner(obj: &Object) -> Vec<Array>;
pub fn define_property(obj: &Object, key: &str, val: JsValue);
pub fn ws_key() -> String;
#[wasm_bindgen(catch)]
pub fn from_entries(iterable: &JsValue) -> Result<Object, JsValue>;
}
pub async fn convert_body(val: JsValue) -> Result<(Uint8Array, Option<String>), JsValue> {