Skip to content

Instantly share code, notes, and snippets.

View JonasHelming's full-sized avatar

Jonas Helming JonasHelming

  • EclipseSource Munich
  • Munich
View GitHub Profile
const container = new Container({ autoBindInjectable: true });
container.load(exampleModule);
container.get(InterfaceConsumer).doSth();
bind(MenuContribution).to(ExampleMenuContribution);
@injectable()
export class ExampleMenuContribution implements MenuContribution {
registerMenus(menuRegistry: MenuModelRegistry): void {
menusRegistry.registerSubmenu('MyID', 'My Menu');
// register your own menus
}
}
constructor(
@inject(MessageService) private readonly messageService: MessageService
) { }
execute(): void {
this.messageService.info('Hello inversify');
}
bind(InterfaceC).toDynamicValue(() => ({ foo(): void { console.log('Dynamic foo') } }));
bind(MyClass).toSelf();
@injectable()
export class MyClass
[InterfaceB, InterfaceC].forEach(i => bind(i).toService(ClassBC));
@injectable()
export class ClassBC implements InterfaceB, InterfaceC
"theiaExtensions": [
{
"frontend": "path/to/exampleModule"
}
]