Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MagloftApi

The main MagloftApi Interface accessible via window.MagloftApi

Hierarchy

  • MagloftApi

Index

Properties

$init

$init: Promise<Context> = ...

Optional context

context: Context

The current user context stores information about the device and login state.

Accessors

version

  • get version(): string
  • The current version of the hpub2 sdk

    Returns string

Methods

clear

  • clear(): Promise<void>
  • Storage: Clear all stored keys

    Returns Promise<void>

clearPushMessages

  • clearPushMessages(): Promise<void>
  • Clear all scheduled push messages for the currently logged in reader. If the current user is not logged in, an error will be thrown.

    Returns Promise<void>

close

  • close(): void
  • Close the current issue and return back to the Issue Shelf

    Returns void

getItem

  • getItem(key: string): Promise<null | string>
  • Storage: Return the string value for the specified key, or null if the key does not exist.

    Parameters

    • key: string

    Returns Promise<null | string>

login

  • Trigger the native login flow. Can be used in conjunction with the onInit method to listen on when the user has completed the login flow successfully. In case the user is already logged in, this request will be ignored.

    Returns Promise<Reader>

onContextChanged

  • onContextChanged(fn: OnContextChangedFn): () => void
  • Subscribe to Context changes, e.g. after login or push permissions

    Parameters

    • fn: OnContextChangedFn

    Returns () => void

      • (): void
      • Returns void

onInit

  • onInit(callback: (context: Context) => void): void
  • Register an event listener to receive the current user context (1) when the SDK is first initialized, and (2) in case the context changes during runtime, e.g. when a user successfully logs in

    Parameters

    Returns void

openUrl

  • Open a URL in either the external browser (target: '_blank') or a modal window (target: '_top')

    Parameters

    Returns void

removeItem

  • removeItem(key: string): Promise<void>
  • Storage: Remove the string value for the specified key.

    Parameters

    • key: string

    Returns Promise<void>

requestPushPermissions

  • requestPushPermissions(): Promise<string>
  • Trigger the native push notification permission flow.

    Returns Promise<string>

schedulePushMessages

  • schedulePushMessages(messages: PushMessage[]): Promise<number>
  • Schedule push messages for the currently logged in reader. If the current user is not logged in, an error will be thrown.

    Parameters

    Returns Promise<number>

setItem

  • setItem(key: string, value: string): Promise<void>
  • Storage: Set the string value for the specified key.

    Parameters

    • key: string
    • value: string

    Returns Promise<void>

shareFile

  • Trigger the native Share functionality for a given file (image/pdf), fileName (optional), url (optional) & message (optional). Application-wide attribution parameters are automatically appended to the query string of the URL.

    Parameters

    Returns void

shareIssue

  • shareIssue(): void
  • Trigger the native Share functionality for the current issue. Application-wide attribution parameters are automatically appended to the query string of the URL.

    Returns void

shareUrl

  • Trigger the native Share functionality for a given url. Application-wide attribution parameters are automatically appended to the query string of the URL.

    Parameters

    Returns void

toggleNavigator

  • Open, close or toggle the top navigation bar. The active parameter specifies whether to force open (true) or close (false) the top navigation bar. Providing an empty object {} will toggle the top navigation bar opened and closed.

    Parameters

    Returns void

trackEvent

  • Track a custom event to Firebase Analytics based on name and parameters

    Parameters

    Returns void

Generated using TypeDoc