WmmText.js
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.
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.
Methods
()#
attributeChangedCallbackNative event that fires when element attribute changes. Handle 'media' attribute when changed.
- Source:
()#
connectedCallbackInitializes component when inserted into DOM.
- Source:
()#
disconnectedCallbackStops monetization when component is removed from DOM.
- Source:
()#
initNotificationsBinds 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:
()#
parseMediaInitialize frontend mode, if 'media' attribute exists. In frontend mode the text is parsed from 'media' attribute, and not loaded from the backend.
- Source:
()#
startLoadingTextCreates an IntersectionObserver, that calls loadParagraph() when the last paragragh is visible on the screen.
- Source: