Skip to content

Commit

Permalink
Allow native to switch screens
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed May 24, 2021
1 parent fb09c52 commit 44aad4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion native_demo/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const screenId = (urlString) => {
const url = new URL(urlString);
const params = new URLSearchParams(url.search);
params.delete("_no");
return `${url.pathname}${params.toString()}`
return `${url.pathname}?${params.toString()}`
}

window.addEventListener("phx:page-loading-start", info => {
Expand Down Expand Up @@ -118,3 +118,7 @@ liveSocket.connect()
// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session
// >> liveSocket.disableLatencySim()
window.liveSocket = liveSocket

window.setScreenFromNative = (screenId) => {
liveSocket.redirect(screenId, null);
}
Loading

0 comments on commit 44aad4f

Please sign in to comment.