this post was submitted on 20 Nov 2024
3 points (100.0% liked)

Casual Perchance

95 readers
1 users here now

Casual Perchance

A nonspecific casual place for anything Perchance, including generator outputs, memes, prompts, casual discussion, advertising your generator, and anything else you wouldn't post in the more technical Perchance Forum.

This is where to post Community Events.

Resources:


Rules:

founded 9 months ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 1 month 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