Merge pull request #800 from wailsapp/test-update-runtime

[v2] Update Workflows + runtime
This commit is contained in:
Lea Anthony
2021-09-13 20:14:35 +10:00
committed by GitHub
12 changed files with 37 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
name: Runtime
on:
pull_request:
push:
branches:
- v2-alpha
paths:
@@ -14,14 +14,17 @@ jobs:
- uses: actions/setup-node@v2
with:
node-version: 14.17.6
# cache: 'npm'
# cache-dependency-path: v2/internal/frontend/runtime/package-lock.json
cache: 'npm'
cache-dependency-path: v2/internal/frontend/runtime/package-lock.json
- run: npm install
working-directory: v2/internal/frontend/runtime
- run: npm run build
working-directory: v2/internal/frontend/runtime
- name: Commit changes
uses: elstudio/actions-js-build/commit@v4
uses: devops-infra/action-commit-push@master
with:
commitMessage: Rebuild runtime
github_token: "${{ secrets.GITHUB_TOKEN }}"
add_timestamp: true
commit_prefix: "[AUTO]"
commit_message: "The runtime was rebuilt"

View File

@@ -2,4 +2,5 @@
This branch contains WORK IN PROGRESS! There are no guarantees. Use at your peril!
This document will be updated as progress is made.
This document will be updated as progress is made.

View File

@@ -36,6 +36,9 @@ func (d *Dispatcher) ProcessMessage(message string, sender frontend.Frontend) (s
return d.processCallMessage(message, sender)
case 'W':
return d.processWindowMessage(message, sender)
case 'Q':
sender.Quit()
return "", nil
default:
return "", errors.New("Unknown message from front end: " + message)
}

View File

@@ -71,8 +71,6 @@ func (d *Dispatcher) processWindowMessage(message string, sender frontend.Fronte
w := d.mustAtoI(parts[0])
h := d.mustAtoI(parts[1])
go sender.WindowSetMinSize(w, h)
case 'C':
sender.Quit()
default:
d.log.Error("unknown Window message: %s", message)
}

View File

