Finished WindowAPI for the frontend
This commit is contained in:
27
WindowAPI_Test/index.html
Normal file
27
WindowAPI_Test/index.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe src="window.html" width="512" height="512" id="window-frame"></iframe>
|
||||
|
||||
<script>
|
||||
const frame = document.getElementById('window-frame');
|
||||
|
||||
frame.addEventListener('load', () => {
|
||||
|
||||
});
|
||||
|
||||
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);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
51
WindowAPI_Test/package-lock.json
generated
Normal file
51
WindowAPI_Test/package-lock.json
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "windowapi_test",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "windowapi_test",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
WindowAPI_Test/package.json
Normal file
15
WindowAPI_Test/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "windowapi_test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"webdesktop_windowapi": "^1.0.4"
|
||||
}
|
||||
}
|
||||
25
WindowAPI_Test/window.html
Normal file
25
WindowAPI_Test/window.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user