31 lines
763 B
TypeScript
31 lines
763 B
TypeScript
import { EngineManager, ToolManager } from '@janhq/core'
|
|
|
|
import { appService } from './appService'
|
|
import { EventEmitter } from './eventsService'
|
|
import { restAPI } from './restService'
|
|
import { tauriAPI } from './tauriService'
|
|
|
|
export const setupCoreServices = () => {
|
|
if (typeof window === 'undefined') {
|
|
console.debug('undefine', window)
|
|
return
|
|
} else {
|
|
console.debug('Setting up core services')
|
|
}
|
|
if (!window.core) {
|
|
window.core = {
|
|
events: new EventEmitter(),
|
|
engineManager: new EngineManager(),
|
|
toolManager: new ToolManager(),
|
|
api: {
|
|
...(window.electronAPI
|
|
? window.electronAPI
|
|
: IS_TAURI
|
|
? tauriAPI
|
|
: restAPI),
|
|
...appService,
|
|
},
|
|
}
|
|
}
|
|
}
|