@@ -14,6 +14,11 @@ import {Callback, callbacks} from './calls';
import {SetBindings} from "./bindings";
import * as Window from "./window";
export function Quit() {
window.WailsInvoke('Q');
}
// The JS runtime
window.runtime = {
...Log,
@@ -23,6 +28,7 @@ window.runtime = {
EventsOnMultiple,
EventsEmit,
EventsOff,
Quit
};
// Internal wails endpoints

View File

@@ -185,12 +185,3 @@ export function WindowSetRGBA(RGBA) {
window.WailsInvoke('Wr:' + rgba);
}
/**
* Close the Window
*
* @export
*/
export function WindowClose() {
window.WailsInvoke('WC');
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
(()=>{var v=Object.defineProperty;var h=n=>v(n,"__esModule",{value:!0});var x=(n,o)=>{h(n);for(var e in o)v(n,e,{get:o[e],enumerable:!0})};var f={};x(f,{LogDebug:()=>C,LogError:()=>D,LogFatal:()=>F,LogInfo:()=>T,LogLevel:()=>z,LogPrint:()=>R,LogTrace:()=>b,LogWarning:()=>J,SetLogLevel:()=>G});function l(n,o){window.WailsInvoke("L"+n+o)}function b(n){l("T",n)}function R(n){l("P",n)}function C(n){l("D",n)}function T(n){l("I",n)}function J(n){l("W",n)}function D(n){l("E",n)}function F(n){l("F",n)}function G(n){l("S",n)}var z={TRACE:1,DEBUG:2,INFO:3,WARNING:4,ERROR:5};var g=class{constructor(o,e){e=e||-1,this.Callback=t=>(o.apply(null,t),e===-1?!1:(e-=1,e===0))}},s={};function a(n,o,e){s[n]=s[n]||[];let t=new g(o,e);s[n].push(t)}function E(n,o){a(n,o,-1)}function I(n,o){a(n,o,1)}function k(n){let o=n.name;if(s[o]){let e=s[o].slice();for(let t=0;t<s[o].length;t+=1){let r=s[o][t],i=n.data;r.Callback(i)&&e.splice(t,1)}s[o]=e}}function S(n){let o;try{o=JSON.parse(n)}catch(e){let t="Invalid JSON passed to Notify: "+n;throw new Error(t)}k(o)}function m(n){let o={name:n,data:[].slice.apply(arguments).slice(1)};k(o),window.WailsInvoke("EE"+JSON.stringify(o))}function y(n){s.delete(n),window.WailsInvoke("EX"+n)}var c={};function A(){var n=new Uint32Array(1);return window.crypto.getRandomValues(n)[0]}function B(){return Math.random()*9007199254740991}var W;window.crypto?W=A:W=B;function d(n,o,e){return e==null&&(e=0),new Promise(function(t,r){var i;do i=n+"-"+W();while(c[i]);var w;e>0&&(w=setTimeout(function(){r(Error("Call to "+n+" timed out. Request ID: "+i))},e)),c[i]={timeoutHandle:w,reject:r,resolve:t};try{let u={name:n,args:o,callbackID:i};window.WailsInvoke("C"+JSON.stringify(u))}catch(u){console.error(u)}})}function L(n){var o;try{o=JSON.parse(n)}catch(r){let i=`Invalid JSON passed to callback: ${r.message}. Message: ${n}`;throw wails.LogDebug(i),new Error(i)}var e=o.callbackid,t=c[e];if(!t){let r=`Callback '${e}' not registered!!!`;throw console.error(r),new Error(r)}clearTimeout(t.timeoutHandle),delete c[e],o.error?t.reject(o.error):t.resolve(o.result)}window.go={};function O(n){try{n=JSON.parse(n)}catch(o){console.error(o)}window.go=window.go||{},Object.keys(n).forEach(o=>{window.go[o]=window.go[o]||{},Object.keys(n[o]).forEach(e=>{window.go[o][e]=window.go[o][e]||{},Object.keys(n[o][e]).forEach(t=>{window.go[o][e][t]=function(){let r=0;function i(){let w=[].slice.call(arguments);return d([o,e,t].join("."),w,r)}return i.setTimeout=function(w){r=w},i.getTimeout=function(){return r},i}()})})})}var p={};x(p,{WindowCenter:()=>U,WindowClose:()=>tn,WindowFullscreen:()=>H,WindowGetPosition:()=>Z,WindowGetSize:()=>V,WindowHide:()=>K,WindowMaximise:()=>Y,WindowMinimise:()=>nn,WindowReload:()=>P,WindowSetMaxSize:()=>q,WindowSetMinSize:()=>N,WindowSetPosition:()=>X,WindowSetRGBA:()=>en,WindowSetSize:()=>$,WindowSetTitle:()=>j,WindowShow:()=>Q,WindowUnFullscreen:()=>M,WindowUnmaximise:()=>_,WindowUnminimise:()=>on});function P(){window.location.reload()}function U(){window.WailsInvoke("Wc")}function j(n){window.WailsInvoke("WT"+n)}function H(){window.WailsInvoke("WF")}function M(){window.WailsInvoke("Wf")}function $(n,o){window.WailsInvoke("Ws:"+n+":"+o)}function V(){return d(":wails:WindowGetSize")}function q(n,o){window.WailsInvoke("WZ:"+n+":"+o)}function N(n,o){window.WailsInvoke("Wz:"+n+":"+o)}function X(n,o){window.WailsInvoke("Wp:"+n+":"+o)}function Z(){return d(":wails:WindowGetPos")}function K(){window.WailsInvoke("WH")}function Q(){window.WailsInvoke("WS")}function Y(){window.WailsInvoke("WM")}function _(){window.WailsInvoke("WU")}function nn(){window.WailsInvoke("Wm")}function on(){window.WailsInvoke("Wu")}function en(n){let o=JSON.stringify(n);window.WailsInvoke("Wr:"+o)}function tn(){window.WailsInvoke("WC")}window.runtime={...f,...p,EventsOn:E,EventsOnce:I,EventsOnMultiple:a,EventsEmit:m,EventsOff:y};window.wails={Callback:L,EventsNotify:S,SetBindings:O,eventListeners:s,callbacks:c};window.wails.SetBindings(window.wailsbindings);delete window.wails.SetBindings;delete window.wailsbindings;window.addEventListener("mousedown",n=>{let o=n.target;for(;o!=null&&!o.hasAttribute("data-wails-no-drag");){if(o.hasAttribute("data-wails-drag")){window.WailsInvoke("drag");break}o=o.parentElement}});})();
(()=>{var v=Object.defineProperty;var h=n=>v(n,"__esModule",{value:!0});var x=(n,o)=>{h(n);for(var e in o)v(n,e,{get:o[e],enumerable:!0})};var f={};x(f,{LogDebug:()=>T,LogError:()=>D,LogFatal:()=>F,LogInfo:()=>C,LogLevel:()=>z,LogPrint:()=>R,LogTrace:()=>b,LogWarning:()=>J,SetLogLevel:()=>G});function l(n,o){window.WailsInvoke("L"+n+o)}function b(n){l("T",n)}function R(n){l("P",n)}function T(n){l("D",n)}function C(n){l("I",n)}function J(n){l("W",n)}function D(n){l("E",n)}function F(n){l("F",n)}function G(n){l("S",n)}var z={TRACE:1,DEBUG:2,INFO:3,WARNING:4,ERROR:5};var g=class{constructor(o,e){e=e||-1,this.Callback=t=>(o.apply(null,t),e===-1?!1:(e-=1,e===0))}},s={};function a(n,o,e){s[n]=s[n]||[];let t=new g(o,e);s[n].push(t)}function E(n,o){a(n,o,-1)}function I(n,o){a(n,o,1)}function k(n){let o=n.name;if(s[o]){let e=s[o].slice();for(let t=0;t<s[o].length;t+=1){let r=s[o][t],i=n.data;r.Callback(i)&&e.splice(t,1)}s[o]=e}}function S(n){let o;try{o=JSON.parse(n)}catch(e){let t="Invalid JSON passed to Notify: "+n;throw new Error(t)}k(o)}function m(n){let o={name:n,data:[].slice.apply(arguments).slice(1)};k(o),window.WailsInvoke("EE"+JSON.stringify(o))}function y(n){s.delete(n),window.WailsInvoke("EX"+n)}var c={};function A(){var n=new Uint32Array(1);return window.crypto.getRandomValues(n)[0]}function B(){return Math.random()*9007199254740991}var W;window.crypto?W=A:W=B;function d(n,o,e){return e==null&&(e=0),new Promise(function(t,r){var i;do i=n+"-"+W();while(c[i]);var w;e>0&&(w=setTimeout(function(){r(Error("Call to "+n+" timed out. Request ID: "+i))},e)),c[i]={timeoutHandle:w,reject:r,resolve:t};try{let u={name:n,args:o,callbackID:i};window.WailsInvoke("C"+JSON.stringify(u))}catch(u){console.error(u)}})}function L(n){var o;try{o=JSON.parse(n)}catch(r){let i=`Invalid JSON passed to callback: ${r.message}. Message: ${n}`;throw wails.LogDebug(i),new Error(i)}var e=o.callbackid,t=c[e];if(!t){let r=`Callback '${e}' not registered!!!`;throw console.error(r),new Error(r)}clearTimeout(t.timeoutHandle),delete c[e],o.error?t.reject(o.error):t.resolve(o.result)}window.go={};function O(n){try{n=JSON.parse(n)}catch(o){console.error(o)}window.go=window.go||{},Object.keys(n).forEach(o=>{window.go[o]=window.go[o]||{},Object.keys(n[o]).forEach(e=>{window.go[o][e]=window.go[o][e]||{},Object.keys(n[o][e]).forEach(t=>{window.go[o][e][t]=function(){let r=0;function i(){let w=[].slice.call(arguments);return d([o,e,t].join("."),w,r)}return i.setTimeout=function(w){r=w},i.getTimeout=function(){return r},i}()})})})}var p={};x(p,{WindowCenter:()=>U,WindowFullscreen:()=>H,WindowGetPosition:()=>X,WindowGetSize:()=>Q,WindowHide:()=>Z,WindowMaximise:()=>Y,WindowMinimise:()=>nn,WindowReload:()=>P,WindowSetMaxSize:()=>V,WindowSetMinSize:()=>q,WindowSetPosition:()=>N,WindowSetRGBA:()=>en,WindowSetSize:()=>$,WindowSetTitle:()=>j,WindowShow:()=>K,WindowUnFullscreen:()=>M,WindowUnmaximise:()=>_,WindowUnminimise:()=>on});function P(){window.location.reload()}function U(){window.WailsInvoke("Wc")}function j(n){window.WailsInvoke("WT"+n)}function H(){window.WailsInvoke("WF")}function M(){window.WailsInvoke("Wf")}function $(n,o){window.WailsInvoke("Ws:"+n+":"+o)}function Q(){return d(":wails:WindowGetSize")}function V(n,o){window.WailsInvoke("WZ:"+n+":"+o)}function q(n,o){window.WailsInvoke("Wz:"+n+":"+o)}function N(n,o){window.WailsInvoke("Wp:"+n+":"+o)}function X(){return d(":wails:WindowGetPos")}function Z(){window.WailsInvoke("WH")}function K(){window.WailsInvoke("WS")}function Y(){window.WailsInvoke("WM")}function _(){window.WailsInvoke("WU")}function nn(){window.WailsInvoke("Wm")}function on(){window.WailsInvoke("Wu")}function en(n){let o=JSON.stringify(n);window.WailsInvoke("Wr:"+o)}function tn(){window.WailsInvoke("Q")}window.runtime={...f,...p,EventsOn:E,EventsOnce:I,EventsOnMultiple:a,EventsEmit:m,EventsOff:y,Quit:tn};window.wails={Callback:L,EventsNotify:S,SetBindings:O,eventListeners:s,callbacks:c};window.wails.SetBindings(window.wailsbindings);delete window.wails.SetBindings;delete window.wailsbindings;window.addEventListener("mousedown",n=>{let o=n.target;for(;o!=null&&!o.hasAttribute("data-wails-no-drag");){if(o.hasAttribute("data-wails-drag")){window.WailsInvoke("drag");break}o=o.parentElement}});})();

View File

@@ -13,8 +13,14 @@ import * as Log from "./log";
import * as Events from './events';
import * as Window from './window';
export function Quit() {
window.runtime.Quit();
}
export default {
...Log,
...Events,
...Window,
Quit
};

View File

@@ -73,7 +73,7 @@ interface runtime {
WindowSetRGBA(rgba: RGBA): void;
WindowClose(): void
Quit(): void
}
declare global {

View File

@@ -1 +1 @@
(()=>{var d=Object.defineProperty;var u=n=>d(n,"__esModule",{value:!0});var t=(n,i)=>{u(n);for(var o in i)d(n,o,{get:i[o],enumerable:!0})};var e={};t(e,{LogDebug:()=>W,LogError:()=>x,LogFatal:()=>f,LogInfo:()=>p,LogTrace:()=>m,LogWarning:()=>c});function m(n){window.runtime.LogTrace(n)}function W(n){window.runtime.LogDebug(n)}function p(n){window.runtime.LogInfo(n)}function c(n){window.runtime.LogWarning(n)}function x(n){window.runtime.LogError(n)}function f(n){window.runtime.LogFatal(n)}var w={};t(w,{EventsEmit:()=>S,EventsOn:()=>s,EventsOnMultiple:()=>l,EventsOnce:()=>a});function l(n,i,o){window.runtime.EventsOnMultiple(n,i,o)}function s(n,i){OnMultiple(n,i,-1)}function a(n,i){OnMultiple(n,i,1)}function S(n){let i=[n].slice.call(arguments);return window.runtime.EventsEmit.apply(null,i)}var r={};t(r,{WindowCenter:()=>L,WindowClose:()=>D,WindowFullscreen:()=>E,WindowGetPosition:()=>C,WindowGetSize:()=>z,WindowHide:()=>P,WindowMaximise:()=>T,WindowMinimise:()=>h,WindowReload:()=>g,WindowSetMaxSize:()=>G,WindowSetMinSize:()=>O,WindowSetPosition:()=>U,WindowSetRGBA:()=>B,WindowSetSize:()=>F,WindowSetTitle:()=>M,WindowShow:()=>R,WindowUnFullscreen:()=>v,WindowUnmaximise:()=>b,WindowUnminimise:()=>A});function g(){window.runtime.WindowReload()}function L(){window.runtime.WindowCenter()}function M(n){window.runtime.WindowSetTitle(n)}function E(){window.runtime.WindowFullscreen()}function v(){window.runtime.WindowUnFullscreen()}function z(){window.runtime.WindowGetSize()}function F(n,i){window.runtime.WindowSetSize(n,i)}function G(n,i){window.runtime.WindowSetMaxSize(n,i)}function O(n,i){window.runtime.WindowSetMinSize(n,i)}function U(n,i){window.runtime.WindowSetPosition(n,i)}function C(){window.runtime.WindowGetPosition()}function P(){window.runtime.WindowHide()}function R(){window.runtime.WindowShow()}function T(){window.runtime.WindowMaximise()}function b(){window.runtime.WindowUnmaximise()}function h(){window.runtime.WindowMinimise()}function A(){window.runtime.WindowUnminimise()}function B(n){window.runtime.WindowSetRGBA(n)}function D(){window.runtime.WindowClose()}var I={...e,...w,...r};})();
(()=>{var u=Object.defineProperty;var d=n=>u(n,"__esModule",{value:!0});var t=(n,i)=>{d(n);for(var o in i)u(n,o,{get:i[o],enumerable:!0})};var e={};t(e,{LogDebug:()=>p,LogError:()=>x,LogFatal:()=>f,LogInfo:()=>W,LogTrace:()=>m,LogWarning:()=>c});function m(n){window.runtime.LogTrace(n)}function p(n){window.runtime.LogDebug(n)}function W(n){window.runtime.LogInfo(n)}function c(n){window.runtime.LogWarning(n)}function x(n){window.runtime.LogError(n)}function f(n){window.runtime.LogFatal(n)}var w={};t(w,{EventsEmit:()=>S,EventsOn:()=>s,EventsOnMultiple:()=>l,EventsOnce:()=>a});function l(n,i,o){window.runtime.EventsOnMultiple(n,i,o)}function s(n,i){OnMultiple(n,i,-1)}function a(n,i){OnMultiple(n,i,1)}function S(n){let i=[n].slice.call(arguments);return window.runtime.EventsEmit.apply(null,i)}var r={};t(r,{WindowCenter:()=>L,WindowFullscreen:()=>E,WindowGetPosition:()=>P,WindowGetSize:()=>z,WindowHide:()=>R,WindowMaximise:()=>b,WindowMinimise:()=>A,WindowReload:()=>g,WindowSetMaxSize:()=>G,WindowSetMinSize:()=>O,WindowSetPosition:()=>U,WindowSetRGBA:()=>C,WindowSetSize:()=>F,WindowSetTitle:()=>M,WindowShow:()=>T,WindowUnFullscreen:()=>v,WindowUnmaximise:()=>h,WindowUnminimise:()=>B});function g(){window.runtime.WindowReload()}function L(){window.runtime.WindowCenter()}function M(n){window.runtime.WindowSetTitle(n)}function E(){window.runtime.WindowFullscreen()}function v(){window.runtime.WindowUnFullscreen()}function z(){window.runtime.WindowGetSize()}function F(n,i){window.runtime.WindowSetSize(n,i)}function G(n,i){window.runtime.WindowSetMaxSize(n,i)}function O(n,i){window.runtime.WindowSetMinSize(n,i)}function U(n,i){window.runtime.WindowSetPosition(n,i)}function P(){window.runtime.WindowGetPosition()}function R(){window.runtime.WindowHide()}function T(){window.runtime.WindowShow()}function b(){window.runtime.WindowMaximise()}function h(){window.runtime.WindowUnmaximise()}function A(){window.runtime.WindowMinimise()}function B(){window.runtime.WindowUnminimise()}function C(n){window.runtime.WindowSetRGBA(n)}function D(){window.runtime.Quit()}var I={...e,...w,...r,Quit:D};})();

View File

@@ -185,12 +185,3 @@ export function WindowUnminimise() {
export function WindowSetRGBA(RGBA) {
window.runtime.WindowSetRGBA(RGBA);
}
/**
* Close the Window
*
* @export
*/
export function WindowClose() {
window.runtime.WindowClose();
}