npm package diff
Package: @forge/bridge
Versions: 4.3.0 - 4.3.0-next.0-experimental-d6acbbd
File: package/out/router/router.js
Index: package/out/router/router.js
===================================================================
--- package/out/router/router.js
+++ package/out/router/router.js
@@ -1,13 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.router = void 0;
const bridge_1 = require("../bridge");
+const targets_1 = require("./targets");
const callBridge = (0, bridge_1.getCallBridge)();
-const navigate = async (url) => callBridge('navigate', { url, type: 'same-tab' });
-const open = async (url) => callBridge('navigate', { url, type: 'new-tab' });
+const navigate = async (location) => {
+ if (typeof location === 'string') {
+ return callBridge('navigate', { url: location, type: 'same-tab' });
+ }
+ else {
+ if (!(location === null || location === void 0 ? void 0 : location.target)) {
+ throw new Error('target is required for navigation');
+ }
+ return callBridge('navigate', { ...location, type: 'same-tab' });
+ }
+};
+const open = async (location) => {
+ if (typeof location === 'string') {
+ return callBridge('navigate', { url: location, type: 'new-tab' });
+ }
+ else {
+ if (!(location === null || location === void 0 ? void 0 : location.target)) {
+ throw new Error('target is required for navigation');
+ }
+ return callBridge('navigate', { ...location, type: 'new-tab' });
+ }
+};
const reload = async () => callBridge('reload');
exports.router = {
navigate,
open,
- reload
+ reload,
+ NAVIGATION_TARGET: targets_1.NAVIGATION_TARGET
};