mirinjs 0.0.1-alpha.17 → 0.0.1-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mirinjs",
3
- "version": "0.0.1-alpha.17",
3
+ "version": "0.0.1-alpha.19",
4
4
  "description": "Build desktop apps with Bun, TypeScript, and Chromium (CEF). The Bun-native Electron alternative.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/app.ts CHANGED
@@ -34,6 +34,9 @@ export type WindowEvents = {
34
34
  export type AppEvents = {
35
35
  ready: void;
36
36
  "window-all-closed": void;
37
+ /** A deep-link URL (a registered `urlSchemes` scheme) opened the app, or
38
+ * arrived while it was running. Includes the launch URL. */
39
+ "open-url": string;
37
40
  };
38
41
 
39
42
  /** A window's frame in screen points (bottom-left origin, like AppKit). */
@@ -357,6 +360,11 @@ export function wireAppEvents(): void {
357
360
 
358
361
  onNativeEvent("window.all-closed", () => app._emit("window-all-closed", undefined));
359
362
 
363
+ onNativeEvent("app.open-url", (event: NativeEvent) => {
364
+ const url = event.url;
365
+ if (typeof url === "string") app._emit("open-url", url);
366
+ });
367
+
360
368
  onNativeEvent("window.material", (event: NativeEvent) => {
361
369
  const id = event.id as number | undefined;
362
370
  if (id == null) return;
package/src/config.ts CHANGED
@@ -121,6 +121,14 @@ export interface MirinConfig {
121
121
  * app worker owns AppKit/CEF (see docs/architecture.md).
122
122
  */
123
123
  workers?: Record<string, string>;
124
+ /**
125
+ * Custom URL schemes this app registers as a handler for (macOS
126
+ * `CFBundleURLTypes`), e.g. `["anko"]` so `anko://…` links launch the app (or
127
+ * focus it if already running). Incoming URLs are delivered to
128
+ * `app.on("open-url", (url) => …)` — including the URL the app was launched
129
+ * with. Scheme names should be lowercase letters/digits (no `://`).
130
+ */
131
+ urlSchemes?: string[];
124
132
  windows: Record<string, WindowConfig>;
125
133
  }
126
134