albert-gonzalez/easytimer.js

Without jQuery?

Closed this issue · 2 comments

Hi there,

This utility is super useful and great to see it exist. I hadn't realized it required jQuery until I was a bit far down the implementation path, do you have any gauge as to how difficult it would be to either remove the jQuery dependency or to re-implement it in a different way without needing jQuery?

Hi!

This lib doesn't need jQuery. The examples use jQuery to get and change DOM elements but it is not required. For example:

const element = document.querySelector('.some-class');
const instance = new Timer();
instance.on('secondsUpdated', () => {
    element.textContent = instance.getTimeValues();
};
instance.start();

I hope this helps.

Best regards!

@albert-gonzalez Thanks, not sure why I got some jQuery errors when I first loaded it up, must have copied some samples too quickly. Works great, thanks for maintaining this library!