{"id":21244429,"url":"https://github.com/unyt-org/example-window-communication","last_synced_at":"2025-09-23T23:32:26.784Z","repository":{"id":232181085,"uuid":"783677802","full_name":"unyt-org/example-window-communication","owner":"unyt-org","description":"A example project to showcase direct window / iframe communication via DATEX","archived":false,"fork":false,"pushed_at":"2024-10-16T17:04:13.000Z","size":15,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-07T17:22:29.379Z","etag":null,"topics":["datex","datex-example","post-message","uix","uix-example","unyt","unyt-org","window-communication"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unyt-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["unyt-org"],"patreon":"unyt","custom":["https://unyt.org/donate"]}},"created_at":"2024-04-08T11:07:52.000Z","updated_at":"2024-10-16T17:04:17.000Z","dependencies_parsed_at":"2024-04-08T12:28:34.072Z","dependency_job_id":"84cd954d-225f-482a-a0be-6ec31c6004ff","html_url":"https://github.com/unyt-org/example-window-communication","commit_stats":null,"previous_names":["unyt-org/example-window-communication"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unyt-org%2Fexample-window-communication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unyt-org%2Fexample-window-communication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unyt-org%2Fexample-window-communication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unyt-org%2Fexample-window-communication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unyt-org","download_url":"https://codeload.github.com/unyt-org/example-window-communication/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243683804,"owners_count":20330728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datex","datex-example","post-message","uix","uix-example","unyt","unyt-org","window-communication"],"created_at":"2024-11-21T01:25:22.897Z","updated_at":"2025-09-23T23:32:21.743Z","avatar_url":"https://github.com/unyt-org.png","language":"TypeScript","funding_links":["https://github.com/sponsors/unyt-org","https://patreon.com/unyt","https://unyt.org/donate"],"categories":[],"sub_categories":[],"readme":"# Example: Window communication\n\nThis repository provides a simple setup to showcase a bidirectional communication interface between your app and a popup window.\n\n*[UIX Docs](https://docs.unyt.org/manual/datex/communication-interfaces#window)*\n\nThe DATEX API to open a window (page, popup or tab) is similar to the [window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) API with the difference that it is asynchronously and returns an object of the remote endpoint (the endpoint of the window) and the actual [Window](https://developer.mozilla.org/en-US/docs/Web/API/Window) containing the DOM document.\n\n```ts\nimport { WindowInterface } from \"datex-core-legacy/network/communication-interfaces/window-interface.ts\";\n\nconst { endpoint, window } = await WindowInterface.createWindow(\n\t\"https://popup.com\",   // URL of our window\n\t\"MyWindow\",            // Target specifying the name of the context\n\t`popup=yes`            // Window feature list\n);\n```\n\nThe DATEX app on the window site can connect to the parent site by creating a parentWindow:\n\n```ts\nconst parentInterface = WindowInterface.createParentInterface(\n\tglobalThis.opener,  // Parent window instance (app)\n\t\"https://myapp.com\" // URL of the parent window (app)\n);\n\n// The connection event is fired if we got a response from the app\nparentInterface.addEventListener(\"connect\", (event) =\u003e {\n\t// connection is established\n\t// event.endpoint gives us the endpoint of the app\n});\n```\n\nWhen the `createWindow` call of the app did resolve, all DATEX traffic of the app directed to the [endpoint](https://docs.unyt.org/manual/datex/endpoints) of the window is directly routed via [postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) API.\n\n---\n\n\u003csub\u003e\u0026copy; unyt 2024 • [unyt.org](https://unyt.org)\u003c/sub\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funyt-org%2Fexample-window-communication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funyt-org%2Fexample-window-communication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funyt-org%2Fexample-window-communication/lists"}