DEV Community 👩‍💻👨‍💻

Cover image for Monster 1.29 released
Volker Schukai for schukai GmbH

Posted on

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

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.

All DEV content is created by the community!

Hey, if you're landing here for the first time, you should know that this website is a global community of folks who blog about their experiences to help folks like you out.

Sign up now if you're curious. It's free!