1 parent
dccbfd7d86
commit
17f81c60c8
20 files changed
+636
-447
No files matched your search
+29
-18
@@ -43,7 +43,12 @@ extern "js" fn dom_class(d : Dom, v : String) -> Unit =
|
||||
///|
|
||||
/// Put `d` into `parent` right before `before` (or last when `before` is not a node),
|
||||
/// unless it is already there.
|
||||
extern "js" fn dom_place(parent : Dom, d : Dom, before : Dom, has_before : Bool) -> Unit =
|
||||
extern "js" fn dom_place(
|
||||
parent : Dom,
|
||||
d : Dom,
|
||||
before : Dom,
|
||||
has_before : Bool,
|
||||
) -> Unit =
|
||||
#|(p, d, b, has) => { const next = has ? b : null; if (d.parentNode !== p || d.nextSibling !== next) p.insertBefore(d, next); }
|
||||
|
||||
///|
|
||||
@@ -102,7 +107,7 @@ extern "js" fn ev_touch_y(e : Ev) -> Double =
|
||||
#|(e) => (e.changedTouches && e.changedTouches[0] ? e.changedTouches[0].clientY : 0)
|
||||
|
||||
///|
|
||||
extern "js" fn ev_touches(e : Ev) -> Int =
|
||||
extern "js" fn ev_touches(e : Ev) -> Int32 =
|
||||
#|(e) => (e.touches ? e.touches.length : 0)
|
||||
|
||||
///|
|
||||
@@ -111,7 +116,7 @@ extern "js" fn ev_chain(e : Ev) -> String =
|
||||
#|(e) => { const out = []; for (let n = e.target; n && n.getAttribute; n = n.parentNode) { const v = n.getAttribute("data-n"); if (v !== null) out.push(v); } return out.join(","); }
|
||||
|
||||
///|
|
||||
extern "js" fn set_timeout(ms : Int, f : () -> Unit) -> Unit =
|
||||
extern "js" fn set_timeout(ms : Int32, f : () -> Unit) -> Unit =
|
||||
#|(ms, f) => { setTimeout(f, ms) }
|
||||
|
||||
///|
|
||||
@@ -154,7 +159,7 @@ extern "js" fn measure() -> Bool =
|
||||
|
||||
///|
|
||||
/// Measurement i: viewport width, height, grid left, top, width, the home's bottom padding.
|
||||
extern "js" fn measured(i : Int) -> Double =
|
||||
extern "js" fn measured(i : Int32) -> Double =
|
||||
#|(i) => window.__m[i]
|
||||
|
||||
///|
|
||||
@@ -211,20 +216,20 @@ extern "js" fn toast(s : String) -> Unit =
|
||||
|
||||
///|
|
||||
/// Snapshot the page's icon images; returns how many.
|
||||
extern "js" fn icons_scan() -> Int =
|
||||
extern "js" fn icons_scan() -> Int32 =
|
||||
#|() => { window.__imgs = [...document.querySelectorAll("img.icon[data-icon]")]; return window.__imgs.length; }
|
||||
|
||||
///|
|
||||
extern "js" fn icon_key(i : Int) -> String =
|
||||
extern "js" fn icon_key(i : Int32) -> String =
|
||||
#|(i) => window.__imgs[i].dataset.icon
|
||||
|
||||
///|
|
||||
/// Whether image i already shows the icon for its key.
|
||||
extern "js" fn icon_done(i : Int) -> Bool =
|
||||
extern "js" fn icon_done(i : Int32) -> Bool =
|
||||
#|(i) => window.__imgs[i].__icon === window.__imgs[i].dataset.icon
|
||||
|
||||
///|
|
||||
extern "js" fn icon_set(i : Int, src : String) -> Unit =
|
||||
extern "js" fn icon_set(i : Int32, src : String) -> Unit =
|
||||
#|(i, src) => { const img = window.__imgs[i]; img.__icon = img.dataset.icon; if (src) { img.src = src; img.classList.remove("missing"); } else img.classList.add("missing"); }
|
||||
|
||||
///|
|
||||
@@ -255,7 +260,7 @@ extern "js" fn h_add_widget(p : String) -> Unit =
|
||||
#|(p) => window.Android.addWidget(p)
|
||||
|
||||
///|
|
||||
extern "js" fn h_remove_widget(id : Int) -> Unit =
|
||||
extern "js" fn h_remove_widget(id : Int32) -> Unit =
|
||||
#|(id) => window.Android.removeWidget(id)
|
||||
|
||||
///|
|
||||
@@ -263,7 +268,7 @@ extern "js" fn h_place_widgets(json : String) -> Unit =
|
||||
#|(j) => window.Android.placeWidgets(j)
|
||||
|
||||
///|
|
||||
extern "js" fn h_cover_widgets(y : Int) -> Unit =
|
||||
extern "js" fn h_cover_widgets(y : Int32) -> Unit =
|
||||
#|(y) => window.Android.coverWidgets(y)
|
||||
|
||||
///|
|
||||
@@ -271,7 +276,7 @@ extern "js" fn h_exclude_gestures(json : String) -> Unit =
|
||||
#|(j) => window.Android.excludeGestures && window.Android.excludeGestures(j)
|
||||
|
||||
///|
|
||||
extern "js" fn h_widget_limits(id : Int) -> String =
|
||||
extern "js" fn h_widget_limits(id : Int32) -> String =
|
||||
#|(id) => window.Android.widgetLimits(id)
|
||||
|
||||
///|
|
||||
@@ -307,19 +312,19 @@ extern "js" fn h_open_recents() -> Unit =
|
||||
#|() => window.Android.openRecents()
|
||||
|
||||
///|
|
||||
extern "js" fn h_http_get(url : String, tag : Int) -> Unit =
|
||||
extern "js" fn h_http_get(url : String, tag : Int32) -> Unit =
|
||||
#|(url, tag) => window.Android.httpGet(url, tag)
|
||||
|
||||
///|
|
||||
extern "js" fn h_install_apk(url : String, version : Int) -> Unit =
|
||||
extern "js" fn h_install_apk(url : String, version : Int32) -> Unit =
|
||||
#|(url, v) => window.Android.installApk(url, v)
|
||||
|
||||
///|
|
||||
extern "js" fn h_declined_version() -> Int =
|
||||
extern "js" fn h_declined_version() -> Int32 =
|
||||
#|() => window.Android.declinedVersion()
|
||||
|
||||
///|
|
||||
extern "js" fn h_installed_version() -> Int =
|
||||
extern "js" fn h_installed_version() -> Int32 =
|
||||
#|() => window.Android.installedVersion()
|
||||
|
||||
// ---- what the shell calls on the page -----------------------------------------------
|
||||
@@ -333,7 +338,7 @@ extern "js" fn expose0(name : String, f : () -> Unit) -> Unit =
|
||||
#|(n, f) => { window.launcher[n] = f }
|
||||
|
||||
///|
|
||||
extern "js" fn expose1(name : String, f : (Int) -> Unit) -> Unit =
|
||||
extern "js" fn expose1(name : String, f : (Int32) -> Unit) -> Unit =
|
||||
#|(n, f) => { window.launcher[n] = f }
|
||||
|
||||
///|
|
||||
@@ -346,7 +351,10 @@ extern "js" fn expose_dd(name : String, f : (Double, Double) -> Unit) -> Unit =
|
||||
|
||||
///|
|
||||
/// `f(tag, ok, text)`: a finished `httpGet`.
|
||||
extern "js" fn expose_result(name : String, f : (Int, Bool, String) -> Unit) -> Unit =
|
||||
extern "js" fn expose_result(
|
||||
name : String,
|
||||
f : (Int32, Bool, String) -> Unit,
|
||||
) -> Unit =
|
||||
#|(n, f) => { window.launcher[n] = f }
|
||||
|
||||
///|
|
||||
@@ -356,7 +364,10 @@ extern "js" fn expose_json(name : String, f : (String) -> Unit) -> Unit =
|
||||
|
||||
///|
|
||||
/// Run `f` for each `key\nsrc` pair of a JSON object (flattened, so no arrays cross).
|
||||
extern "js" fn json_entries(json : String, f : (String, String) -> Unit) -> Unit =
|
||||
extern "js" fn json_entries(
|
||||
json : String,
|
||||
f : (String, String) -> Unit,
|
||||
) -> Unit =
|
||||
#|(j, f) => { const o = JSON.parse(j); for (const k in o) f(k, o[k] ?? "") }
|
||||
|
||||
///|
|
||||
|
||||
Reference in new issue
Block a user