So we are dealing now with migrating/adapting blocks of javascript from WebForms UserControls and pages into DotVVM pages and MarkupControls. And I cannot manage to make suggestions/Intellisense become available for the front-end dotvvm framework in the markup file of a MarkupControl:
I’ve searched the repo samples and did not find anything to help with this. I’ve found about the @js directive that seems promising but how to use this with the dotvvm object? Is there a *.map file somewhere that we can use? I’ve run out of ideas.
In WebForms we had this trick which gave us all the suggestions/Intellisense of what we specified as import:
I don’t know how does VS JavaScript autocompletion works, I don’t think the DotVVM extension does anything with it. You can install the typescript type definitions package - TypeScript declarations | DotVVM Documentation, I suppose it may also add the global symbol to autocompletion in inline JS.
The RequiredResource controls only enforce that a specific script is included in the page. Since dotvvm and dotvvm.internal are always included, you can safely delete those. dotvvm.businesspack is automatically included when you use a BP control. dotvvm.debug is always included in debug mode, you most likely don’t want it in production (it display the red notification when a postback does not run, for example). I think you can remove them all.
The Dependencies also enforces that the resources are included in page, but also makes sure to place the InlineScript after the specified resources, so I’d keep that.
Sure, I appreciate your detailed and considered explanation from which I’ve learned something useful. But the RequiredResource image example was just my desperate attempt at maybe getting the intellisense to give me something for dotvvm object in JS.
I’ve managed to squeeze some intellisense by doing an import:
But it seems I’m on a wrong path because I am not able to find the events themselves (in the picture we cannot see any init or initCompleted in the list).