@aippy/runtime 0.2.3 → 0.2.4-dev.3

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.
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export { patchAudioContext } from './patchAudioContext';
10
10
  export type { AudioContextPatchOptions, AutoPauseOptions, MediaElementType, PatchedAudioContext, } from './types';
11
- export { createHiddenMediaElement, createHiddenVideoElement, isIOSDevice, isMediaStreamAudioSupported, } from './utils';
11
+ export { createHiddenMediaElement, createHiddenVideoElement, isMediaStreamAudioSupported, } from './utils';
12
12
  export { useAudioContext } from './useAudioContext';
13
13
  export type { UseAudioContextOptions, UseAudioContextReturn } from './useAudioContext';
14
+ export { isIOSDevice } from './utils';
@@ -1,4 +1,4 @@
1
- import { c as i, a as t, i as d, b as o, p as s, u as n } from "../useAudioContext-BKgy28A1.js";
1
+ import { c as i, a as t, b as d, i as o, p as s, u as n } from "../useAudioContext-CNQQSTab.js";
2
2
  export {
3
3
  i as createHiddenMediaElement,
4
4
  t as createHiddenVideoElement,
@@ -2,3 +2,4 @@ export * from './types';
2
2
  export * from './config';
3
3
  export * from './errors';
4
4
  export * from './version';
5
+ export * from './runtime';
@@ -1,45 +1,49 @@
1
- import { A as d, E as v, c as _ } from "../errors-CDEBaBxB.js";
2
- const o = {
1
+ import { a as d, A as f, C as u, E as A, R as _, b as m, c as R } from "../runtime-DOnodF_1.js";
2
+ const s = {
3
3
  mode: "development",
4
4
  debug: !1,
5
5
  apiBaseUrl: void 0,
6
6
  headers: {}
7
7
  };
8
- function r() {
8
+ function o() {
9
9
  const e = {};
10
10
  return typeof process < "u" && process.env && (process.env.NODE_ENV && (e.mode = process.env.NODE_ENV), process.env.AIPPY_DEBUG && (e.debug = process.env.AIPPY_DEBUG === "true"), process.env.AIPPY_API_BASE_URL && (e.apiBaseUrl = process.env.AIPPY_API_BASE_URL)), e;
11
11
  }
12
- function a(e) {
13
- const n = r();
12
+ function c(e) {
13
+ const n = o();
14
14
  return {
15
- ...o,
15
+ ...s,
16
16
  ...n,
17
17
  ...e,
18
18
  headers: {
19
- ...o.headers,
19
+ ...s.headers,
20
20
  ...n.headers,
21
21
  ...e?.headers
22
22
  }
23
23
  };
24
24
  }
25
- const s = "0.2.3", t = {
26
- version: s
27
- }, i = t.version, c = "@aippy/runtime";
25
+ const r = "0.2.4-dev.3", i = {
26
+ version: r
27
+ }, a = i.version, t = "@aippy/runtime";
28
28
  function p() {
29
29
  return {
30
- name: c,
31
- version: i,
30
+ name: t,
31
+ version: a,
32
32
  buildTime: (/* @__PURE__ */ new Date()).toISOString()
33
33
  };
34
34
  }
35
35
  export {
36
- d as AippyRuntimeError,
37
- o as DEFAULT_CONFIG,
38
- v as ERROR_CODES,
39
- c as SDK_NAME,
40
- i as VERSION,
41
- _ as createError,
42
- r as getConfigFromEnv,
36
+ d as AippyRuntime,
37
+ f as AippyRuntimeError,
38
+ u as Cancellable,
39
+ s as DEFAULT_CONFIG,
40
+ A as ERROR_CODES,
41
+ _ as ReceiveChannel,
42
+ t as SDK_NAME,
43
+ a as VERSION,
44
+ m as aippyRuntime,
45
+ R as createError,
46
+ o as getConfigFromEnv,
43
47
  p as getVersionInfo,
44
- a as mergeConfig
48
+ c as mergeConfig
45
49
  };
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Aippy Runtime - Unified runtime for native bridge communication
3
+ */
4
+ /**
5
+ * Cancellable class - For managing subscriptions
6
+ */
7
+ export declare class Cancellable {
8
+ private cancelFn?;
9
+ private cancelled;
10
+ constructor(cancelFn?: (() => void) | undefined);
11
+ cancel(): void;
12
+ get isCancelled(): boolean;
13
+ }
14
+ /**
15
+ * ReceiveChannel - Manages message receiving and subscription
16
+ */
17
+ export declare class ReceiveChannel {
18
+ private emitter;
19
+ /**
20
+ * Emit a message to subscribers
21
+ */
22
+ emit(message: {
23
+ endpoint: string;
24
+ payload: any;
25
+ }): void;
26
+ /**
27
+ * Subscribe to messages on a specific endpoint
28
+ */
29
+ subscribe(endpoint: string, callback: (payload: any) => void): Cancellable;
30
+ /**
31
+ * Subscribe to a single message (auto-unsubscribe after first message)
32
+ */
33
+ once(endpoint: string, callback: (payload: any) => void): Cancellable;
34
+ }
35
+ /**
36
+ * AippyRuntime - Main runtime class for native bridge communication
37
+ */
38
+ export declare class AippyRuntime {
39
+ receiveChannel: ReceiveChannel;
40
+ private seq;
41
+ /**
42
+ * Receive message from native layer
43
+ * Called by native code via: window.aippyRuntime.receiveMessage(message)
44
+ */
45
+ receiveMessage(message: {
46
+ endpoint: string;
47
+ payload: any;
48
+ }): Promise<void>;
49
+ /**
50
+ * Create a subscription to native events
51
+ * @param handler - WebKit message handler (e.g., deviceMotionHandler)
52
+ * @param subscribePayload - Subscription parameters (e.g., { type: "motion" })
53
+ * @param callback - Callback to handle received data
54
+ * @returns Cancellable subscription
55
+ */
56
+ createSubscription(handler: any, subscribePayload: any, callback: (data: any) => void): Cancellable;
57
+ /**
58
+ * Make a subscription message with unique endpoint
59
+ */
60
+ private makeSubscriptionMessage;
61
+ /**
62
+ * Add motion listener (convenience method)
63
+ * @param callback - Callback to handle motion data
64
+ * @returns Cleanup function
65
+ */
66
+ addMotionListener(callback: (data: any) => void): () => void;
67
+ }
68
+ /**
69
+ * Global runtime instance - Singleton pattern
70
+ */
71
+ export declare const aippyRuntime: AippyRuntime;