jan/web/services/coreService.ts
2023-10-30 23:20:10 +07:00

26 lines
699 B
TypeScript

import { store } from "./storeService";
import { EventEmitter } from "./eventsService";
import * as cn from "./cloudNativeService"
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(),
};
window.coreAPI = {};
window.coreAPI = window.electronAPI ?? {
invokePluginFunc: cn.invokePluginFunc,
downloadFile: cn.downloadFile,
deleteFile: cn.deleteFile,
appVersion: cn.appVersion,
openExternalUrl: cn.openExternalUrl
};
}
};