Class: DeviceFactory

binding.DeviceFactory(propertiesopt, …arguments) → {model.Device}

new DeviceFactory(propertiesopt, …arguments) → {model.Device}

Parameters:
Name Type Attributes Description
properties Object <optional>

initial properties to set on the instance

arguments * <repeatable>

Additional constructor params passed through the type constructor

Source:
Returns:

The new managed instance

Type
model.Device

Extends

Members

(readonly) isRegistered :boolean

Returns true if the devices is already registered, otherwise false.

Type:
  • boolean
Source:

(readonly) me :model.Device

The current registered device, or null if the device is not registered

Type:
Source:

Methods

loadWebPushKey() → {Promise.<ArrayBuffer>}

Loads the Public VAPID Key which can be used to subscribe a Browser for Web Push notifications

Source:
Returns:

The public VAPID Web Push subscription key

Type
Promise.<ArrayBuffer>

push(pushMessage, doneCallbackopt, failCallbackopt) → {Promise.<*>}

Uses the info from the given {util.PushMessage} message to send an push notification.

Parameters:
Name Type Attributes Description
pushMessage util.PushMessage

to send an push notification.

doneCallback binding.Entity~doneCallback <optional>

Called when the operation succeed.

failCallback binding.Entity~failCallback <optional>

Called when the operation failed.

Source:
Returns:
Type
Promise.<*>

PushMessage(devicesopt, messageopt, subjectopt, soundopt, badgeopt, dataopt) → {util.PushMessage}

Push message will be used to send a push notification to a set of devices

Parameters:
Name Type Attributes Description
devices Set.<binding.Entity> | Array.<binding.Entity> <optional>

The Set of device references which
will receive this push notification.

message string <optional>

The message of the push notification.

subject string <optional>

The subject of the push notification.

sound string <optional>

The file reference of the sound file as a string. The device uses this file as the
notification sound.

badge number <optional>

The badge count.

data Object <optional>

The data object which can contain additional information.

Source:
Returns:
Type
util.PushMessage

register(os, tokenOrSubscription, doneCallback, failCallbackopt) → {Promise.<model.Device>}

Register a new device with the given device token and OS.

Parameters:
Name Type Attributes Description
os string

The OS of the device (IOS/Android)

tokenOrSubscription string | Subscription

The FCM device token, APNS device token or WebPush subscription

doneCallback binding.Entity~doneCallback

Called when the operation succeed.

failCallback binding.Entity~failCallback <optional>

Called when the operation failed.

Source:
Returns:

The registered device

Type
Promise.<model.Device>

register(os, tokenOrSubscription, deviceopt, doneCallbackopt, failCallbackopt) → {Promise.<model.Device>}

Register a new device with the given device token and OS.

Parameters:
Name Type Attributes Description
os string

The OS of the device (IOS/Android)

tokenOrSubscription string | PushSubscription

The FCM device token, APNS device token or WebPush
subscription

device model.Device <optional>

An optional device entity to set custom field values

doneCallback binding.Entity~doneCallback <optional>

Called when the operation succeed.

failCallback binding.Entity~failCallback <optional>

Called when the operation failed.

Source:
Returns:

The registered device

Type
Promise.<model.Device>