UNPKG

@prodbirdy/mockup-generator

Version:

Serverless-optimized TypeScript SDK for generating high-quality product mockups from PSD templates

1 lines 884 B
var Photopea={initEmbed:async function(e,n){var t=document.createElement("iframe");t.style.border="0",t.style.width="100%",t.style.height="100%",t.src=n?"https://www.photopea.com#"+encodeURI(n):"https://www.photopea.com",e.appendChild(t);var a=new Promise(function(e,n){var a=function(n){e(t),window.removeEventListener("message",a)};window.addEventListener("message",a)});return await a},runScript:async function(e,n){var t=new Promise(function(n,t){var a=[],s=function(t){t.source==e&&(a.push(t.data),"done"==t.data&&(n(a),window.removeEventListener("message",s)))};window.addEventListener("message",s)});return e.postMessage(n,"*"),await t},addBinaryAsset:async function(e,n){var t=new Promise(function(n,t){var a=function(t){t.source==e&&"done"==t.data&&(n(!0),window.removeEventListener("message",a))};window.addEventListener("message",a)});return e.postMessage(n,"*"),await t}};