dashed-slug.net › Forums › General discussion › Adding a knockout.js data binding on the balance template › Reply To: Adding a knockout.js data binding on the balance template
February 11, 2022 at 7:40 am
#11457
alexg
Keymaster
If you want to hook into an event, you could subscribe to the observable for the selected currency:
wp.wallets.viewModels.wallets.selectedCoin.subscribe(
function() {
let coin = wp.wallets.viewModels.wallets.coins()[ wp.wallets.viewModels.wallets.selectedCoin() ];
let html = '<span class="button" href="?symbol=' + coin.symbol + '&balance=' + coin.balance + '">' + coin.name + '</span>';
console.log( html);
}
);
Not sure if this is what you are looking for. Again sorry, I know all of this is confusing, which is why I am currently improving it.