Electron, Win10, UWP

I have been following Microsoft's adventure on HTML5/Javascript based desktop UIs for a while – actually, did participate on the journey while working for Microsoft back in 2003 on a Microsoft POC project codenamed IceFace which was doing something akin of websockets (using a proprietary ActiveX and doing low level TCP from it) and something akin of an HTA application. In the recent years, I was watching when they announced WinRT and one of the programming models being HTML5/Javascript; also watched with awe as they failed to penetrate the world with WinJS Tutorial ; than when UWP enabled using HTML5/Javascript as one of the technologies to use. So when I heard last year they tackle this area again, I didn't have high hopes.

 

I was wrong. They actually listened to the people – yes, they misinterpreted what they want the first few (?) times, and lost their expected leadership in the desktop app segment (which were quickly eaten into by the HTML5 hybrid applications), but at last they stopped fighting the inevitable.

 

Why do I say this? Next to the bridges Microsoft announced and later opensourced (centennial for desktop app, the later cancelled bridge for Android applications, the bridges for hosted web applications, for iOS applications and for Silverlight applications) Microsoft sneaked in an announcement: Electron applications for the Windows Store . Using Centennial technologies (so no registry or file system is used, and the application is running on full speed, but still running in a sandbox) you are able to 'compile' your Electron application to a Windows Store AppX (either for the external application store or the internal one). Moreover – using NodeRT (which can be downloaded through npm, and does some crazy magic of generating node.js native addon's C++ code using C# reflection over WinMD manifest files) you are able to access the same WinRT/UWP APIs like any other native application would do – see Showing Native Windows Notifications from Electron Using NodeRT for details.

 

This easily enabled applications do interaction with the native Windows experience, like setting the lockscreen image from JavaScript (TypeScript):

 

const {KnownFolders} = require('windows.storage')

const {LockScreen} = require('windows.system.userprofile')

myFolder.getFileAsync('image.jpg', (err, file) => {

  LockScreen.setImageFileAsync(file, (err) => { })

})

 

Or popping up a toast using https://github.com/felixrieseberg/electron-windows-notifications :

 

const appId = 'electron-windows-notifications'

const {ToastNotification} = require('electron-windows-notifications')

 

let notification = new ToastNotification({

    appId: appId,

    template: `<toast><visual><binding template="ToastText01"><text id="1">%s</text></binding></visual></toast>`,

    strings: ['Hi!']

})

 

notification.on('dismissed', () => console.log('Dismissed!'))

notification.show()

 

So yes, Windows 10 migration for some of the applications and firms might be far ahead, but I think we would be prepared. We are still to see how they will tackle the issues regards Electron security sandbox, but I feel like this time Microsoft might be just naturally doing what was expected from them for a long time, and we can see others stepping into the same direction with getting on the Electron bandwagon.

Leave a Reply

Your email address will not be published. Required fields are marked *