Skip to content

Commit

Permalink
🔊 增加一些日志
Browse files Browse the repository at this point in the history
  • Loading branch information
kuitos committed Mar 3, 2020
1 parent e6a206c commit be61282
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions examples/app2/app.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
export const qiankun = {
// 应用加载之前
async bootstrap(props) {
console.log('app1 bootstrap', props);
console.log('app2 bootstrap', props);
},
// 应用 render 之前触发
async mount(props) {
console.log('app1 mount', props);
console.log('app2 mount', props);
},
// 应用卸载之后触发
async unmount(props) {
console.log('app1 unmount', props);
console.log('app2 unmount', props);
},
};
5 changes: 4 additions & 1 deletion src/master/runtimePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function render(oldRender: typeof noop) {
isAppActive(location, history, { base, setMatchedBase: (v: string) => (matchedBase = v) }),
render: ({ appContent, loading }) => {
if (process.env.NODE_ENV === 'development') {
console.info(`app ${name} loading ${loading}`);
console.info(`[@umijs/plugin-qiankun]: app ${name} loading ${loading}`);
}

if (mountElementId) {
Expand All @@ -84,6 +84,9 @@ export async function render(oldRender: typeof noop) {
},
});
ReactDOM.render(subApp, container);
} else if (process.env.NODE_ENV === 'development') {
console.warn(`[@umijs/plugin-qiankun]: Your ${name} app container with id ${mountElementId} is not
ready, that may cause an unexpected behavior!`);
}
}
},
Expand Down

0 comments on commit be61282

Please sign in to comment.