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/src/application.ts | |
parent | a7e25a4a5fcf4de89fe5a149a9aaf50a92be7af1 (diff) |
separate node and gjs into its own package
Diffstat (limited to 'js/src/application.ts')
-rw-r--r-- | js/src/application.ts | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/js/src/application.ts b/js/src/application.ts deleted file mode 100644 index 10f840e..0000000 --- a/js/src/application.ts +++ /dev/null @@ -1,28 +0,0 @@ -export type RequestHandler = { - (request: string, res: (response: string) => void): void -} - -export type Config = Partial<{ - instanceName: string - gtkTheme: string - iconTheme: string - cursorTheme: string - css: string - requestHandler: RequestHandler - hold: boolean -}> - -export function runJS(body: string): Promise<any> { - return new Promise((res, rej) => { - try { - const fn = Function(`return (async function() { - ${body.includes(";") ? body : `return ${body};`} - })`) - fn()() - .then(res) - .catch(rej) - } catch (error) { - rej(error) - } - }) -} |