Skip to content

Commit

Permalink
Allow expose api
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway authored Dec 18, 2023
1 parent bde65e7 commit 628ffe6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imjoy-core",
"version": "0.14.4",
"version": "0.14.5",
"private": false,
"description": "The core library for ImJoy -- a sandboxed plugin framework for computational web applications.",
"author": "imjoy-team <imjoy.team@gmail.com>",
Expand Down
7 changes: 7 additions & 0 deletions src/imjoyBasicApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ export async function loadImJoyBasicApp(config) {
const imjoyCore = await loadImJoyCore(config);
const imjoy = new imjoyCore.ImJoy({
imjoy_api,
expose_api: config.expose_api,
client_id: config.client_id,
default_base_frame: config.default_base_frame,
default_rpc_base_url: config.default_rpc_base_url,
debug: config.debug,
flags: config.flags || [],
engine_selector: config.engine_selector,
});
await imjoy.start(config);
console.log("ImJoy Core started successfully!");
Expand Down
6 changes: 4 additions & 2 deletions src/imjoyCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export { version as VERSION } from "../package.json";

export class ImJoy {
constructor({
name = "ImJoy",
imjoy_api = null,
event_bus = null,
client_id = null,
Expand All @@ -32,6 +33,7 @@ export class ImJoy {
flags = [],
engine_selector = null,
}) {
this.name = name;
this.config_db =
config_db ||
new PouchDB("imjoy_config", {
Expand Down Expand Up @@ -100,10 +102,10 @@ export class ImJoy {
}
// inside an iframe
if (this.expose_api && window.self !== window.top) {
const api = await imjoyRPC.setupRPC({ name: "ImJoy" });
const api = await imjoyRPC.setupRPC({ name: this.name || "ImJoy" });
const root_plugin_config = {
_id: "root",
name: "ImJoy",
name: this.name || "ImJoy",
type: "window",
ui: null,
tag: null,
Expand Down

0 comments on commit 628ffe6

Please sign in to comment.