Programmatic API to communicate deck tool instance
Closed this issue · 1 comments
RillingDev commented
For further integrations, it will be required for other JS code to communicate with a running deck tool instance. It must be possible to retrieve deck contents and react to changes to the deck.
API
A global field yugiohDeckTool
is exposed on window
.
It has a method to get a frozen copy of the current deck state:
window.yugiohDeckTool.getDeck() // Returns deck format as stored internally
it publishes events when deck changes are made:
window.yugiohDeckTool.on("change", ()=>{}) // Called whenever *any* change is made to the deck
Ideas
- possibly check current usage of
window
and unify.
RillingDev commented