Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions mocket.js.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,20 @@ pub fn __ws_get_members_js(channel : String) -> Array[String] {

///|
#owned(sub, unsub, get_members)
pub extern "js" fn __ws_state_js_export(
pub extern "js" fn __ws_state_js_export_ffi(
sub : (String, String) -> Unit,
unsub : (String, String) -> Unit,
get_members : (String) -> Array[String],
get_members : (String) -> FixedArray[String],
) -> Unit = "(sub, unsub, get_members) => { globalThis.__ws_subscribe_js = (id, ch) => { try { sub(id, ch); } catch (_) {} }; globalThis.__ws_unsubscribe_js = (id, ch) => { try { unsub(id, ch); } catch (_) {} }; globalThis.__ws_get_members_js = (ch) => { try { return get_members(ch); } catch (_) { return []; } }; }"

pub fn __ws_state_js_export(
sub : (String, String) -> Unit,
unsub : (String, String) -> Unit,
get_members : (String) -> Array[String],
) -> Unit {
__ws_state_js_export_ffi(sub, unsub, fn(__a1) { FixedArray::from_array(get_members(__a1)) })
}

///|
pub fn __get_port_by_connection_js(id : String) -> Int {
let mut found = 0
Expand Down
Loading