federico-moretti / canvas-free-drawing

A JavaScript library that allows you to draw in a canvas HTML element, straightforward to use and extremely lightweight.
https://www.federicomoretti.dev/projects/canvas-free-drawing
MIT License
65 stars 11 forks source link

Can not initialize version 2.* #4

Closed migmira closed 5 years ago

migmira commented 5 years ago

The example code does not work, it throws the following error:

Uncaught TypeError: CanvasFreeDrawing is not a constructor

federico-moretti commented 5 years ago

Are you installing it through npm/yarn or using the UMD file?

federico-moretti commented 5 years ago

If you were also using the example file in the repo, just change the class init to new CanvasFreeDrawing.default().

Hope this fix the problem, thank you for the bug report!