Skip to content

Commit

Permalink
fix syntax of href and notify
Browse files Browse the repository at this point in the history
href requires prefixed page now;
notify requires an object, not an array
  • Loading branch information
r10s committed Dec 11, 2024
1 parent fed9387 commit 0e6a2f9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ window.addEventListener("load", () => {
h("li", {}, h("a", {href: "chrome://crash"}, "chrome://crash")),
);

let btn1 = h("button", {}, "notify (via info message) with deep-link to internal page");
let btn1 = h("button", {}, "info with deep-link to internal page, no notify");
btn1.onclick = () => {
window.webxdc.sendUpdate({ payload: "", info: "click me to open ./page.html directly", href: "./page.html", notify:["all", window.webxdc.selfAddr]}, "");
window.webxdc.sendUpdate({ payload: "", info: "open page.html", href: "page.html" }, "");
};
ul.append(h("li", {}, btn1));

let btn2 = h("button", {}, "notify (via summary) with deep-link to internal page");
let btn2 = h("button", {}, "info and notify all with deep-link to internal page");
btn2.onclick = () => {
window.webxdc.sendUpdate({ payload: "", info: "click me to open ./page.html directly", href: "./page.html", notify:["all", window.webxdc.selfAddr]}, "");
window.webxdc.sendUpdate({ payload: "", info: "open page.html", href: "page.html", notify: {"*": "notify page.html"} }, "");
};
ul.append(h("li", {}, btn2));

let btn3 = h("button", {}, "send info message with deep-link to #links-output section");
let btn3 = h("button", {}, "info and notify all with deep-link to #links-output section");
btn3.onclick = () => {
window.webxdc.sendUpdate({ payload: "", info: "click me to open #links-output directly", href: "#links-output"}, "");
window.webxdc.sendUpdate({ payload: "", info: "open #links-output", href: "index.html#links-output", notify: {"*": "notify #links-output"} }, "");
};
ul.append(h("li", {}, btn3));

Expand Down

0 comments on commit 0e6a2f9

Please sign in to comment.