Options
All
  • Public
  • Public/Protected
  • All
Menu

External module scripts/service_worker

Service Worker to handle push notifications

Index

Events

onNotificationClick

  • onNotificationClick(event: any): void
  • Notification clicked

    Parameters

    • event: any

    Returns void

onNotificationClose

  • onNotificationClose(event: any): void
  • Notification closed

    remarks

    can't open or focus window here.

    Parameters

    • event: any

    Returns void

onPushReceived

  • onPushReceived(event: any): void
  • Event: Received push message

    Parameters

    • event: any

    Returns void

Variables

Const ACTION_DEVICE_REMOVED

ACTION_DEVICE_REMOVED: "remove_our_device" = "remove_our_device"

Const ACTION_MESSAGE

ACTION_MESSAGE: "m" = "m"

Const FAKE_FETCH_DONE

FAKE_FETCH_DONE: "Fake fetch done" = "Fake fetch done"

Const IC_ADD_DEVICE

IC_ADD_DEVICE: "../images/ic_add_device.png" = "../images/ic_add_device.png"

Const IC_REMOTE_COPY

IC_REMOTE_COPY: "../images/ic_remote_copy.png" = "../images/ic_remote_copy.png"

Const IC_REMOVE_DEVICE

IC_REMOVE_DEVICE: "../images/ic_remove_device.png" = "../images/ic_remove_device.png"

Const IC_SEARCH

IC_SEARCH: "../images/search-web.png" = "../images/search-web.png"

Const TAG_DEVICE

TAG_DEVICE: "tag-device" = "tag-device"

Const TAG_MESSAGE

TAG_MESSAGE: "tag-message" = "tag-message"

Const URL_EXT

URL_EXT: "chrome-extension://jemdfhaheennfkehopbpkephjlednffd/html/main.html" = "chrome-extension://jemdfhaheennfkehopbpkephjlednffd/html/main.html"

Path to extension's main page

Const URL_FETCH_BASE

URL_FETCH_BASE: "https://pushy-clipboard.github.io/?" = "https://pushy-clipboard.github.io/?"

Fake fetch base path

Const URL_SEARCH_BASE

URL_SEARCH_BASE: "https://www.google.com/search?q=" = "https://www.google.com/search?q="

Google search base path

clients

clients: any

Let msgArr

msgArr: IGaeMsg[] = []

Temporary variable to help get all messages at Chrome start-up

remarks

Normally, can't use globals in service worker, but this is only used when Chrome first starts up. Pretty sure it won't be stopped during this time could use indexedDB if we really have to

Functions

doFakeFetch

  • doFakeFetch(dataArray: IGaeMsg[]): Promise<Response>

getDeviceName

  • getDeviceName(data: IGaeMsg): string
  • Get the name of the Device who sent the message

    Parameters

    Returns string

    device name

getIcon

  • Get the icon for the notification

    Parameters

    Returns string

    path to icon

getPageRoute

  • getPageRoute(icon: string): string
  • Get the page route from the icon

    Parameters

    • icon: string

      notification icon

    Returns string

    page route in {@link AppMain}

getTag

  • Get the tag for the notification

    Parameters

    Returns string

    notification tag

postRouteMessage

  • postRouteMessage(client: ServiceWorker, icon: string): void
  • Post a message about the page route to display

    Parameters

    • client: ServiceWorker

      our client window

    • icon: string

      notification icon

    Returns void

sendNotificationData

  • sendNotificationData(dataArray: IGaeMsg[]): Promise<void | Response>
  • Send any data attached to a notification to the extension

    Parameters

    • dataArray: IGaeMsg[]

      possible array of message objects

    Returns Promise<void | Response>

Generated using TypeDoc