I have a piece of code that I am having a hard time to understand. I'm new to TypeScript.
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(FensterCommands.HELLOWORLD);
registry.registerHandler(FensterCommands.HELLOWORLD.id, {
isEnabled: () => true,
execute: () => this.messageService.info('Hello World!')
});
}
Could someone help me understand the above code? The thing I don't understand is the second JSON-like parameter within registry.registerHandler(...). What type does this parameter value have, that is located within curly brackets {...}? The first parameter has the name isEnabled, right? And its value is what? Is it () or true? What does the empty function () mean? Does the entire line () => true end in being a comparison that ends in true/false?
Is that more or less correct?