@forge/bridge
7.3.0-next.87.3.0-next.9
out/panel/panel.js+
out/panel/panel.jsNew file+44
Index: package/out/panel/panel.js
===================================================================
--- package/out/panel/panel.js
+++ package/out/panel/panel.js
@@ -0,0 +1,44 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.panel = void 0;
+const bridge_1 = require("../bridge");
+const errors_1 = require("../errors");
+const callBridge = (0, bridge_1.getCallBridge)();
+/**
+ * Opens the given resource in the product's side panel.
+ *
+ * @param {PanelOptions} options - The resource to render and an optional `onClose` callback.
+ */
+const open = async ({ resource, onClose }) => {
+ let result;
+ try {
+ result = await callBridge('openPanel', { resource, onClose });
+ }
+ catch {
+ throw new errors_1.BridgeAPIError('Unable to open panel.');
+ }
+ if (result === false)
+ throw new errors_1.BridgeAPIError('Unable to open panel.');
+};
+/**
+ * Closes the panel opened by `panel.open`.
+ */
+const close = async () => {
+ let result;
+ try {
+ result = await callBridge('closePanel');
+ }
+ catch {
+ throw new errors_1.BridgeAPIError('Unable to close panel.');
+ }
+ if (result === false)
+ throw new errors_1.BridgeAPIError('Unable to close panel.');
+};
+/**
+ * A panel that opens on the right-hand side of the host product.
+ * This feature is currently in development and is not yet available.
+ */
+exports.panel = {
+ open,
+ close
+};