diff options
author | Aylur <[email protected]> | 2024-05-25 14:44:50 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-05-25 14:44:50 +0200 |
commit | 58fa1ab9be7ee8fd4a8e96865121a54d613978cc (patch) | |
tree | 56f01ba49fd2929690a16ac05a4af8f763e6b30b /js/node/application.ts | |
parent | a7e25a4a5fcf4de89fe5a149a9aaf50a92be7af1 (diff) |
separate node and gjs into its own package
Diffstat (limited to 'js/node/application.ts')
-rw-r--r-- | js/node/application.ts | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/js/node/application.ts b/js/node/application.ts deleted file mode 100644 index 875c1c8..0000000 --- a/js/node/application.ts +++ /dev/null @@ -1,51 +0,0 @@ -import gi from "node-gtk" -import { RequestHandler, Config, runJS } from "../src/application.js" -const Astal = gi.require("Astal", "0.1") - -class AstalJS extends Astal.Application { - static GTypeName = "AstalJS" - static { gi.registerClass(this) } - - eval = runJS - requestHandler?: RequestHandler - - vfunc_response(msg: string, conn: any): void { - if (typeof this.requestHandler === "function") { - this.requestHandler(msg, response => { - Astal.writeSock(conn, response, (_, res) => - Astal.writeSockFinish(res), - ) - }) - } else { - // @ts-expect-error missing type - super.vfunc_response(msg, conn) - } - } - - start( - { requestHandler, css, ...cfg }: Omit<Config, "hold"> = {}, - callback?: (args: string[]) => any, - ) { - Object.assign(this, cfg) - - this.requestHandler = requestHandler - this.on("activate", () => { - callback?.(process.argv) - }) - - if (!this.acquireSocket()) { - console.error(`Astal instance "${this.instanceName}" already running`) - process.exit() - } - - if (css) - this.applyCss(css, false) - - // FIXME: promises never resolve - // https://github.com/romgrk/node-gtk/issues/121 - // https://gitlab.gnome.org/GNOME/gjs/-/issues/468 - App.run([]) - } -} - -export const App = new AstalJS |