diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..55de43e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.vs +/.vscode +.env \ No newline at end of file diff --git a/assets/script.js b/assets/script.js new file mode 100644 index 0000000..9a99b40 --- /dev/null +++ b/assets/script.js @@ -0,0 +1,13 @@ +const url = 'https://lens.admin-host.com'; // LENS server URL +const host = 'my-app'; // Registered app slug +const width = 600; // Popup window width +const height = 850; // Popup window height +document.querySelector('#domain').innerHTML += document.domain; // Display current domain on screen. This domain must be registered with LENS. Register 'localhost' for testing +function receiveMessage(event) { + if (event.origin === url) { + console.log(event.data); // Log response in console + document.querySelector('#response').innerHTML += JSON.stringify(event.data); // Display response on screen + }; +}; +window.addEventListener('message', receiveMessage, false); +const popupWindow = window.open(`${url}?host=${host}&return=${document.domain}`, 'popup', `width=${width},height=${height},left=${(screen.width / 2) - (width / 2)},top=${(screen.height / 2) - (height / 2)}`); \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..76b55e8 --- /dev/null +++ b/index.html @@ -0,0 +1,15 @@ + + + + + LENS App + + + +

Hello World!

+

Domain:

+

Response:

+ + + + \ No newline at end of file