Skip to content

0.5.0

Compare
Choose a tag to compare
@catdad catdad released this 20 Nov 23:37
· 335 commits to master since this release
  • [BREAKING] confetti.Promise is no longer set by default (i.e. if you try to read this value, it will now be undefined). This property was never documented, and it has now been removed from the implementation.

Note: you can still set confetti.Promise = MyPromiseLib to use your custom promises or to polyfill promises without setting window.Promise.

  • Server-side rendering is now supported. You can safely use this module in a build that performs server-side rendering.

Note: if you want to trigger confetti() inside your render path (i.e. in the render() method of a class component or directly inside a function component), you will still need to check that you are on the client, as launching confetti is not supported on the server (for obvious reasons). Include a check such as this:

function MyComponent(props) {
  // launch some confetti when the component renders
  if (typeof window !== 'undefined') {
    confetti();
  }

  return <div>Some page content</div>;
}
class MyComponent extends React.Component {
  render() {
    // launch some confetti when the component renders
    if (typeof window !== 'undefined') {
      confetti();
    }

    return <div>Some page content</div>;
  }
}

compare: 0.4.2...0.5.0