mliebelt / pgn-viewer

Simple PGN viewer with the necessary features to display chess games
GNU General Public License v3.0
163 stars 44 forks source link

Allow notification to PgnViewerJS events #176

Open mliebelt opened 4 years ago

mliebelt commented 4 years ago

It would be nice to have the option to get notified when some event happens: like DOM events in the browser, but events triggered by the UI or the user. So the following events could be useful:

I would be interested which kind of events are of any interest to the ones, that want to use PgnViewerJS as a library in their own application.

mliebelt commented 4 years ago

See https://stackoverflow.com/questions/15308371/custom-events-model-without-using-dom-events-in-javascript# for a nice short explanation how events can be integrated easily.

So one of the many proposals will be taken, so that at the end, the user of PgnViewerJS may register his event handlers by using something like (pseudo code):

let moveHandler = function (move) { ... here is your code ...}
let config = { moveMade: moveHandler, ...}
PGNV.pgnView('board', config)
mliebelt commented 6 months ago

I have asked ChatGPT, and the recommendations were: