Log to puppeteer from content script

This commit is contained in:
Andrew Ferrazzutti 2021-10-14 23:55:38 -04:00
parent 3887b1e296
commit 1932bca139
2 changed files with 12 additions and 0 deletions

View File

@ -22,6 +22,16 @@
* @return {Promise<Date>}
*/
window.__chronoParseDate = function (text, ref, option) {}
/**
* @param {...string} text - The objects to log.
* @return {Promise<void>}
*/
window.__mautrixLog = function (...text) {}
/**
* @param {...string} text - The objects to log.
* @return {Promise<void>}
*/
window.__mautrixError = function (...text) {}
/**
* @param {ChatListInfo[]} changes - The chats that changed.
* @return {Promise<void>}

View File

@ -126,6 +126,8 @@ export default class MessagesPuppeteer {
await this._preparePage(true)
this.log("Exposing functions")
await this.page.exposeFunction("__mautrixLog", this.log.bind(this))
await this.page.exposeFunction("__mautrixError", this.error.bind(this))
await this.page.exposeFunction("__mautrixReceiveQR", this._receiveQRChange.bind(this))
await this.page.exposeFunction("__mautrixSendEmailCredentials", this._sendEmailCredentials.bind(this))
await this.page.exposeFunction("__mautrixReceivePIN", this._receivePIN.bind(this))