Forem

Cover image for Monster 1.29 released
Volker Schukai for schukai GmbH

Posted on

2 1

Monster 1.29 released

Today we released the latest edition of our Monster project. Monster is a collection of javascript classes that we need for daily work in our web projects.

Besides small helper functions and classes, it also provides useful functions to enable reactive programming.

Monster is available via jsdelivr and npm.

Only the highlights are described here. The full functionality can be found in the documentation.

New class DeadMansSwitch

With the help of the dead man switch you can execute a function after a certain time. this is useful for example if you don't know how many events will be fired, but you only want to react to the last one of a series.

import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.29.0

/dist/modules/util/deadmansswitch.js';

const deadmansswitch = new DeadMansSwitch(100, ()=>{
  console.log('yeah!')
  // ↦ "yeah!"
})

deadmansswitch.touch(); // from here wait again 100 ms
deadmansswitch.touch(200); // from here wait 200 ms
Enter fullscreen mode Exit fullscreen mode

hope you enjoy it!

References

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (2)

Collapse
 
bias profile image
Tobias Nickel

the functionality of DeathManSwitch is similar to underscores throttle right?

Collapse
 
volker_schukai profile image
Volker Schukai

I am not that familiar with underscore, but if i understand the documentation correctly, then yes.

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay