Skip to content

Commit

Permalink
Merge pull request #722 from smartxworks/feat/window-services
Browse files Browse the repository at this point in the history
feat(runtime): mount sunmao services on window
  • Loading branch information
tanbowensg authored Aug 31, 2023
2 parents b11c3d9 + 84bad0a commit 9729c55
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { initRegistry, SunmaoLib } from './services/Registry';
import { initApiService } from './services/apiService';
import { initGlobalHandlerMap } from './services/handler';
import { UtilMethodManager } from './services/UtilMethodManager';
import { AppHooks } from './types';
import { AppHooks, UIServices } from './types';
import { enableES5, setAutoFreeze } from 'immer';
import './style.css';
import { initSlotReceiver } from './services/SlotReciver';
Expand Down Expand Up @@ -47,20 +47,19 @@ export function initSunmaoUI(props: SunmaoUIRuntimeProps = {}) {
props.libs?.forEach(lib => {
registry.installLib(lib);
});
const services: UIServices = {
registry,
stateManager,
globalHandlerMap,
apiService,
eleMap,
slotReceiver,
};

(window as any).sunmaoServices = services;

return {
App: genApp(
{
registry,
stateManager,
globalHandlerMap,
apiService,
eleMap,
slotReceiver,
},
props.hooks,
props.isInEditor
),
App: genApp(services, props.hooks, props.isInEditor),
stateManager,
registry,
globalHandlerMap,
Expand Down

0 comments on commit 9729c55

Please sign in to comment.