react-native-worklets 0.8.2 → 0.8.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.
- package/lib/module/WorkletsModule/NativeWorklets.js +4 -0
- package/lib/module/WorkletsModule/NativeWorklets.js.map +1 -0
- package/lib/module/WorkletsModule/NativeWorklets.native.js +152 -0
- package/lib/module/WorkletsModule/NativeWorklets.native.js.map +1 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js +4 -0
- package/lib/module/WorkletsModule/workletsModuleProxy.js.map +1 -0
- package/lib/module/bundleMode/metroOverrides.native.js +115 -0
- package/lib/module/bundleMode/metroOverrides.native.js.map +1 -0
- package/lib/module/bundleMode/network.native.js +41 -0
- package/lib/module/bundleMode/network.native.js.map +1 -0
- package/lib/module/callGuard.native.js +30 -0
- package/lib/module/callGuard.native.js.map +1 -0
- package/lib/module/debug/WorkletsError.js +12 -0
- package/lib/module/debug/WorkletsError.js.map +1 -0
- package/lib/module/debug/WorkletsError.native.js +27 -0
- package/lib/module/debug/WorkletsError.native.js.map +1 -0
- package/lib/module/debug/checkCppVersion.js +30 -0
- package/lib/module/debug/checkCppVersion.js.map +1 -0
- package/lib/module/debug/errors.native.js +69 -0
- package/lib/module/debug/errors.native.js.map +1 -0
- package/lib/module/debug/jsVersion.js +9 -0
- package/lib/module/debug/jsVersion.js.map +1 -0
- package/lib/module/debug/logger.js +15 -0
- package/lib/module/debug/logger.js.map +1 -0
- package/lib/module/debug/types.js +2 -0
- package/lib/module/debug/types.js.map +1 -0
- package/lib/module/deprecated.js +27 -0
- package/lib/module/deprecated.js.map +1 -0
- package/lib/module/featureFlags/featureFlags.js +12 -0
- package/lib/module/featureFlags/featureFlags.js.map +1 -0
- package/lib/module/featureFlags/featureFlags.native.js +51 -0
- package/lib/module/featureFlags/featureFlags.native.js.map +1 -0
- package/lib/module/featureFlags/staticFlags.json +5 -0
- package/lib/module/featureFlags/types.js +13 -0
- package/lib/module/featureFlags/types.js.map +1 -0
- package/lib/module/guardImplementation.native.js +17 -0
- package/lib/module/guardImplementation.native.js.map +1 -0
- package/lib/module/index.js +28 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initializers/initializers.js +24 -0
- package/lib/module/initializers/initializers.js.map +1 -0
- package/lib/module/initializers/initializers.native.js +174 -0
- package/lib/module/initializers/initializers.native.js.map +1 -0
- package/lib/module/initializers/workletRuntimeEntry.js +6 -0
- package/lib/module/initializers/workletRuntimeEntry.js.map +1 -0
- package/lib/module/initializers/workletRuntimeEntry.native.js +37 -0
- package/lib/module/initializers/workletRuntimeEntry.native.js.map +1 -0
- package/lib/module/memory/bundleUnpacker.native.js +47 -0
- package/lib/module/memory/bundleUnpacker.native.js.map +1 -0
- package/lib/module/memory/customSerializableUnpacker.native.js +18 -0
- package/lib/module/memory/customSerializableUnpacker.native.js.map +1 -0
- package/lib/module/memory/isShareable.js +8 -0
- package/lib/module/memory/isShareable.js.map +1 -0
- package/lib/module/memory/isSynchronizable.js +8 -0
- package/lib/module/memory/isSynchronizable.js.map +1 -0
- package/lib/module/memory/serializable.js +18 -0
- package/lib/module/memory/serializable.js.map +1 -0
- package/lib/module/memory/serializable.native.js +642 -0
- package/lib/module/memory/serializable.native.js.map +1 -0
- package/lib/module/memory/serializableMappingCache.js +11 -0
- package/lib/module/memory/serializableMappingCache.js.map +1 -0
- package/lib/module/memory/serializableMappingCache.native.js +29 -0
- package/lib/module/memory/serializableMappingCache.native.js.map +1 -0
- package/lib/module/memory/shareable.js +28 -0
- package/lib/module/memory/shareable.js.map +1 -0
- package/lib/module/memory/shareable.native.js +53 -0
- package/lib/module/memory/shareable.native.js.map +1 -0
- package/lib/module/memory/shareableGuestUnpacker.native.js +96 -0
- package/lib/module/memory/shareableGuestUnpacker.native.js.map +1 -0
- package/lib/module/memory/shareableHostUnpacker.native.js +18 -0
- package/lib/module/memory/shareableHostUnpacker.native.js.map +1 -0
- package/lib/module/memory/synchronizable.js +7 -0
- package/lib/module/memory/synchronizable.js.map +1 -0
- package/lib/module/memory/synchronizable.native.js +9 -0
- package/lib/module/memory/synchronizable.native.js.map +1 -0
- package/lib/module/memory/synchronizableUnpacker.native.js +42 -0
- package/lib/module/memory/synchronizableUnpacker.native.js.map +1 -0
- package/lib/module/memory/types.js +12 -0
- package/lib/module/memory/types.js.map +1 -0
- package/lib/module/memory/valueUnpacker.native.js +61 -0
- package/lib/module/memory/valueUnpacker.native.js.map +1 -0
- package/lib/module/mock.js +85 -0
- package/lib/module/mock.js.map +1 -0
- package/lib/module/platformChecker.js +8 -0
- package/lib/module/platformChecker.js.map +1 -0
- package/lib/module/platformChecker.native.js +4 -0
- package/lib/module/platformChecker.native.js.map +1 -0
- package/lib/module/privateGlobals.d.js +6 -0
- package/lib/module/privateGlobals.d.js.map +1 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js +15 -0
- package/lib/module/runLoop/common/setImmediatePolyfill.js.map +1 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js +26 -0
- package/lib/module/runLoop/common/setIntervalPolyfill.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js +10 -0
- package/lib/module/runLoop/uiRuntime/mockedRequestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js +63 -0
- package/lib/module/runLoop/uiRuntime/requestAnimationFrame.js.map +1 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js +32 -0
- package/lib/module/runLoop/uiRuntime/setTimeoutPolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/index.js +19 -0
- package/lib/module/runLoop/workletRuntime/index.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js +11 -0
- package/lib/module/runLoop/workletRuntime/queueMicrotask.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js +48 -0
- package/lib/module/runLoop/workletRuntime/requestAnimationFramePolyfill.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js +28 -0
- package/lib/module/runLoop/workletRuntime/setTimeout.js.map +1 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js +37 -0
- package/lib/module/runLoop/workletRuntime/taskQueue.js.map +1 -0
- package/lib/module/runtimeKind.js +92 -0
- package/lib/module/runtimeKind.js.map +1 -0
- package/lib/module/runtimes.js +33 -0
- package/lib/module/runtimes.js.map +1 -0
- package/lib/module/runtimes.native.js +331 -0
- package/lib/module/runtimes.native.js.map +1 -0
- package/lib/module/specs/NativeWorkletsModule.js +5 -0
- package/lib/module/specs/NativeWorkletsModule.js.map +1 -0
- package/lib/module/specs/index.js +10 -0
- package/lib/module/specs/index.js.map +1 -0
- package/lib/module/threads.js +61 -0
- package/lib/module/threads.js.map +1 -0
- package/lib/module/threads.native.js +290 -0
- package/lib/module/threads.native.js.map +1 -0
- package/lib/module/types.js +5 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/workletFunction.js +36 -0
- package/lib/module/workletFunction.js.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts +4 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts +3 -0
- package/lib/typescript/WorkletsModule/NativeWorklets.native.d.ts.map +1 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts +45 -0
- package/lib/typescript/WorkletsModule/workletsModuleProxy.d.ts.map +1 -0
- package/lib/typescript/bundleMode/metroOverrides.native.d.ts +28 -0
- package/lib/typescript/bundleMode/metroOverrides.native.d.ts.map +1 -0
- package/lib/typescript/bundleMode/network.native.d.ts +7 -0
- package/lib/typescript/bundleMode/network.native.d.ts.map +1 -0
- package/lib/typescript/callGuard.native.d.ts +4 -0
- package/lib/typescript/callGuard.native.d.ts.map +1 -0
- package/lib/typescript/debug/WorkletsError.d.ts +3 -0
- package/lib/typescript/debug/WorkletsError.d.ts.map +1 -0
- package/lib/typescript/debug/WorkletsError.native.d.ts +8 -0
- package/lib/typescript/debug/WorkletsError.native.d.ts.map +1 -0
- package/lib/typescript/debug/checkCppVersion.d.ts +3 -0
- package/lib/typescript/debug/checkCppVersion.d.ts.map +1 -0
- package/lib/typescript/debug/errors.native.d.ts +16 -0
- package/lib/typescript/debug/errors.native.d.ts.map +1 -0
- package/lib/typescript/debug/jsVersion.d.ts +7 -0
- package/lib/typescript/debug/jsVersion.d.ts.map +1 -0
- package/lib/typescript/debug/logger.d.ts +5 -0
- package/lib/typescript/debug/logger.d.ts.map +1 -0
- package/lib/typescript/debug/types.d.ts +9 -0
- package/lib/typescript/debug/types.d.ts.map +1 -0
- package/lib/typescript/deprecated.d.ts +19 -0
- package/lib/typescript/deprecated.d.ts.map +1 -0
- package/lib/typescript/featureFlags/featureFlags.d.ts +5 -0
- package/lib/typescript/featureFlags/featureFlags.d.ts.map +1 -0
- package/lib/typescript/featureFlags/featureFlags.native.d.ts +6 -0
- package/lib/typescript/featureFlags/featureFlags.native.d.ts.map +1 -0
- package/lib/typescript/featureFlags/types.d.ts +21 -0
- package/lib/typescript/featureFlags/types.d.ts.map +1 -0
- package/lib/typescript/guardImplementation.native.d.ts +2 -0
- package/lib/typescript/guardImplementation.native.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +17 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/initializers/initializers.d.ts +2 -0
- package/lib/typescript/initializers/initializers.d.ts.map +1 -0
- package/lib/typescript/initializers/initializers.native.d.ts +18 -0
- package/lib/typescript/initializers/initializers.native.d.ts.map +1 -0
- package/lib/typescript/initializers/workletRuntimeEntry.d.ts +2 -0
- package/lib/typescript/initializers/workletRuntimeEntry.d.ts.map +1 -0
- package/lib/typescript/initializers/workletRuntimeEntry.native.d.ts +14 -0
- package/lib/typescript/initializers/workletRuntimeEntry.native.d.ts.map +1 -0
- package/lib/typescript/memory/bundleUnpacker.native.d.ts +7 -0
- package/lib/typescript/memory/bundleUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/customSerializableUnpacker.native.d.ts +3 -0
- package/lib/typescript/memory/customSerializableUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/isShareable.d.ts +3 -0
- package/lib/typescript/memory/isShareable.d.ts.map +1 -0
- package/lib/typescript/memory/isSynchronizable.d.ts +3 -0
- package/lib/typescript/memory/isSynchronizable.d.ts.map +1 -0
- package/lib/typescript/memory/serializable.d.ts +7 -0
- package/lib/typescript/memory/serializable.d.ts.map +1 -0
- package/lib/typescript/memory/serializable.native.d.ts +37 -0
- package/lib/typescript/memory/serializable.native.d.ts.map +1 -0
- package/lib/typescript/memory/serializableMappingCache.d.ts +6 -0
- package/lib/typescript/memory/serializableMappingCache.d.ts.map +1 -0
- package/lib/typescript/memory/serializableMappingCache.native.d.ts +13 -0
- package/lib/typescript/memory/serializableMappingCache.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareable.d.ts +23 -0
- package/lib/typescript/memory/shareable.d.ts.map +1 -0
- package/lib/typescript/memory/shareable.native.d.ts +23 -0
- package/lib/typescript/memory/shareable.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/shareableGuestUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/shareableHostUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/shareableHostUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizable.d.ts +3 -0
- package/lib/typescript/memory/synchronizable.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizable.native.d.ts +3 -0
- package/lib/typescript/memory/synchronizable.native.d.ts.map +1 -0
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts +4 -0
- package/lib/typescript/memory/synchronizableUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/memory/types.d.ts +132 -0
- package/lib/typescript/memory/types.d.ts.map +1 -0
- package/lib/typescript/memory/valueUnpacker.native.d.ts +6 -0
- package/lib/typescript/memory/valueUnpacker.native.d.ts.map +1 -0
- package/lib/typescript/mock.d.ts +2 -0
- package/lib/typescript/mock.d.ts.map +1 -0
- package/lib/typescript/platformChecker.d.ts +5 -0
- package/lib/typescript/platformChecker.d.ts.map +1 -0
- package/lib/typescript/platformChecker.native.d.ts +2 -0
- package/lib/typescript/platformChecker.native.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setImmediatePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/common/setIntervalPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts +6 -0
- package/lib/typescript/runLoop/uiRuntime/mockedRequestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/requestAnimationFrame.d.ts.map +1 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/uiRuntime/setTimeoutPolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/index.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/queueMicrotask.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/requestAnimationFramePolyfill.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts +2 -0
- package/lib/typescript/runLoop/workletRuntime/setTimeout.d.ts.map +1 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts +10 -0
- package/lib/typescript/runLoop/workletRuntime/taskQueue.d.ts.map +1 -0
- package/lib/typescript/runtimeKind.d.ts +56 -0
- package/lib/typescript/runtimeKind.d.ts.map +1 -0
- package/lib/typescript/runtimes.d.ts +14 -0
- package/lib/typescript/runtimes.d.ts.map +1 -0
- package/lib/typescript/runtimes.native.d.ts +137 -0
- package/lib/typescript/runtimes.native.d.ts.map +1 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts +7 -0
- package/lib/typescript/specs/NativeWorkletsModule.d.ts.map +1 -0
- package/lib/typescript/specs/index.d.ts +3 -0
- package/lib/typescript/specs/index.d.ts.map +1 -0
- package/lib/typescript/threads.d.ts +8 -0
- package/lib/typescript/threads.d.ts.map +1 -0
- package/lib/typescript/threads.native.d.ts +132 -0
- package/lib/typescript/threads.native.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +127 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/workletFunction.d.ts +26 -0
- package/lib/typescript/workletFunction.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/debug/jsVersion.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestAnimationFramePolyfill.d.ts","sourceRoot":"","sources":["../../../../src/runLoop/workletRuntime/requestAnimationFramePolyfill.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,CAAC,yBAAyB,EAAE,MAAM,QA0D3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setTimeout.d.ts","sourceRoot":"","sources":["../../../../src/runLoop/workletRuntime/setTimeout.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,SAgC9B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Callback = () => void;
|
|
2
|
+
export type Queue = {
|
|
3
|
+
microtasks: Array<Callback>;
|
|
4
|
+
timeoutCallbacks: Map<number, Callback>;
|
|
5
|
+
};
|
|
6
|
+
export declare function setupTaskQueue(): void;
|
|
7
|
+
export declare function pushMicrotask(callback: Callback): void;
|
|
8
|
+
export declare function pushTask(callback: Callback, handlerId: number, delay: number): void;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=taskQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskQueue.d.ts","sourceRoot":"","sources":["../../../../src/runLoop/workletRuntime/taskQueue.ts"],"names":[],"mappings":"AAEA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,MAAM,MAAM,KAAK,GAAG;IAClB,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACzC,CAAC;AAEF,wBAAgB,cAAc,SAqB7B;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,QAI/C;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAK5E"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare enum RuntimeKind {
|
|
2
|
+
/**
|
|
3
|
+
* The React Native runtime, which is the main runtime for React Native where
|
|
4
|
+
* React exists and where components are rendered.
|
|
5
|
+
*/
|
|
6
|
+
ReactNative = 1,
|
|
7
|
+
/**
|
|
8
|
+
* The UI runtime, which is a special runtime that executes on the UI thread,
|
|
9
|
+
* mostly used for animations and gestures.
|
|
10
|
+
*/
|
|
11
|
+
UI = 2,
|
|
12
|
+
/** Additional runtime created on-demand by the user. */
|
|
13
|
+
Worker = 3
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Programmatic way to check the current runtime kind. It's useful when you need
|
|
17
|
+
* specific implementations for different runtimes created by Worklets.
|
|
18
|
+
*
|
|
19
|
+
* For more optimized calls you can check the value of
|
|
20
|
+
* `globalThis.__RUNTIME_KIND` directly.
|
|
21
|
+
*
|
|
22
|
+
* @returns The kind of the current runtime.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getRuntimeKind(): RuntimeKind;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the current runtime is the [React Native
|
|
27
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#rn-runtime).
|
|
28
|
+
*
|
|
29
|
+
* @returns `true` if the current runtime is the React Native Runtime, `false`
|
|
30
|
+
* otherwise.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isRNRuntime(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the current runtime is a [Worklet
|
|
35
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#worklet-runtime).
|
|
36
|
+
*
|
|
37
|
+
* @returns `true` if the current runtime is a Worklet Runtime, `false`
|
|
38
|
+
* otherwise.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isWorkletRuntime(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if the current runtime is the [UI
|
|
43
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#ui-runtime).
|
|
44
|
+
*
|
|
45
|
+
* @returns `true` if the current runtime is the UI Runtime, `false` otherwise.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isUIRuntime(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Checks if the current runtime is a [Worker
|
|
50
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds/#worker-runtime).
|
|
51
|
+
*
|
|
52
|
+
* @returns `true` if the current runtime is a Worker Runtime, `false`
|
|
53
|
+
* otherwise.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isWorkerRuntime(): boolean;
|
|
56
|
+
//# sourceMappingURL=runtimeKind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeKind.d.ts","sourceRoot":"","sources":["../../src/runtimeKind.ts"],"names":[],"mappings":"AAEA,oBAAY,WAAW;IACrB;;;OAGG;IACH,WAAW,IAAI;IACf;;;OAGG;IACH,EAAE,IAAI;IACN,wDAAwD;IACxD,MAAM,IAAI;CACX;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAGrC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAG1C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAGrC;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RuntimeKind } from './runtimeKind';
|
|
2
|
+
import type { WorkletFunction, WorkletRuntime, WorkletRuntimeConfig } from './types';
|
|
3
|
+
export declare const UIRuntimeId = RuntimeKind.UI;
|
|
4
|
+
export declare function createWorkletRuntime(config?: WorkletRuntimeConfig): WorkletRuntime;
|
|
5
|
+
export declare function createWorkletRuntime(name?: string, initializer?: () => void): WorkletRuntime;
|
|
6
|
+
export declare function runOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue): WorkletFunction<Args, ReturnValue>;
|
|
7
|
+
export declare function scheduleOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
8
|
+
export declare function scheduleOnRuntimeWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
9
|
+
export declare function runOnRuntimeSync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
|
|
10
|
+
export declare function runOnRuntimeSyncWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
|
|
11
|
+
export declare function runOnRuntimeAsync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
|
|
12
|
+
export declare function getUIRuntimeHolder(): object;
|
|
13
|
+
export declare function getUISchedulerHolder(): object;
|
|
14
|
+
//# sourceMappingURL=runtimes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimes.d.ts","sourceRoot":"","sources":["../../src/runtimes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAE1C,wBAAgB,oBAAoB,CAClC,MAAM,CAAC,EAAE,oBAAoB,GAC5B,cAAc,CAAC;AAElB,wBAAgB,oBAAoB,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,cAAc,CAAC;AAMlB,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAMtC,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAMR,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAMR,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAClE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAMf,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAMf,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AAMxB,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { WorkletFunction, WorkletRuntime, WorkletRuntimeConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The ID of the [UI Worklet
|
|
4
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
5
|
+
*/
|
|
6
|
+
export declare const UIRuntimeId: 2;
|
|
7
|
+
/**
|
|
8
|
+
* Lets you create a new JS runtime which can be used to run worklets possibly
|
|
9
|
+
* on different threads than JS or UI thread.
|
|
10
|
+
*
|
|
11
|
+
* @param config - Runtime configuration object - {@link WorkletRuntimeConfig}.
|
|
12
|
+
* @returns WorkletRuntime which is a
|
|
13
|
+
* `jsi::HostObject<worklets::WorkletRuntime>` - {@link WorkletRuntime}
|
|
14
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/createWorkletRuntime/
|
|
15
|
+
*/
|
|
16
|
+
export declare function createWorkletRuntime(config?: WorkletRuntimeConfig): WorkletRuntime;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Please use the new config object signature instead:
|
|
19
|
+
* `createWorkletRuntime({ name, initializer })`
|
|
20
|
+
*
|
|
21
|
+
* Lets you create a new JS runtime which can be used to run worklets possibly
|
|
22
|
+
* on different threads than JS or UI thread.
|
|
23
|
+
* @param name - A name used to identify the runtime which will appear in
|
|
24
|
+
* devices list in Chrome DevTools.
|
|
25
|
+
* @param initializer - An optional worklet that will be run synchronously on
|
|
26
|
+
* the same thread immediately after the runtime is created.
|
|
27
|
+
* @returns WorkletRuntime which is a
|
|
28
|
+
* `jsi::HostObject<worklets::WorkletRuntime>` - {@link WorkletRuntime}
|
|
29
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/createWorkletRuntime/
|
|
30
|
+
*/
|
|
31
|
+
export declare function createWorkletRuntime(name?: string, initializer?: () => void): WorkletRuntime;
|
|
32
|
+
/**
|
|
33
|
+
* Lets you asynchronously run a
|
|
34
|
+
* [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
|
|
35
|
+
* on a [Worker
|
|
36
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime).
|
|
37
|
+
*
|
|
38
|
+
* Check
|
|
39
|
+
* {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
|
|
40
|
+
* for more information about the different runtime kinds.
|
|
41
|
+
*
|
|
42
|
+
* - The worklet is scheduled on the Worker Runtime's [Async
|
|
43
|
+
* Queue](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/Common/cpp/worklets/RunLoop/AsyncQueue.h)
|
|
44
|
+
*
|
|
45
|
+
* @param workletRuntime - The runtime to schedule the worklet on.
|
|
46
|
+
* @param worklet - The worklet to schedule.
|
|
47
|
+
* @param args - The arguments to pass to the worklet.
|
|
48
|
+
* @returns The return value of the worklet.
|
|
49
|
+
*/
|
|
50
|
+
export declare function scheduleOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
51
|
+
/**
|
|
52
|
+
* Lets you asynchronously run a
|
|
53
|
+
* [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
|
|
54
|
+
* on a [Worker
|
|
55
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime)
|
|
56
|
+
* identified by the runtime's id.
|
|
57
|
+
*
|
|
58
|
+
* Check
|
|
59
|
+
* {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
|
|
60
|
+
* for more information about the different runtime kinds.
|
|
61
|
+
*
|
|
62
|
+
* - The worklet is scheduled on the Worker Runtime's [Async
|
|
63
|
+
* Queue](https://github.com/software-mansion/react-native-reanimated/blob/main/packages/react-native-worklets/Common/cpp/worklets/RunLoop/AsyncQueue.h)
|
|
64
|
+
*
|
|
65
|
+
* @param runtimeId - The id of the runtime to schedule the worklet on.
|
|
66
|
+
* @param worklet - The worklet to schedule.
|
|
67
|
+
* @param args - The arguments to pass to the worklet.
|
|
68
|
+
* @returns The return value of the worklet.
|
|
69
|
+
*/
|
|
70
|
+
export declare function scheduleOnRuntimeWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Use `scheduleOnRuntime` instead.
|
|
73
|
+
*
|
|
74
|
+
* Schedule a worklet to execute on the background queue.
|
|
75
|
+
*/
|
|
76
|
+
export declare function runOnRuntime<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue): WorkletFunction<Args, ReturnValue>;
|
|
77
|
+
/**
|
|
78
|
+
* Lets you run a function synchronously on a [Worker
|
|
79
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime).
|
|
80
|
+
*
|
|
81
|
+
* - This function cannot be called from the [UI
|
|
82
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
83
|
+
* or another [Worker
|
|
84
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime),
|
|
85
|
+
* unless the [Bundle
|
|
86
|
+
* Mode](https://docs.swmansion.com/react-native-worklets/docs/bundleMode/) is
|
|
87
|
+
* enabled.
|
|
88
|
+
*
|
|
89
|
+
* @param workletRuntime - The runtime to run the worklet on.
|
|
90
|
+
* @param worklet - The worklet to run.
|
|
91
|
+
* @param args - The arguments to pass to the worklet.
|
|
92
|
+
* @returns The return value of the worklet.
|
|
93
|
+
*/
|
|
94
|
+
export declare function runOnRuntimeSync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
|
|
95
|
+
/**
|
|
96
|
+
* Lets you run a function synchronously on a [Worklet
|
|
97
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worklet-runtime)
|
|
98
|
+
* identified by the runtime's id.
|
|
99
|
+
*
|
|
100
|
+
* - This function cannot be called from the [UI
|
|
101
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime)
|
|
102
|
+
* or a [Worker
|
|
103
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime),
|
|
104
|
+
* unless the [Bundle
|
|
105
|
+
* Mode](https://docs.swmansion.com/react-native-worklets/docs/bundleMode/) is
|
|
106
|
+
* enabled.
|
|
107
|
+
* - You can target the UI Runtime with this function by passing
|
|
108
|
+
* {@link UIRuntimeId} as the `runtimeId` argument.
|
|
109
|
+
*
|
|
110
|
+
* @param runtimeId - The id of the runtime to run the worklet on.
|
|
111
|
+
* @param worklet - The worklet to run.
|
|
112
|
+
* @param args - The arguments to pass to the worklet.
|
|
113
|
+
* @returns The return value of the worklet.
|
|
114
|
+
*/
|
|
115
|
+
export declare function runOnRuntimeSyncWithId<Args extends unknown[], ReturnValue>(runtimeId: number, worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
|
|
116
|
+
/**
|
|
117
|
+
* Lets you asynchronously run a
|
|
118
|
+
* [worklet](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#worklet)
|
|
119
|
+
* on a [Worker
|
|
120
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime)
|
|
121
|
+
* and get the result via a Promise.
|
|
122
|
+
*
|
|
123
|
+
* - The worklet is scheduled on the Worker Runtime's Async Queue
|
|
124
|
+
* - Returns a Promise that resolves with the worklet's return value
|
|
125
|
+
* - This function can only be called from the [RN
|
|
126
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#rn-runtime).
|
|
127
|
+
*
|
|
128
|
+
* @param workletRuntime - The runtime to run the worklet on.
|
|
129
|
+
* @param worklet - The worklet to run.
|
|
130
|
+
* @param args - The arguments to pass to the worklet.
|
|
131
|
+
* @returns A Promise that resolves to the return value of the worklet.
|
|
132
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnRuntimeAsync
|
|
133
|
+
*/
|
|
134
|
+
export declare function runOnRuntimeAsync<Args extends unknown[], ReturnValue>(workletRuntime: WorkletRuntime, worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
|
|
135
|
+
export declare function getUIRuntimeHolder(): object;
|
|
136
|
+
export declare function getUISchedulerHolder(): object;
|
|
137
|
+
//# sourceMappingURL=runtimes.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimes.native.d.ts","sourceRoot":"","sources":["../../src/runtimes.native.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAIjB;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAqB,CAAC,CAAC;AAE/C;;;;;;;;GAQG;AAEH,wBAAgB,oBAAoB,CAClC,MAAM,CAAC,EAAE,oBAAoB,GAC5B,cAAc,CAAC;AAElB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,IAAI,GACvB,cAAc,CAAC;AAsDlB;;;;;;;;;;;;;;;;;GAiBG;AAGH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAoDR;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AAoDR;;;;GAIG;AAGH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAmBtC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAClE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAeb;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAuBf;;;;;;;;;;;;;;;;;GAiBG;AAGH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACnE,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAAC;AAyDxB,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TurboModule } from 'react-native';
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
installTurboModule: (bundleModeEnabled: boolean) => boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: Spec | null;
|
|
6
|
+
export default _default;
|
|
7
|
+
//# sourceMappingURL=NativeWorkletsModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeWorkletsModule.d.ts","sourceRoot":"","sources":["../../../src/specs/NativeWorkletsModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,OAAO,KAAK,OAAO,CAAC;CAC7D;;AAED,wBAA+D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/specs/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,eAAO,MAAM,mBAAmB,EAAE,IAAI,GAAG,IAAI,GAAG,SAMtC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function scheduleOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
2
|
+
export declare function runOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => void;
|
|
3
|
+
export declare function runOnUISync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
|
|
4
|
+
export declare function executeOnUIRuntimeSync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => ReturnValue;
|
|
5
|
+
export declare function runOnJS<Args extends unknown[], ReturnValue>(fun: (...args: Args) => ReturnValue): (...args: Args) => void;
|
|
6
|
+
export declare function scheduleOnRN<Args extends unknown[], ReturnValue>(fun: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
7
|
+
export declare function runOnUIAsync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
|
|
8
|
+
//# sourceMappingURL=threads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.d.ts","sourceRoot":"","sources":["../../src/threads.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAEN;AAED,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAIzB;AAED,wBAAgB,WAAW,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC7D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAMf,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;AAMlC,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GAClC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAEzB;AAED,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACnC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAMN;AAED,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAItB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { WorkletFunction } from './types';
|
|
2
|
+
export declare function setupMicrotasks(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Lets you schedule a function to be executed on the [UI
|
|
5
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
6
|
+
*
|
|
7
|
+
* - The callback executes asynchronously and doesn't return a value.
|
|
8
|
+
* - Passed function and args are automatically
|
|
9
|
+
* [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
|
|
10
|
+
* and serialized.
|
|
11
|
+
* - This function cannot be called from the [UI
|
|
12
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime)
|
|
13
|
+
* or a [Worker
|
|
14
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime),
|
|
15
|
+
* unless you have the [Bundle Mode](/docs/bundleMode/) enabled.
|
|
16
|
+
*
|
|
17
|
+
* @param fun - A reference to a function you want to schedule on the [UI
|
|
18
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
19
|
+
* @param args - Arguments to pass to the function.
|
|
20
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/scheduleOnUI
|
|
21
|
+
*/
|
|
22
|
+
export declare function scheduleOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): void;
|
|
23
|
+
/**
|
|
24
|
+
* Lets you asynchronously run
|
|
25
|
+
* [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
|
|
26
|
+
* functions on the [UI
|
|
27
|
+
* thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/).
|
|
28
|
+
*
|
|
29
|
+
* This method does not schedule the work immediately but instead waits for
|
|
30
|
+
* other worklets to be scheduled within the same JS loop. It uses
|
|
31
|
+
* queueMicrotask to schedule all the worklets at once making sure they will run
|
|
32
|
+
* within the same frame boundaries on the UI thread.
|
|
33
|
+
*
|
|
34
|
+
* @param fun - A reference to a function you want to execute on the [UI
|
|
35
|
+
* thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/)
|
|
36
|
+
* from the [JavaScript
|
|
37
|
+
* thread](https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI/).
|
|
38
|
+
* @returns A function that accepts arguments for the function passed as the
|
|
39
|
+
* first argument.
|
|
40
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUI @deprecated Use `scheduleOnUI` instead.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runOnUI<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Lets you run a function synchronously on the [UI
|
|
45
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime)
|
|
46
|
+
* from the [RN
|
|
47
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#rn-runtime).
|
|
48
|
+
* Passed function and args are automatically
|
|
49
|
+
* [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
|
|
50
|
+
* and serialized.
|
|
51
|
+
*
|
|
52
|
+
* - This function cannot be called from the [UI
|
|
53
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
54
|
+
* - This function cannot be called from a [Worker
|
|
55
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#worker-runtime).
|
|
56
|
+
*
|
|
57
|
+
* @param fun - A reference to a function you want to execute on the [UI
|
|
58
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
59
|
+
* @param args - Arguments to pass to the function.
|
|
60
|
+
* @returns The return value of the function passed as the first argument.
|
|
61
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUISync
|
|
62
|
+
*/
|
|
63
|
+
export declare function runOnUISync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): ReturnValue;
|
|
64
|
+
export declare function executeOnUIRuntimeSync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue): (...args: Args) => ReturnValue;
|
|
65
|
+
type ReleaseRemoteFunction<Args extends unknown[], ReturnValue> = {
|
|
66
|
+
(...args: Args): ReturnValue;
|
|
67
|
+
};
|
|
68
|
+
type DevRemoteFunction<Args extends unknown[], ReturnValue> = {
|
|
69
|
+
__remoteFunction: (...args: Args) => ReturnValue;
|
|
70
|
+
};
|
|
71
|
+
type RemoteFunction<Args extends unknown[], ReturnValue> = ReleaseRemoteFunction<Args, ReturnValue> | DevRemoteFunction<Args, ReturnValue>;
|
|
72
|
+
/**
|
|
73
|
+
* Lets you schedule a function to be executed on the RN runtime from any
|
|
74
|
+
* runtime. Check
|
|
75
|
+
* {@link https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds}
|
|
76
|
+
* for more information about the different runtime kinds.
|
|
77
|
+
*
|
|
78
|
+
* Scheduling function from the RN Runtime (we are already on RN Runtime) simply
|
|
79
|
+
* uses `queueMicrotask`.
|
|
80
|
+
*
|
|
81
|
+
* When functions need to be scheduled from the UI Runtime, first function and
|
|
82
|
+
* args are serialized and then the system passes the scheduling responsibility
|
|
83
|
+
* to the JSScheduler. The JSScheduler then uses the RN CallInvoker to schedule
|
|
84
|
+
* the function asynchronously on the JavaScript thread by calling
|
|
85
|
+
* `jsCallInvoker_->invokeAsync()`.
|
|
86
|
+
*
|
|
87
|
+
* When called from a Worker Runtime, it uses the same JSScheduler mechanism.
|
|
88
|
+
*
|
|
89
|
+
* @param fun - A function you want to schedule on the RN runtime. A function
|
|
90
|
+
* can be a worklet, a remote function or a regular function.
|
|
91
|
+
* @param args - Arguments to pass to the function.
|
|
92
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/scheduleOnRN
|
|
93
|
+
*/
|
|
94
|
+
export declare function scheduleOnRN<Args extends unknown[], ReturnValue>(fun: ((...args: Args) => ReturnValue) | RemoteFunction<Args, ReturnValue> | WorkletFunction<Args, ReturnValue>, ...args: Args): void;
|
|
95
|
+
/**
|
|
96
|
+
* Lets you asynchronously run
|
|
97
|
+
* non-[workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
|
|
98
|
+
* functions that couldn't otherwise run on the [UI
|
|
99
|
+
* thread](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#ui-thread).
|
|
100
|
+
* This applies to most external libraries as they don't have their functions
|
|
101
|
+
* marked with "worklet"; directive.
|
|
102
|
+
*
|
|
103
|
+
* @param fun - A reference to a function you want to execute on the JavaScript
|
|
104
|
+
* thread from the UI thread.
|
|
105
|
+
* @returns A function that accepts arguments for the function passed as the
|
|
106
|
+
* first argument.
|
|
107
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnJS
|
|
108
|
+
*/
|
|
109
|
+
/** @deprecated Use `scheduleOnRN` instead. */
|
|
110
|
+
export declare function runOnJS<Args extends unknown[], ReturnValue>(fun: ((...args: Args) => ReturnValue) | RemoteFunction<Args, ReturnValue> | WorkletFunction<Args, ReturnValue>): (...args: Args) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Lets you asynchronously run
|
|
113
|
+
* [workletized](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#to-workletize)
|
|
114
|
+
* functions on the [UI
|
|
115
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
116
|
+
*
|
|
117
|
+
* This method does not schedule the work immediately but instead waits for
|
|
118
|
+
* other worklets to be scheduled within the same JS loop. It uses
|
|
119
|
+
* queueMicrotask to schedule all the worklets at once making sure they will run
|
|
120
|
+
* within the same frame boundaries on the UI thread.
|
|
121
|
+
*
|
|
122
|
+
* @param fun - A reference to a function you want to execute on the [UI
|
|
123
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/runtimeKinds#ui-runtime).
|
|
124
|
+
* from the [JavaScript
|
|
125
|
+
* Runtime](https://docs.swmansion.com/react-native-worklets/docs/fundamentals/glossary#javascript-runtime).
|
|
126
|
+
* @returns A promise that resolves to the return value of the function passed
|
|
127
|
+
* as the first argument.
|
|
128
|
+
* @see https://docs.swmansion.com/react-native-worklets/docs/threading/runOnUIAsync
|
|
129
|
+
*/
|
|
130
|
+
export declare function runOnUIAsync<Args extends unknown[], ReturnValue>(worklet: (...args: Args) => ReturnValue, ...args: Args): Promise<ReturnValue>;
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=threads.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"threads.native.d.ts","sourceRoot":"","sources":["../../src/threads.native.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAY9D,wBAAgB,eAAe,SA0B9B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC;AA0BR;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;AAiB3B;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,wBAAgB,WAAW,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC7D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,WAAW,CAAC;AAiBf,wBAAgB,sBAAsB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACxE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,GACtC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;AAUlC,KAAK,qBAAqB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,IAAI;IAChE,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,WAAW,CAAC;CAC9B,CAAC;AAEF,KAAK,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,IAAI;IAC5D,gBAAgB,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC;CAClD,CAAC;AAEF,KAAK,cAAc,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,IACnD,qBAAqB,CAAC,IAAI,EAAE,WAAW,CAAC,GACxC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAUzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,GAAG,EACC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,GAChC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,GACjC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,EACtC,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAmCN;AAED;;;;;;;;;;;;;GAaG;AACH,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EACzD,GAAG,EACC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,CAAC,GAChC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,GACjC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GACrC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAKzB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,WAAW,EAC9D,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,WAAW,EACvC,GAAG,IAAI,EAAE,IAAI,GACZ,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { RuntimeKind } from './runtimeKind';
|
|
2
|
+
/** Public globals to be exposed to the user. */
|
|
3
|
+
declare global {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use {@link __RUNTIME_KIND} instead.
|
|
6
|
+
*
|
|
7
|
+
* This global variable is a diagnostic/development tool.
|
|
8
|
+
*
|
|
9
|
+
* It's `true` on Worklet Runtimes and `false` on React Native Runtime.
|
|
10
|
+
*/
|
|
11
|
+
var _WORKLET: boolean | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* This ArrayBuffer contains the memory address of `jsi::Runtime` which is the
|
|
14
|
+
* Reanimated UI runtime.
|
|
15
|
+
*/
|
|
16
|
+
var _WORKLET_RUNTIME: ArrayBuffer;
|
|
17
|
+
/** @deprecated Don't use. */
|
|
18
|
+
var _IS_FABRIC: boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* This global variable is used to determine the kind of the current runtime.
|
|
21
|
+
* You can use it directly to differentiate between runtimes. However, the
|
|
22
|
+
* recommended way for differentiating is to use the {@link getRuntimeKind}
|
|
23
|
+
* function.
|
|
24
|
+
*
|
|
25
|
+
* - Value _1_: React Native Runtime
|
|
26
|
+
* - Value _2_: UI Worklet Runtime
|
|
27
|
+
* - Value _3_: Worker Worklet Runtime
|
|
28
|
+
*/
|
|
29
|
+
var __RUNTIME_KIND: RuntimeKind | 1 | 2 | 3;
|
|
30
|
+
}
|
|
31
|
+
export type WorkletRuntime = {
|
|
32
|
+
__hostObjectWorkletRuntime: never;
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly runtimeId: number;
|
|
35
|
+
};
|
|
36
|
+
export type WorkletStackDetails = [
|
|
37
|
+
error: Error,
|
|
38
|
+
lineOffset: number,
|
|
39
|
+
columnOffset: number
|
|
40
|
+
];
|
|
41
|
+
export type WorkletClosure = Record<string, unknown>;
|
|
42
|
+
interface WorkletInitData {
|
|
43
|
+
code: string;
|
|
44
|
+
/** Only in dev builds. */
|
|
45
|
+
location?: string;
|
|
46
|
+
/** Only in dev builds. */
|
|
47
|
+
sourceMap?: string;
|
|
48
|
+
}
|
|
49
|
+
interface WorkletProps {
|
|
50
|
+
__closure: WorkletClosure;
|
|
51
|
+
__workletHash: number;
|
|
52
|
+
/** Only in Legacy Bundling. */
|
|
53
|
+
__initData?: WorkletInitData;
|
|
54
|
+
/** Only for Handles. */
|
|
55
|
+
__init?: () => unknown;
|
|
56
|
+
/** `__stackDetails` is removed after parsing. */
|
|
57
|
+
__stackDetails?: WorkletStackDetails;
|
|
58
|
+
/** Only in dev builds. */
|
|
59
|
+
__pluginVersion?: string;
|
|
60
|
+
}
|
|
61
|
+
export type WorkletFunction<TArgs extends unknown[] = unknown[], TReturn = unknown> = ((...args: TArgs) => TReturn) & WorkletProps;
|
|
62
|
+
export interface WorkletFactory<TArgs extends unknown[] = unknown[], TReturn = unknown, TClosureVariables extends Record<string, unknown> = Record<string, unknown>> {
|
|
63
|
+
(closureVariables: TClosureVariables): WorkletFunction<TArgs, TReturn>;
|
|
64
|
+
}
|
|
65
|
+
export type ValueUnpacker = WorkletFunction<[
|
|
66
|
+
objectToUnpack: unknown,
|
|
67
|
+
category?: string
|
|
68
|
+
], unknown>;
|
|
69
|
+
export interface WorkletImport {
|
|
70
|
+
__bundleData: {
|
|
71
|
+
/** Name of the module which is the source of the import. */
|
|
72
|
+
source: string;
|
|
73
|
+
/** The name of the imported value. */
|
|
74
|
+
imported: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Configuration object for creating a worklet runtime. */
|
|
78
|
+
export type WorkletRuntimeConfig = {
|
|
79
|
+
/** The name of the worklet runtime. */
|
|
80
|
+
name?: string;
|
|
81
|
+
/**
|
|
82
|
+
* A worklet that will be run immediately after the runtime is created and
|
|
83
|
+
* before any other worklets.
|
|
84
|
+
*/
|
|
85
|
+
initializer?: () => void;
|
|
86
|
+
/**
|
|
87
|
+
* Time interval in milliseconds between polling of frame callbacks scheduled
|
|
88
|
+
* by requestAnimationFrame. If not specified, it defaults to 16 ms.
|
|
89
|
+
*/
|
|
90
|
+
animationQueuePollingRate?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Determines whether to enable the default Event Loop or not. The Event Loop
|
|
93
|
+
* provides implementations for `setTimeout`, `setImmediate`, `setInterval`,
|
|
94
|
+
* `requestAnimationFrame`, `queueMicrotask`, `clearTimeout`, `clearInterval`,
|
|
95
|
+
* `clearImmediate`, and `cancelAnimationFrame` methods. If not specified, it
|
|
96
|
+
* defaults to `true`.
|
|
97
|
+
*/
|
|
98
|
+
enableEventLoop?: true;
|
|
99
|
+
} & ({
|
|
100
|
+
/**
|
|
101
|
+
* If true, the runtime will use the default queue implementation for
|
|
102
|
+
* scheduling worklets. Defaults to true.
|
|
103
|
+
*/
|
|
104
|
+
useDefaultQueue?: true;
|
|
105
|
+
/**
|
|
106
|
+
* An optional custom queue to be used for scheduling worklets.
|
|
107
|
+
*
|
|
108
|
+
* The queue has to implement the C++ `AsyncQueue` interface from
|
|
109
|
+
* `<worklets/RunLoop/AsyncQueue.h>`.
|
|
110
|
+
*/
|
|
111
|
+
customQueue?: never;
|
|
112
|
+
} | {
|
|
113
|
+
/**
|
|
114
|
+
* If true, the runtime will use the default queue implementation for
|
|
115
|
+
* scheduling worklets. Defaults to true.
|
|
116
|
+
*/
|
|
117
|
+
useDefaultQueue: false;
|
|
118
|
+
/**
|
|
119
|
+
* An optional custom queue to be used for scheduling worklets.
|
|
120
|
+
*
|
|
121
|
+
* The queue has to implement the C++ `AsyncQueue` interface from
|
|
122
|
+
* `<worklets/RunLoop/AsyncQueue.h>`.
|
|
123
|
+
*/
|
|
124
|
+
customQueue?: object;
|
|
125
|
+
});
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,gDAAgD;AAChD,OAAO,CAAC,MAAM,CAAC;IACb;;;;;;OAMG;IACH,IAAI,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAElC;;;OAGG;IACH,IAAI,gBAAgB,EAAE,WAAW,CAAC;IAElC,6BAA6B;IAC7B,IAAI,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;IAEpC;;;;;;;;;OASG;IACH,IAAI,cAAc,EAAE,WAAW,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC7C;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,0BAA0B,EAAE,KAAK,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK;IACZ,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,MAAM;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC;IACvB,iDAAiD;IACjD,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,0BAA0B;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EACnC,OAAO,GAAG,OAAO,IACf,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc,CAC7B,KAAK,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EACnC,OAAO,GAAG,OAAO,EACjB,iBAAiB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE3E,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CACxE;AAED,MAAM,MAAM,aAAa,GAAG,eAAe,CACzC;IAAC,cAAc,EAAE,OAAO;IAAE,QAAQ,CAAC,EAAE,MAAM;CAAC,EAC5C,OAAO,CACR,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE;QACZ,4DAA4D;QAC5D,MAAM,EAAE,MAAM,CAAC;QACf,sCAAsC;QACtC,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,2DAA2D;AAC3D,MAAM,MAAM,oBAAoB,GAAG;IACjC,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC;CACxB,GAAG,CACA;IACE;;;OAGG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC;IACvB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,GACD;IACE;;;OAGG;IACH,eAAe,EAAE,KAAK,CAAC;IACvB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { WorkletFunction } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* This function allows you to determine if a given function is a worklet. It
|
|
4
|
+
* only works with Worklets Babel plugin enabled. Unless you are doing something
|
|
5
|
+
* with internals of Worklets you shouldn't need to use this function.
|
|
6
|
+
*
|
|
7
|
+
* ### Note
|
|
8
|
+
*
|
|
9
|
+
* Do not call it before the worklet is declared, as it will always return false
|
|
10
|
+
* then. E.g.:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* isWorkletFunction(myWorklet); // Will always return false.
|
|
14
|
+
*
|
|
15
|
+
* function myWorklet() {
|
|
16
|
+
* 'worklet';
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ### Maintainer note
|
|
21
|
+
*
|
|
22
|
+
* This function is supposed to be used only in the React Runtime. It always
|
|
23
|
+
* returns `false` in Worklet Runtimes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isWorkletFunction<Args extends unknown[] = unknown[], ReturnValue = unknown>(value: unknown): value is WorkletFunction<Args, ReturnValue>;
|
|
26
|
+
//# sourceMappingURL=workletFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workletFunction.d.ts","sourceRoot":"","sources":["../../src/workletFunction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EAClC,WAAW,GAAG,OAAO,EACrB,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAU7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-worklets",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "The React Native multithreading library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"lint:clang-tidy": "find Common -iname \"*.h\" -o -iname \"*.cpp\" | xargs ../../scripts/clang-tidy-lint.sh",
|
|
31
31
|
"lint:js": "eslint src && yarn prettier --check src",
|
|
32
32
|
"lint:plugin": "yarn workspace babel-plugin-worklets lint",
|
|
33
|
+
"prepack": "yarn build",
|
|
33
34
|
"set-version": "node scripts/set-version.js",
|
|
34
35
|
"test": "jest",
|
|
35
36
|
"type:check": "yarn type:check:src:native && yarn type:check:src:web && yarn type:check:plugin && yarn type:check:app && yarn type:check:tests",
|
package/src/debug/jsVersion.ts
CHANGED