Import with javascript
A simple way to import the JSDelivr hosted UMD package is as follows:
import('https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.umd.js')
.then(() => {
const t = new ThumbmarkJS.Thumbmark();
t.get().then((tm) => {
console.log(tm);
});
})
Copy-paste this into the javascript console to see it in action!
And to pass Options like the API key, you'll pass them to the class constructor like so:
import('https://cdn.jsdelivr.net/npm/@thumbmarkjs/thumbmarkjs/dist/thumbmark.umd.js')
.then(() => {
const t = new ThumbmarkJS.Thumbmark({ api_key: 'xxxxxxxxxxxx' });
t.get().then((tm) => {
console.log(tm);
});
})