Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Notes on document

Please note, this document is in an early draft form. It’s primary purpose is to discover how we will define APIs, rather than discover the detail of a specific API method. In other words, now is not the time to ask “Why doesn’t it support xyz?”, however, it is a good time to ask “If we were to add xyz, where would it live?”

...

The Notifications API is used to configure and display desktop notifications to the user. It is exposed as an extension to the HTML5 Notification API, providing additional functionality that is useful for financial desktop applications.

...

Creates a new instance of the Notification object.

Syntax

var myNotification = new Notification(title, options);

...

var myNotification = new ssf.Notification(title, options);

Parameters

title

Defines a title for the notification, which will be shown at the top of the notification window when it is fired.

...

The Electron container supports HTML5 notifications, displaying them as OS-level notifications (e.g. notification centre on Mac). The container does not support notifications on Windows <8, or have direct support for the extension properties.  Note: Electron is considering Windows 7 support (see: https://github.com/electron/electron/issues/8384).  Everyone should put a thumbs up there.

...

Discussion points:


  • (From Nick) we have vendor prefixes in the web world, but these exist to handle the problem of competing implementations - which we don’t necessarily have.  Plus, the success of the prefixing scheme in the web world is debatable and our mechanics are a bit different  - since containers target specific chrome versions and don’t role versions forward automatically.  

  • (From Nick) Should our API be prefixed? E.g. new ssf.Notification.  If the API is not prefixed - the only way to handle contention with browser globals like Notification would be via prototype decoration.  The development community has largely rejected this approach as an anti-pattern.    

    • (Colin) I'd like to debate this one further, in order to handle contention you simply have to replace one global function with another, it's the standard polyfill approach. As an example, here is an electron Notification shim that allows the notification API to be used from the main process: