DEV Community

Cover image for tsParticles 2.11.0 Released
Matteo Bruni for tsParticles

Posted on

6 4 4 4 4

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.

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay