Skip to content

Commit

Permalink
Add another message service message
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-fleck-at committed Dec 14, 2023
1 parent 33b0cde commit 7c2cd1e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/plugin-ext/doc/how-to-add-new-plugin-namespace.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ Example `foo-main.ts`:
```typescript
@injectable()
export class FooMainImpl implements FooMain {
@inject(MessageService) protected messageService: MessageService;
protected proxy: FooExt;

init(rpc: RPCProtocol) {
this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.FOO_EXT);
}

async $getFooImpl(): Promise<Foo> {
this.messageService.info('We were called from the plugin-host at the behest of the plugin');
return new Foo();
}
}
Expand All @@ -224,7 +226,7 @@ export class FooMainPluginApiProvider implements MainPluginApiProvider {
@inject(MessageService) protected messageService: MessageService;

initialize(rpc: RPCProtocol, container: interfaces.Container): void {
this.messageService.info('We were called from an extension!');
this.messageService.info('Initialize RPC communication for FooMain!');
// create a new FooMainImpl as it is not bound as singleton
const fooMainImpl = container.get(FooMainImpl);
fooMainImpl.init(rpc);
Expand Down

0 comments on commit 7c2cd1e

Please sign in to comment.