mnater / Hyphenopoly

Hyphenation for node and Polyfill for client-side hyphenation.
http://mnater.github.io/Hyphenopoly/
MIT License
689 stars 45 forks source link

Allow loader overwrite #195

Closed StephanHoyer closed 1 year ago

StephanHoyer commented 1 year ago

Hi, first of all, great project. We really like it.

But we have a few problems integrating it. The dynamic loader gives us real troubles. We use the node-version also in the browser since we want better control over the hyphenation and pretty much only hyphenate strings and do the rendering with mithril.js.

Currently the the loader autodetects the environment. This is not really useful for us. A better option would be to have an optional argument loader which pretty much has the same signature as readFile. This would greatly improve usability. It also would allow to prefetch/embed certain lang files and treeshare the loader out of the package and rely on the user solution for loading

StephanHoyer commented 1 year ago

If you like this idea, I would create a PR for this

mnater commented 1 year ago

Hi

This sounds very interesting. The current loader feels a bit hacky and not very idiomatic (I‘m not a node pro).

I look forward to your pull request. This would be a nice feature for version 5, that I‘m currently working on…

Kind regards, Mathias

PS: feel free to communicate in german.

StephanHoyer commented 1 year ago

Ok, ich schaue wann ich das schaffe. Vermutlich aber noch diese Woche.

StephanHoyer commented 1 year ago

Noch keine Zeit gefunden. :/

mnater commented 1 year ago

Es eilt ja auch nicht. Als ich schrieb, dass das in die Version 5 reinpasst, meinte ich vor allem, dass wir damit eine grosse Freiheit haben, wenn wir das API ändern wollen...

StephanHoyer commented 1 year ago

@mnater done!

it's a minor-change