setDesktopNotificationEnabled method
Sets desktop notification on or off.
@remarks Has the same effect as toggling the "Desktop notification" toggle in the TalkJS Inbox UI. Use this function to replicate that toggle elsewhere in your UI if you're using TalkJS in a mode that doesn't show this toggle.
@param isEnabled - Whether notifications should be enabled. @param alertOnFailure - Whether to show an alert message when enabling notifications fails.
@returns a promise that'll resolve if the change succeeds, but rejects if anything goes
wrong. If anything goes wrong, the promise will be rejected with a {@link TalkError}, which has a
code
property. Possible values for it are:
-
Talk.ErrorCode.NOTIFICATIONS_PERMISSION_DENIED
: The browser or the user didn't grant you permission to send notifications. -
Talk.ErrorCode.NOTIFICATIONS_NOT_SUPPORTED
: The browser doesn't support desktop notifications.
Implementation
external dynamic /*Promise<void>*/ setDesktopNotificationEnabled(
bool isEnabled, dynamic options);