chayns-api 2.1.7 → 2.1.8

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.
@@ -320,6 +320,7 @@ class FrameWrapper {
320
320
  }
321
321
  }
322
322
  async init() {
323
+ var _await$exposed$_custo;
323
324
  if (this.initialized) return;
324
325
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
325
326
  const dataListener = () => exposed.addDataListener(comlink.proxy(({
@@ -348,7 +349,7 @@ class FrameWrapper {
348
349
  this.values = await exposed.getInitialData();
349
350
  this.exposedFunctions = exposed.functions;
350
351
  this.exposedCustomFunctions = exposed.customFunctions;
351
- this.exposedCustomFunctionNames = await exposed._customFunctionNames;
352
+ this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
352
353
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
353
354
  p[e] = (...args) => this.exposedCustomFunctions[e](...args.map(a => typeof a === 'function' ? comlink.proxy(a) : a));
354
355
  return p;
@@ -327,7 +327,8 @@ export class FrameWrapper {
327
327
  }
328
328
  }
329
329
  async init() {
330
- var _this2 = this;
330
+ var _await$exposed$_custo,
331
+ _this2 = this;
331
332
  if (this.initialized) return;
332
333
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
333
334
  const dataListener = () => exposed.addDataListener(comlink.proxy(_ref => {
@@ -357,7 +358,7 @@ export class FrameWrapper {
357
358
  this.values = await exposed.getInitialData();
358
359
  this.exposedFunctions = exposed.functions;
359
360
  this.exposedCustomFunctions = exposed.customFunctions;
360
- this.exposedCustomFunctionNames = await exposed._customFunctionNames;
361
+ this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
361
362
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
362
363
  p[e] = function () {
363
364
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @category Hooks
3
2
  * Returns customCallbackFunction
3
+ * @category Hooks
4
4
  * @deprecated Use customFunction/useCustomFunction-interface instead if possible
5
5
  */
6
6
  export declare const useCustomCallbackFunction: () => (type: string, data: unknown) => Promise<unknown>;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Returns the customFunction
3
+ * @category Hooks
3
4
  * @param key functionName
4
5
  */
5
6
  export declare const useCustomFunction: <A extends any[], T>(key: string) => (...args: A) => Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",