Skip to content

Commit

Permalink
feat(plugins): imperative initialization (#7912)
Browse files Browse the repository at this point in the history
* feat(plugins): imperative initialization

* fix(plugins): changed undefinedExtensions to initialize

* fix(plugins): fancy new typescript

Co-Authored-By: Erik Munson <erik@ipsumcreative.com>

Co-authored-by: Erik Munson <erik@ipsumcreative.com>
  • Loading branch information
Brandon Powell and erikmunson committed Feb 19, 2020
1 parent ebf2d36 commit d090d7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ describe('PluginRegistry', () => {
pluginModule = {
plugin: {
stages: [({ id: 'mystage' } as any) as IStageTypeConfig],
initialize: () => {},
},
};
});
Expand Down
4 changes: 4 additions & 0 deletions app/scripts/modules/core/src/plugins/plugin.registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IStageTypeConfig } from 'core/domain';

export interface IDeckPlugin {
stages?: IStageTypeConfig[];
initialize?(): void;
}

export interface IPluginManifest {
Expand Down Expand Up @@ -168,6 +169,9 @@ export class PluginRegistry {
// Register extensions with deck.
plugin.stages?.forEach(stage => Registry.pipeline.registerStage(stage));

// Run code that currently does not have an extension point
plugin.initialize?.();

return module;
} catch (error) {
console.error(`Failed to load plugin code from ${pluginUrl}`);
Expand Down

0 comments on commit d090d7d

Please sign in to comment.