I’ve just been working on developing a way to fire a JavaScript event on a video element whenever the video loops back to the start (or the user plays the video back after it has ended) for one of my projects. I’ve been searching for ways to do it online but none of them worked for me, so I decided to invent my own solution. It took many hours to make until it works well enough for me, as JavaScript naturally doesn’t have its own onloop event handler. Might not necessarily related to Perchance, just wanted to share something unusual.

Here’s a simple demonstration: https://perchance.org/custom-onloop-event-demo#edit

What are your thoughts about this?

  • allo@lemmy.worldM
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 day ago

    can only speak for myself but I enjoy seeing it.

    thoughts:

    • eager to see what you do when fluent in making custom objects.
    • nice passing of function as parameter; much potential
    • hint: you can pass functions to an array of functions and then iterate thru every function in the array to make a ‘listener’ able to handle any number of functions instead of 1