cfinke / Typo.js

A client-side JavaScript spellchecker that uses Hunspell-style dictionaries.
Other
501 stars 110 forks source link

Implement progress callback #62

Open miqmago opened 7 years ago

miqmago commented 7 years ago

For large dic files, there is a waiting time with no info about the progress at all.

With this pull request, there is the option to provide a progressCallback in settings:

var dictionary = new Typo("en_US", affData, wordsData, {
    progressCallback: function (objectType, i, total) {
        var pct = parseInt((10000 * i) / total, 10) / 100;
        console.log('Processing ' + objectType + ': ' + pct + '%...');
    },
}),