Migrate from the fin.Notification object
The fin.Notification object was deprecated in OpenFin version 17 and removed in version 22. This article describes approaches that are still supported. Possible approaches, depending on your needs, include the following:
- The OpenFin Notifications API
- Child windows
- Platform views
How the (obsolete) fin.Notification object worked
The fin.Notification
object was a way of showing a small, transient web page. To use it, you called code like the following:
fin.Notification.create({
url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Notification.create.html',
timeout: 3000
}).show()
A notification created this way did not live in a central notification center; it merely created a child window in a predefined screen location. This window could then be closed by the app with a call to fin.Notification.close()
. You could communicate with the window using fin.Notification.sendMessage()
.
fin.Notification API Removed
The fin.Notification API was removed in OpenFin 22.94.65.4
OpenFin Notifications API
The first and recommended option is to use the OpenFin Notifications API. This option has a number of advantages:
- Your app's notifications are available in the Notification Center app, even if your app is not running. As a result, users are able to interact with your app even after it has been closed.
- Your app's notifications gracefully coexist with all the other notifications on the desktop, avoiding issues such as z-order fights.
- Users are able to configure your app's notifications to behave the way they want, reducing the amount of work you need to do to support customization of notifications.
- You do not need to have an entire web page for a notification or to manage its lifetime, reducing the complexity of your app.
- There are features (such as toast persistence) that are very useful on the financial desktop but did not exist in the
fin.Notification
object.
A disadvantage of the Notifications API is that notifications are restricted to data-driven forms, rather than free-form web pages. It may require some redesign to make existing notifications fit into the Notification Center paradigm. However, the ability to define custom notification templates provides considerable flexibility.
An approach that OpenFin recommends is to start by experimenting with the Notifications API. You can create a test version of your app, containing the data that you need, trying out the various customization features. This can be done quickly, because the API is straightforward to use.
If you find that you require display features that the Notifications API does not support, contact OpenFin Support to arrange a session to discuss your requirements and how they might be addressed.
Child windows
You might be using the fin.Notification
object for something that is not actually a notification. For example, you might show a transient pop-up window with a complicated life cycle. In that case, we suggest you move to the full child Window API. This approach has a number of advantages in such a situation:
- You can use the Channel API, which has far more features than the
fin.Notification
object. - You have more control over the window, including sizing and positioning, than with the Notifications API.
- You can take advantage of all the callbacks that a child window can receive.
Platform views
If you are using the fin.Notification
object for window management, you could consider moving to the OpenFin Platform API. While this approach might seem like overkill, it is very powerful.
- Users have full control over the window. They can move it where they want and push it into tab views shared with other windows.
- The window can participate in workspaces, so users can save and share the window.
Updated over 1 year ago