Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
timonson committed May 6, 2024
1 parent 5586a98 commit c7680be
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deps.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { makeRpcCall } from "https://dev.zaubrik.com/schicksal@v0.1.2/client/dist/mod.js";
export { makeRpcCall } from "https://dev.zaubrik.com/schicksal@v0.1.3/client/dist/mod.js";
5 changes: 3 additions & 2 deletions shadow.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
convertDashToCamel,
createTemplate,
getJwt,
isArray,
isHtmlElement,
isNull,
isObject,
Expand Down Expand Up @@ -56,7 +57,7 @@ export class Shadow extends HTMLElement {
/** @type{JsonValue} */
jsonData = null;

/** @type{Record<string, JsonObject>} */
/** @type{JsonObject | JsonArray } */
rpcData = {};

/**
Expand Down Expand Up @@ -298,7 +299,7 @@ export class Shadow extends HTMLElement {
{ method, params: /**@type {any}*/ (this)[property] },
isNull(jwt) ? undefined : { jwt },
);
if (isObject(result)) {
if (isObject(result) || isArray(result)) {
this.rpcData[method] = /**@type {JsonObject}*/ (result);
} else {
throw new Error("The rpc result is not an object.");
Expand Down
8 changes: 8 additions & 0 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ export function isObject(obj) {
Array.isArray(obj) === false);
}

/**
* @param {unknown} obj
* @returns {obj is unknown[]}
*/
export function isArray(obj) {
return Array.isArray(obj);
}

/**
* @param {unknown} input
* @returns {input is HTMLElement}
Expand Down

0 comments on commit c7680be

Please sign in to comment.