Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External API access #171

Closed
jvsteiner opened this issue Aug 26, 2020 · 4 comments
Closed

External API access #171

jvsteiner opened this issue Aug 26, 2020 · 4 comments
Assignees
Labels

Comments

@jvsteiner
Copy link

Hi - I would like to use this library to implement opening explorer type functionality, by connecting the board, in Edit mode, to a back end server which knows opening moves, and game outcomes - typical opening tree type information like you can see on Lichess or chess.com.

It doesn't seem, however, that I can get the current FEN string out of the object returned by PGNV.pgnEdit() - which, strangely, seems to be null. Is there any way to expose a programmatic api, for getting the current Fen, or passing in a move from an external integration, rather than visually through the UI? This latter capability would allow me to click on a move in the database results, and have that move made in the UI.

Maybe there is already a way to do this, and I am missing it?

Thanks

@jvsteiner
Copy link
Author

just an observation - after looking at the code a bit, it seems that somehow the GLOB_SCHED.schedule function, which I believe has to do with the internationalization features, prevent the exposure of the usual pgnBase public api. Therefore it should be fairly simple to just prepare my own instance, with the same initialization. I have hacked a bit, on exposing a slightly different api, for the use case I described above. When I get it done, I will PR you, which, you can take or leave as you see fit.

Thanks very much for this very excellent, and well documented project.

@mliebelt
Copy link
Owner

Thank you a lot, I will check your PR on the weekend. But great when you could help yourself!

@mliebelt
Copy link
Owner

See the ticket #174 which is a necessary pre-requisit to implement a public API. Currently (as you have noticed), no return value is given to the caller.

@mliebelt
Copy link
Owner

mliebelt commented Sep 8, 2020

have a look at modules/pgn-viewer/examples/tickets/ticket171.html that shows how to use your function manualMove to play from the outside. Hope this is what you had in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

2 participants