【问题标题】:How to send Push Notifications in OpenFin?如何在 OpenFin 中发送推送通知?
【发布时间】:2020-01-20 08:02:51
【问题描述】:

我必须向所有在我的网站上使用 OpenFin 的用户推送通知。 根据 OpenFin 文档,他们提供了 API 以在按钮单击等事件上发送桌面通知。但是如果 OpenFin 应用处于空闲状态,我们需要发送通知,那么我该如何实现呢?

我浏览了 OpenFin 提供的 site 上的示例。

任何人都可以帮助提供 javascript 中推送通知的示例代码吗?

【问题讨论】:

  • But if the OpenFin App is Idle and we need send notifications then how can I achieve that? 在没有用户交互的情况下?将通知创建放在 websocket 订阅或其他东西中。如果应用已打开但未显示,通知仍会推送。

标签: javascript openfin


【解决方案1】:

链接中提供的示例已过时,因为它使用旧的 Openfin API。 我建议您使用最新的 API 通知 Openfin Notification API

fin.Notification.create({
    url: 'https://cdn.openfin.co/docs/javascript/stable/tutorial-Notification.create.html',
    timeout: 3000
}).show().then(() => console.log('Notification created')).catch(err => console.log(err));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-02-17
    • 2019-02-07
    • 2020-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-01
    相关资源
    最近更新 更多