chayns-api 2.4.19 → 2.4.21

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.
@@ -9,9 +9,9 @@ let current = undefined;
9
9
  const moduleWrapper = exports.moduleWrapper = {
10
10
  get current() {
11
11
  if (moduleWrapperStack.length === 0 && !current) {
12
- throw new Error("No chayns api instance intialized");
12
+ throw new Error("No chayns api instance initialized");
13
13
  }
14
- return moduleWrapperStack.at(-1) || current;
14
+ return moduleWrapperStack.length > 0 ? moduleWrapperStack[moduleWrapperStack.length - 1] : current;
15
15
  },
16
16
  set current(chayns) {
17
17
  current = chayns;
@@ -3,9 +3,9 @@ let current = undefined;
3
3
  export const moduleWrapper = {
4
4
  get current() {
5
5
  if (moduleWrapperStack.length === 0 && !current) {
6
- throw new Error("No chayns api instance intialized");
6
+ throw new Error("No chayns api instance initialized");
7
7
  }
8
- return moduleWrapperStack.at(-1) || current;
8
+ return moduleWrapperStack.length > 0 ? moduleWrapperStack[moduleWrapperStack.length - 1] : current;
9
9
  },
10
10
  set current(chayns) {
11
11
  current = chayns;
@@ -253,7 +253,7 @@ export declare const getStyleSettings: () => import("../types/IChaynsReact").Cha
253
253
  * Returns the customFunction. Prefer usage via useCustomFunction when possible
254
254
  * @param key functionName
255
255
  */
256
- export declare const getCustomFunction: <A extends Array<any>, T>(key: string) => (...args: A) => Promise<T>;
256
+ export declare const getCustomFunction: <A extends (...args: any[]) => Promise<any>>(key: string) => A;
257
257
  export declare const user: UserInfo;
258
258
  export declare const site: ChaynsApiSite;
259
259
  export declare const device: ChaynsApiDevice;
@@ -3,4 +3,4 @@
3
3
  * @category Hooks
4
4
  * @param key functionName
5
5
  */
6
- export declare const useCustomFunction: <A extends Array<any>, T>(key: string) => (...args: A) => Promise<T>;
6
+ export declare const useCustomFunction: <A extends (...args: any[]) => Promise<any>>(key: string) => A;
@@ -451,7 +451,7 @@ export interface ChaynsReactFunctions {
451
451
  }) => Promise<void>;
452
452
  }
453
453
  export type ChaynsReactCustomFunctions = {
454
- [key: string]: <A extends Array<any>, O>(...args: A) => Promise<O>;
454
+ [key: string]: (...args: any[]) => Promise<any>;
455
455
  };
456
456
  export type DialogResult = {
457
457
  open: () => Promise<any>;
@@ -29,6 +29,6 @@ declare class StaticChaynsApi {
29
29
  runtimeEnvironment: import("../types/IChaynsReact").RuntimeEnviroment | string;
30
30
  };
31
31
  getStyleSettings: () => import("../types/IChaynsReact").ChaynsStyleSettings | undefined;
32
- getCustomFunction: (key: string) => <A extends Array<any>, O>(...args: A) => Promise<O>;
32
+ getCustomFunction: (key: string) => (...args: any[]) => Promise<any>;
33
33
  }
34
34
  export default StaticChaynsApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.4.19",
3
+ "version": "2.4.21",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",