cfinke / Typo.js

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

Async suggest #45

Open kofifus opened 8 years ago

kofifus commented 8 years ago

This PR adds the option of running suggest asynchronously allowing updating the display with results as they come, and stopping a suggestion search midway. Also provides much faster performance and smaller memory use on both synchronous and asynchronous suggests.

The suggest function can now be called in one of three ways:

suggest(word, limit [=5])

suggest(word, limit [=5], doneFunc, progressFunc) where either doneFunc or progressFunc are defined

suggest()

Other changes:

See a working sample in plunkr

cfinke commented 7 years ago

To be honest, at this point, there are so many commits and no clear documentation of each commit that I would feel very uneasy merging in these changes.

kofifus commented 7 years ago

yeah complicated but work very well ... (and documented)

I wrote this for CodeMirror, without async there is an unacceptable wait between pressing the right click and getting the results.

see the gist here: https://gist.github.com/kofifus/4b2f79cadc871a29439d919692099406 see demo https://plnkr.co/edit/0y1wCHXx3k3mZaHFOpHT?p=info

anyways ..

MikhailTymchukDX commented 5 years ago

Personally, I don't inspect every commit when review a PR. I check "Files changed" tab only. This is very useful improvement, because on long words typo hangs entire page.