Modules
The modules inside the Application Manifest define the entrypoint JavaScript file which is to be executed for the extension. Specifically the <file></file>
node in the XML
document defines the file name inside the Application Package to be executed.
<!-- inside appdef.xml -->
<modules>
<module environment="shellui">
<file>main.js</file>
</module>
</modules>
The module code itself must be a JavaScript application, which has a public entrypoint OnNewShellUI
which is the function that will be called
during the initialization of the UI Extension. The OnNewShellUI
has one argument which is the instance of IShellUI.
Please see the Sample Applications for examples of actual usage of the ShellUI.
main.js
// This function which handles UI Extension initialization phase.
function OnNewShellUI(shellUI) {
// Wait for the ShellFrame to be created and started
shellUI.Events.Register(MFiles.Event.NewShellFrame, (shellFrame) => {
shellFrame.Events.Register(MFiles.Event.Started, () => {
Start(shellUI, shellFrame)
})
})
}
// Main application
async function Start(shellUI, shellFrame) {
// TODO: write the UI Extension code here.
}