GlitchedWriter is not defined
PubliAlex opened this issue · comments
Hello,
I'm trying to use GlitchedWriter but can't make it works.
I load it using the CDN, like that :
<script src="https://cdn.jsdelivr.net/npm/glitched-writer/lib/index.min.js"></script>
Then I try to instanciate it using the example code :
const Writer = new GlitchedWriter('#glitch-this', {}, (string, writerData) => {
console.log(`Current string: ${string}`)
console.log('All the class data:', writerData)
})
But I get an error :
Uncaught ReferenceError: GlitchedWriter is not defined
Could you please help me to instanciate GlitchedWriter correctly ?
Thank you
Thanks for the issue.
Unfortunately, the code fetched by jsdelivr wasn't correct, but it should work fine now.
Please use the link https://cdn.jsdelivr.net/npm/glitched-writer@2.0.22/lib/index.min.js, for now, because the default one will still point to version 2.0.21 for some time.
Then see if you can access GlitchedWriter:
console.log(GlitchedWriter)
If the module is imported, You should see a module object, like this:
Now, to create instance, use the create method inside GlitchedWriter. ("new GlitchedWriter()" won't work here)
const writer = GlitchedWriter.create('#glitch_this')
writer.write('Now, this should work!')
Let me know if it helped :)
Thank you very much, it works