mirror of
https://github.com/penpot/penpot-plugins.git
synced 2025-01-04 13:50:13 -05:00
feat(plugins-runtime): add close callback to load api
This commit is contained in:
parent
b4d0463548
commit
aeddab7917
1 changed files with 10 additions and 3 deletions
|
@ -35,7 +35,10 @@ window.addEventListener('message', (event) => {
|
|||
}
|
||||
});
|
||||
|
||||
export const loadPlugin = async function (manifest: Manifest) {
|
||||
export const loadPlugin = async function (
|
||||
manifest: Manifest,
|
||||
closeCallback?: () => void
|
||||
) {
|
||||
try {
|
||||
const context = contextBuilder && contextBuilder(manifest.pluginId);
|
||||
|
||||
|
@ -50,6 +53,7 @@ export const loadPlugin = async function (manifest: Manifest) {
|
|||
manifest,
|
||||
() => {
|
||||
plugins = plugins.filter((api) => api !== plugin);
|
||||
closeCallback && closeCallback();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -60,8 +64,11 @@ export const loadPlugin = async function (manifest: Manifest) {
|
|||
}
|
||||
};
|
||||
|
||||
export const ɵloadPlugin = async function (manifest: Manifest) {
|
||||
loadPlugin(manifest);
|
||||
export const ɵloadPlugin = async function (
|
||||
manifest: Manifest,
|
||||
closeCallback?: () => void
|
||||
) {
|
||||
loadPlugin(manifest, closeCallback);
|
||||
};
|
||||
|
||||
export const ɵloadPluginByUrl = async function (manifestUrl: string) {
|
||||
|
|
Loading…
Reference in a new issue