jan/web/app/_services/coreService.ts
Louis 27258433d1
#357 plugin & app can subscribe and emit events (#358)
* feature: event based plugin

* chore: update README.md

* Update yarn script for build plugins (#363)

* Update yarn script for build plugins

* Plugin-core install from npmjs instead of from local

---------

Co-authored-by: Hien To <>

* #360 plugin preferences (#361)

* feature: #360 plugin preferences

* chore: update core-plugin README.md

* chore: create collections on start

* chore: bumb core version

* chore: update README

* chore: notify preferences update

* fix: preference update

---------

Co-authored-by: hiento09 <136591877+hiento09@users.noreply.github.com>
2023-10-16 10:23:38 +00:00

22 lines
492 B
TypeScript

import { store } from "./storeService";
import { EventEmitter } from "./eventsService";
export const setupCoreServices = () => {
if (typeof window === "undefined") {
console.log("undefine", window);
return;
} else {
console.log("Setting up core services");
}
if (!window.corePlugin) {
window.corePlugin = {
store,
events: new EventEmitter(),
};
}
if (!window.coreAPI) {
// fallback electron API
window.coreAPI = window.electronAPI;
}
};