Firefox Tomorrow

web api instance method

PushMessageData: text() method

View on MDN ↗

Secure contextAvailable in workers

The text() method of the PushMessageData interface extracts push message data as a plain text string.

Syntax

text()

Parameters

None.

Return value

A string.

Examples

self.addEventListener("push", (event) => {
  const textObj = event.data.text();

  // do something with your text
});

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.