chanind / hanzi-writer

Chinese character stroke order animations and practice quizzes

Home Page:https://hanziwriter.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get writer index from callback

fxpar opened this issue · comments

Hi,
I have multiple writers (looping on all characters in an expression).
How to get the index of the current writer when there is a mistake?

writer[i].quiz({
	onMistake: function(strokeData) {
    		console.log('currentWriterIndex:' + ???);
	},

I did get something with writer.findIndex(({_char}) => _char === strokeData.character); but it won't work with expressions with repetitive characters like 哥哥 or 弟弟.

Thanks for your help.