psd.js icon indicating copy to clipboard operation
psd.js copied to clipboard

how can i use it with cdnjs in brower?

Open otary opened this issue 2 years ago • 1 comments

<html>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/psd.js/3.4.0/psd.min.js"></script>
</html>

console.log(window.PSD)  // => null 

how can i use it with cdnjs in brower?

otary avatar Nov 03 '23 15:11 otary

@otary: Try waiting for the page to load. For me this works:

<script src="https://cdnjs.cloudflare.com/ajax/libs/psd.js/3.4.0/psd.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
    const PSD = require('psd');
    // ...
});
</script>

sorbing avatar Nov 06 '23 16:11 sorbing