Class DeviceFactory

Hierarchy

Constructors

Properties

db: EntityManager = ...

The owning EntityManager where this factory belongs to

managedType: ManagedType<Device> = ...

The managed type of this factory

methods: {
    [methodName: string]: any;
} = ...

Methods that are added to object instances This property is an alias for this factory type prototype

Name

methods

Type declaration

  • [methodName: string]: any
prototype: Device = ...
type: Class<Device> = ...

Accessors

  • get PushMessage(): typeof PushMessage
  • Push message will be used to send a push notification to a set of devices

    Returns typeof PushMessage

  • get isRegistered(): boolean
  • Returns true if the devices is already registered, otherwise false.

    Returns boolean

  • get me(): null | Device
  • The current registered device, or null if the device is not registered

    Returns null | Device

Methods

  • Add a method to instances of this factories type

    Returns

    Parameters

    • name: string

      The method name to add

    • fn: Function

      The Method to add

    Returns void

  • Adds methods to instances of this factories type

    Returns

    Parameters

    • methods: {
          [name: string]: Function;
      }

      The methods to add

      • [name: string]: Function

    Returns void

  • Creates a new instance and sets the DatabaseObject to the given json

    Returns

    instance

    Parameters

    Returns Device

  • Loads the instance for the given id, or null if the id does not exists.

    Returns

    A Promise that will be fulfilled when the asynchronous operation completes.

    Parameters

    • id: string

      The id to query

    • Optional options: {
          depth?: number | boolean;
          local?: boolean;
          refresh?: boolean;
      }

      The load options

      • Optional depth?: number | boolean

        The object depth which will be loaded. Depth 0 loads only this object, true loads the objects by reachability.

      • Optional local?: boolean

        Indicates whether the local copy (from the entity manager) of an object should be returned if it exists. This value might be stale.

      • Optional refresh?: boolean

        Indicates whether the object should be revalidated (cache bypass).

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<null | Device>

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

    Returns

    The public VAPID Web Push subscription key

    Returns Promise<ArrayBuffer>

  • Creates a new instance of the factory type

    Returns

    A new created instance of *

    Instance

    Parameters

    • Rest ...args: any[]

      Constructor arguments used for instantiation

    Returns Device

  • Creates a new instance of the factory type

    Returns

    A new created instance of T

    Parameters

    • Optional args: IArguments | any[]

      Constructor arguments used for instantiation, the constructor will not be called when no arguments are passed

    Returns Device

  • Uses the info from the given PushMessage message to send an push notification.

    Returns

    Parameters

    • pushMessage: PushMessage

      to send an push notification.

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<void>

  • Gets an unloaded reference for the given id.

    Returns

    An unloaded reference to the object with the given id.

    Parameters

    • id: string

      The id of an object to get a reference for.

    Returns Device

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

    Returns

    The registered device

    Parameters

    • os: string

      The OS of the device (IOS/Android)

    • tokenOrSubscription: string | PushSubscription

      The FCM device token, APNS device token or WebPush subscription

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<Device>

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

    Returns

    The registered device

    Parameters

    • os: string

      The OS of the device (IOS/Android)

    • tokenOrSubscription: string | PushSubscription

      The FCM device token, APNS device token or WebPush subscription

    • device: null | Device

      An optional device entity to set custom field values

    • Optional doneCallback: any

      Called when the operation succeed.

    • Optional failCallback: any

      Called when the operation failed.

    Returns Promise<Device>

Generated using TypeDoc