Archived
Private
Public Access
1
0

Implemented Backend WindowAPI

This commit is contained in:
2022-11-05 12:19:14 +01:00
parent dd1d6dc89e
commit 46afa9cb7a
17 changed files with 305 additions and 416 deletions

BIN
WindowAPI_Test/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -2,25 +2,46 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>Window API Test</title>
</head>
<body>
<iframe src="window.html" width="512" height="512" id="window-frame"></iframe>
<button id="action">Click to Action</button>
<script>
const frame = document.getElementById('window-frame');
<script type="module">
import {WindowAPI} from "./node_modules/webdesktop_windowapi/dist/WindowAPI.js";
const api = new WindowAPI();
frame.addEventListener('load', () => {
const action = document.getElementById("action");
action.onclick = async () => {
/*const data = {};
data.title = await api.get.title();
data.size = await api.get.size();
data.position = await api.get.position();
data.maximized = await api.get.maximized();
data.minimized = await api.get.maximized();
data.draggable = await api.get.draggable();
data.resizable = await api.get.resizable();
data.uuid = await api.get.uuid();
console.log("GET METHODS: ", data);
});
window.addEventListener('message', (event) => {
if (event.origin !== new URL(frame.src).origin) return;
console.log(event.data);
frame.contentWindow.postMessage({content: 'Test Titel'}, event.origin);
}, false);
await api.set.title("New Title");
await api.set.size({width: 400, height: 300});
await api.set.position({x: 20, y: 20});
await api.set.maximized(true);
await api.set.minimized(true);
await api.set.draggable(false);
await api.set.resizable(false);
await api.action.openWindow("tester");
await api.action.closeWindow(0);
await api.action.sendDataToWindow(0, "Hello World!");
await api.action.close();
await api.action.focus();
await api.action.notification({}); // TODO: Implement Notifications
await api.action.openPopup({});*/ // TODO: Implement Popups
}
</script>
</body>

View File

@@ -9,43 +9,20 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"webdesktop_windowapi": "^1.0.4"
}
},
"node_modules/typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
"webdesktop_windowapi": "^1.0.9"
}
},
"node_modules/webdesktop_windowapi": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/webdesktop_windowapi/-/webdesktop_windowapi-1.0.4.tgz",
"integrity": "sha512-UmL3DsTz2Tct0EI4llDOT5cn76wRCq9HJPL92EwQQykscv/4N0PXucdVf3eRLfxg7jtWNTDajW/taCx1l6zbCg==",
"dependencies": {
"typescript": "^4.8.4"
}
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/webdesktop_windowapi/-/webdesktop_windowapi-1.0.9.tgz",
"integrity": "sha512-q84Auqs9HCjIi1T+Ny8sdCXQq00b4JZqVpiAhMS5vKpQmOMDtkarsgUgSiU0VRhtnAKojXsDENsqNtCXTYbhGw=="
}
},
"dependencies": {
"typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ=="
},
"webdesktop_windowapi": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/webdesktop_windowapi/-/webdesktop_windowapi-1.0.4.tgz",
"integrity": "sha512-UmL3DsTz2Tct0EI4llDOT5cn76wRCq9HJPL92EwQQykscv/4N0PXucdVf3eRLfxg7jtWNTDajW/taCx1l6zbCg==",
"requires": {
"typescript": "^4.8.4"
}
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/webdesktop_windowapi/-/webdesktop_windowapi-1.0.9.tgz",
"integrity": "sha512-q84Auqs9HCjIi1T+Ny8sdCXQq00b4JZqVpiAhMS5vKpQmOMDtkarsgUgSiU0VRhtnAKojXsDENsqNtCXTYbhGw=="
}
}
}

View File

@@ -4,12 +4,13 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "httpserver"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"webdesktop_windowapi": "^1.0.4"
"webdesktop_windowapi": "^1.0.9"
}
}

View File

@@ -1,25 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Window API Test</title>
</head>
<body>
<h1>Window APT Tester works!</h1>
<script type="module">
import {WindowAPI} from "./node_modules/webdesktop_windowapi/dist/WindowAPI.js";
const api = new WindowAPI();
setTimeout(async () => {
api.set.title("Haha POPO");
const title = await api.get.title();
console.log(title);
})
</script>
</body>
</html>