Class: WmmText

WmmText()

Creates a monetized text component <wmm-text>
This component loads new paragraphs with scrolling
(i.e. when there is room to show more text).
Attributes:
* src: enpoint for retrieving the paragraphs.
* paymentUrl: Payment pointer URL, can also include receipt service url.
* media: The text can be also passed in media attribute, which don't require a backend at all, but is not secure as it is directly accessible from the browser.

Constructor

new WmmText()

Source:

Methods

attributeChangedCallback()

Native event that fires when element attribute changes. Handle 'media' attribute when changed.
Source:

connectedCallback()

Initializes component when inserted into DOM.
Source:

disconnectedCallback()

Stops monetization when component is removed from DOM.
Source:

initNotifications()

Binds to default notifications. Shown on 'paragraphPending' event and hidden on 'paragraphLoaded' event.
Source:

(async) loadParagraph()

Load the next paragragh, add it to DOM and start observing when it becomes visible (which will cause another paragraph to be loaded). When paragrah is loaded from backend, 'paragraphLoading' and 'paragraphLoaded' events will be emitted.
Source:

parseMedia()

Initialize frontend mode, if 'media' attribute exists. In frontend mode the text is parsed from 'media' attribute, and not loaded from the backend.
Source:

startLoadingText()

Creates an IntersectionObserver, that calls loadParagraph() when the last paragragh is visible on the screen.
Source: