DEV Community

Cover image for tsParticles 2.11.0 Released
Matteo Bruni for tsParticles

Posted on

tsParticles 2.11.0 Released

tsParticles 2.11.0 Changelog

Bug Fixes

  • Removed console log, closes #5003
  • Fixed getPositionOrSize function
  • Fixed some shapes

New Features

  • Added refresh flag for loading plugins, this will prevent multiple refresh of the instance
  • Added animated gif support to image drawer (use it with caution, gifs are heavy)
  • Added setLogger and getLogger functions, this will prevent console.log mistakenly left in the code.
  • Added export plugins, previous export functions were removed (barely used), and a 3 new plugins are available. The available exports plugin are: Image, JSON, Video. The first two were already present, the third one is new.
  • Added new rounded polygon shape

Other Changes

  • Removed fallbacks for requestAnimationFrame, they're useless.
  • Added tree shaking capabilities
  • Added ESLint no-console rule, to avoid other issues likes #5003, getLogger must be used when needed some logs.

How do setLogger and getLogger functions work?

If you want to customize the log of tsParticles you can call setLogger(logger) function, passing a ILogger object.

The setLogger function prevents undefined properties assigning the default one.

setLogger({
    debug: console.debug,
    error: console.error,
    info: console.info,
    log: console.log,
    verbose: console.log,
    warning: console.warn,
});
Enter fullscreen mode Exit fullscreen mode

This assigns all the log functions console functions, but you can use empty functions (() => {}) to disable every function.

If there's a console.log left like in #3552, #3528 or #5003, you can disable the log property of the setLogger parameter to get rid of it, so you don't have to wait the next release.

The getLogger function, returns the object set using setLogger, every plugin MUST use getLogger() for logging things, so mistakes can be fixed easily, even errors can be muted or redirected to your favorite logging platform.

If you want to log something use this code:

getLogger().log("tsParticles is awesome");
Enter fullscreen mode Exit fullscreen mode

--

Social links


GitHub logo matteobruni / tsparticles

tsParticles - Easily create highly customizable JavaScript particles effects, confetti explosions and fireworks animations and use them as animated backgrounds for your website. Ready to use components available for React.js, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno, Solid, Riot and Web Components.

Top comments (0)