Skip to content

Instantly share code, notes, and snippets.

@FlorianRappl
Created February 27, 2020 14:14
Show Gist options
  • Save FlorianRappl/c2423cebde33218fdff628fc9056ee79 to your computer and use it in GitHub Desktop.
Save FlorianRappl/c2423cebde33218fdff628fc9056ee79 to your computer and use it in GitHub Desktop.
// application shell
const mife = [];
window.registerMife = (name, call) => {
mife.push({
name,
call,
});
};
window.callMife = (target, msg) => {
mife.filter(m => m.name === target).forEach(m => m.call(msg));
};
// microfrontend A
window.registerMife('A', msg => {
//handle message;
});
// microfrontend B
window.callMife('A', {
type: 'show_dialog',
name: 'close_file'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment