mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-10 22:31:58 +00:00
hot reload now refreshes iframe
also fixed fetch_nocors
This commit is contained in:
@@ -2,7 +2,6 @@ class PluginEventTarget extends EventTarget { }
|
||||
method_call_ev_target = new PluginEventTarget();
|
||||
|
||||
window.addEventListener("message", function(evt) {
|
||||
console.log(evt);
|
||||
let ev = new Event(evt.data.call_id);
|
||||
ev.data = evt.data.result;
|
||||
method_call_ev_target.dispatchEvent(ev);
|
||||
@@ -27,6 +26,8 @@ async function fetch_nocors(url, request={}) {
|
||||
let args = { method: "POST", headers: {}, body: "" };
|
||||
request = {...args, ...request};
|
||||
request.url = url;
|
||||
request.data = request.body;
|
||||
delete request.body; //maintain api-compatibility with fetch
|
||||
return await call_server_method("http_request", request);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
}, 100);
|
||||
})();
|
||||
|
||||
function reloadIframe() {
|
||||
console.log("reloading iframe");
|
||||
document.getElementById("plugin_iframe").contentWindow.location.href = "http://127.0.0.1:1337/plugins/iframe";
|
||||
}
|
||||
|
||||
function resolveMethodCall(call_id, result) {
|
||||
let iframe = document.getElementById("plugin_iframe").contentWindow;
|
||||
iframe.postMessage({'call_id': call_id, 'result': result}, "http://127.0.0.1:1337");
|
||||
|
||||
Reference in New Issue
Block a user