openfin / openfin-examples-notifications

OpenFin examples of desktop notifications
MIT License
1 stars 2 forks source link

Load URL using requirejs #1

Open mohit-pandey opened 7 years ago

mohit-pandey commented 7 years ago

Hi, Is there any way to load URL using requireJS, like,

define(['notification.html'], function(notificationHTML) {
    new window.fin.desktop.Notification({
        url: notificationHTML,
        message: 'Hi, openfin notfication'
    })
})
datamadic commented 7 years ago

This should work granted that the url is correct. This perhaps could be a timing issue. To test, try creating the notification subsequently from the command line with the desired URL. If that works, I would wrap that call to create in a fin.desktop.main() call to ensure that the OpenFin API is ready, like so:

define(['notification.html'], function(notificationHTML) {
  fin.desktop.main(function() {
    new window.fin.desktop.Notification({
        url: notificationHTML,
        message: 'Hi, openfin notfication'
    })
  });
})