text: import { registerMicroApps, runAfterFirstMounted, setDefaultMountApp, start, initGlobalState } from './src/index.ts';
  import './index.less';
  
  import render from './examples/main/render/ReactRender';
  
  /**
   * Step1 初始化应用（可选）
   */
  render({ loading: true });
  
  const loader = (loading) => render({ loading });
  
  /**
   * Step2 注册子应用
   */
  
  registerMicroApps(
    [
      {
        name: 'react16',
        entry: '//localhost:7100',
        container: '#subapp-viewport',
        loader,
        activeRule: '/react16',
      },
      {
        name: 'purehtml',
        entry: '//localhost:7104',
        container: '#subapp-viewport',
        loader,
        activeRule: '/purehtml',
      },
    ],
    {
      beforeLoad: [
        (app) => {
          console.log('[LifeCycle] before load %c%s', 'color: green;', app.name);
        },
      ],
      beforeMount: [
        (app) => {
          console.log('[LifeCycle] before mount %c%s', 'color: green;', app.name);
        },
      ],
      afterUnmount: [
        (app) => {
          console.log('[LifeCycle] after unmount %c%s', 'color: green;', app.name);
        },
      ],
    },
  );
  
  const { onGlobalStateChange, setGlobalState } = initGlobalState({
    user: 'qiankun',
  });
  
  onGlobalStateChange((value, prev) => console.log('[onGlobalStateChange - master]:', value, prev));
  
  setGlobalState({
    ignore: 'master',
    user: {
      name: 'master',
    },
  });
  
  /**
   * Step3 设置默认进入的子应用
   */
  setDefaultMountApp('/react16');
  
  /**
   * Step4 启动应用
   */
  start();
  
  runAfterFirstMounted(() => {
    console.log('[MainApp] first app mounted');
  });
  