aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2024-07-18 22:52:24 +0800
committerkaiwu <kaiwu2004@gmail.com>2024-07-18 22:52:24 +0800
commit42057cbe2ca6be753b71694d5255855bf1557465 (patch)
treed4261690f5af964ad98fec3585c1a65b24d978e8
parent0ae8cf2ab9791597d383953013732b1522b0906c (diff)
downloadwechat-42057cbe2ca6be753b71694d5255855bf1557465.tar.gz
wechat-42057cbe2ca6be753b71694d5255855bf1557465.zip
run app and run page
-rw-r--r--src/wechat/app.gleam3
-rw-r--r--src/wechat/page.gleam3
-rw-r--r--src/wechat_ffi.mjs8
3 files changed, 14 insertions, 0 deletions
diff --git a/src/wechat/app.gleam b/src/wechat/app.gleam
index 55846bb..175a1db 100644
--- a/src/wechat/app.gleam
+++ b/src/wechat/app.gleam
@@ -5,6 +5,9 @@ pub type App
@external(javascript, "../wechat_ffi.mjs", "get_app")
pub fn get_app() -> JsObject
+@external(javascript, "../wechat_ffi.mjs", "run_app")
+pub fn run_app(o: JsObject) -> Nil
+
@external(javascript, "../wechat_ffi.mjs", "set_timeout")
pub fn set_timeout(callback cb: fn(JsObject) -> Nil, delay d: Int, with o: JsObject) -> Int
diff --git a/src/wechat/page.gleam b/src/wechat/page.gleam
index b78981f..add7e24 100644
--- a/src/wechat/page.gleam
+++ b/src/wechat/page.gleam
@@ -5,6 +5,9 @@ import wechat/object.{type JsObject, type WechatResult}
pub type Page
+@external(javascript, "../wechat_ffi.mjs", "run_page")
+pub fn run_page(o: JsObject) -> Nil
+
@external(javascript, "../wechat_ffi.mjs", "get_current_pages")
pub fn get_current_pages() -> Array(JsObject)
diff --git a/src/wechat_ffi.mjs b/src/wechat_ffi.mjs
index cb9fda1..cdea463 100644
--- a/src/wechat_ffi.mjs
+++ b/src/wechat_ffi.mjs
@@ -5,6 +5,14 @@ export function get_app() {
return getApp();
}
+export function run_app(o) {
+ App(o);
+}
+
+export function run_page(o) {
+ Page(o);
+}
+
export function get_current_pages() {
return getCurrentPages();
}