Register your notifications platform

This article explains how to work with the new register() function options starting in Notifications v2. This function lets you control when Notification Center starts on users' desktops.

How it works

In earlier versions, the register() function in @openfin/workspace/notifications let you register your Workspace platforms. It is now modified to take a NotificationsRegisterOptions parameter instead of a platform. The previous function signature is deprecated, and will no longer be supported in a future release.

WARNING: The openfin-notifications package is deprecated, and will no longer be supported in a future release.

How to do it

import { register, create } from "@openfin/workspace/notifications";

// define notifications provider -- a Workspace Platform in this case
const examplePlatform: NotificationsPlatform = 
{
  id: "UNIQUE_PROVIDER_ID",
  title: "Custom Notification Platform",
  icon: "https://example.com/favicon.ico",
};

// explicitly register defined platform
// you can also pass the register() function without options
register(examplePlatform);

You can continue to work with the previous approach, which starts Notification Center automatically, but remember that it is now deprecated.

import { create } from "openfin-notifications";

// create notification definitions