UNPKG

capacitor-webview-print

Version:

This is a Capacitor plugin for printing the webview. It supports the Web, iOS and Android Platform.

25 lines (19 loc) 677 B
'use strict'; var core = require('@capacitor/core'); const WebviewPrint = core.registerPlugin('WebviewPrint', { web: () => Promise.resolve().then(function () { return web; }).then(m => new m.WebviewPrintWeb()), }); class WebviewPrintWeb extends core.WebPlugin { async print(options) { const documentTitleTemp = document.title; document.title = options.name; window.onafterprint = () => (document.title = documentTitleTemp); return window.print(); } } var web = /*#__PURE__*/Object.freeze({ __proto__: null, WebviewPrintWeb: WebviewPrintWeb }); exports.WebviewPrint = WebviewPrint; //# sourceMappingURL=plugin.cjs.js.map