chanind / hanzi-writer

Chinese character stroke order animations and practice quizzes
https://hanziwriter.org
MIT License
3.47k stars 539 forks source link

adding a getCharacterData() method for easier access to loaded character data #223

Closed chanind closed 3 years ago

chanind commented 3 years ago

This PR adds a method writer.getCharacterData(), which returns a promise containing the parsed character data after it's loaded. This is to provide a more usable method to get info about the currently loaded character without needing to do anything hacky around reading internals like writer._character. This promise will always return the character data or error if it's not possible.

This character data contains the currently loaded character symbol (ex ), and an array of strokes containing the stroke data needed to render the character. This is probably most useful to determine how many strokes there are in the character.

related to #222

chanind commented 3 years ago

:tada: This PR is included in version 3.1.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: