launch price check on start
This commit is contained in:
parent
ddeb3fa9b2
commit
9b1430a119
1 changed files with 21 additions and 16 deletions
|
|
@ -124,29 +124,34 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getPrice: function () {
|
||||||
|
self = this
|
||||||
|
if ('{{ copilot.show_price }}' != 'None') {
|
||||||
|
LNbits.api
|
||||||
|
.request('GET', 'https://api.opennode.com/v1/rates', 'filla')
|
||||||
|
.then(function (response) {
|
||||||
|
self.price = String(
|
||||||
|
new Intl.NumberFormat('en-US', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'USD'
|
||||||
|
}).format(response.data.data.BTCUSD.USD)
|
||||||
|
)
|
||||||
|
console.log(self.price)
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
animation1: function () {
|
animation1: function () {
|
||||||
self = this
|
self = this
|
||||||
|
self.getPrice
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
self.connection.send('')
|
self.connection.send('')
|
||||||
self.counter++
|
self.counter++
|
||||||
if (self.counter % 20 === 0) {
|
if (self.counter % 20 === 0) {
|
||||||
if ('{{ copilot.show_price }}' != 'None') {
|
self.getPrice
|
||||||
LNbits.api
|
|
||||||
.request('GET', 'https://api.opennode.com/v1/rates', 'filla')
|
|
||||||
.then(function (response) {
|
|
||||||
self.price = String(
|
|
||||||
new Intl.NumberFormat('en-US', {
|
|
||||||
style: 'currency',
|
|
||||||
currency: 'USD'
|
|
||||||
}).format(response.data.data.BTCUSD.USD)
|
|
||||||
)
|
|
||||||
console.log(self.price)
|
|
||||||
})
|
|
||||||
.catch(function (error) {
|
|
||||||
LNbits.utils.notifyApiError(error)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue