Hook to wallets_ready event in frontend JavaScript code

Bind JavaScript code so that it runs right after coin information is loaded in your frontend.

In the latest version 3.5.1 of Bitcoin and Altcoin Wallets you can now write JavaScript code that executes on some wallets-related event.

For example, you could choose to set the default coin, once the coin information is loaded from the JSON API. Do this like so:

jQuery( 'body' ).on( 'wallets_ready', function( event, coins, nonces ) {
    if ( 'object' === typeof coins.BTC ) {
} );

There are full instructions on this in the documentation, under the Section FrontendFrontend UI JavaScript event bindings. The documentation lists all of the available events, and sample code on how to enqueue your JavaScript file using wp_enqueue_script().


Leave a Reply

Your email address will not be published.