Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i use it with cdnjs in brower? #290

Open
otary opened this issue Nov 3, 2023 · 1 comment
Open

how can i use it with cdnjs in brower? #290

otary opened this issue Nov 3, 2023 · 1 comment

Comments

@otary
Copy link

otary commented Nov 3, 2023

<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?

@sorbing
Copy link

sorbing commented Nov 6, 2023

@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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants