mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
6f581a2f2e
* OPS: randombytes work * OPS: porting to RN android: added prompt, refactoring * OPS: better android prompt * FIX: scan qr callback * FIX: correct fee sat calculation for HD & classic segwit wallets * FIX: Fixed height for button in empty transaction list * FIX: keyboard issue on fee selection modal * FIX: slow QR code generation for HD backup screen * ADD: wallet reorder * FIX: TypeError: undefined is not an object (evaluating 'recommendedFees.halfHourFee') #133 * FIX: android appstore link * OPS: Code to Migrate Expo json * REF: renamed blitzhub to lndhub * OPS: Migration: move expo files instead of parsing * FIX: lndhub uri usage * FIX: no security alert on android (it was ios specific) * REF: better tx list rendering and sorting * ADD: verify tx on coinb.in * FIX: Tap to dismiss is not working #137 * REF: Removed Wallet gradients duplication. * REF: about screen * FIX: bech32 qr scan in send screen * FIX: better bip21 handling * Use of dayjs for transaction details * REF: QR code content follows BIP21 * ADD: fee in local currency when send * FIX: Refresh wallet info on page focus
47 lines
1.8 KiB
JavaScript
47 lines
1.8 KiB
JavaScript
function EV(eventName, arg, isExclusive) {
|
|
if (Object.values(EV.enum).indexOf(eventName) === -1) {
|
|
return console.warn('Unregistered event', eventName, 'registered events:', EV.enum);
|
|
}
|
|
EV.callbacks = EV.callbacks || {}; // static variable
|
|
EV.callbacks[eventName] = EV.callbacks[eventName] || [];
|
|
|
|
if (typeof arg !== 'function') {
|
|
// then its an argument
|
|
console.log('got event', eventName, '...');
|
|
for (let cc of EV.callbacks[eventName]) {
|
|
console.log('dispatching event', eventName);
|
|
cc(arg);
|
|
}
|
|
} else {
|
|
// its a callback. subscribe it to event
|
|
console.log('someone subscribed to', eventName);
|
|
if (isExclusive) {
|
|
// if it'a an excluside subscribe - other subscribers should be terminated
|
|
console.log('exclusive subscribe');
|
|
EV.callbacks[eventName] = [];
|
|
}
|
|
EV.callbacks[eventName].push(arg);
|
|
}
|
|
}
|
|
|
|
EV.enum = {
|
|
// emitted when local wallet created or deleted, so one must redraw wallets carousel
|
|
WALLETS_COUNT_CHANGED: 'WALLETS_COUNT_CHANGED',
|
|
|
|
// emitted when local wallet (usually current wallet) has changed number of transactions
|
|
// so one must redraw main screen transactions list and WalletTransactions screen tx list
|
|
TRANSACTIONS_COUNT_CHANGED: 'TRANSACTIONS_COUNT_CHANGED',
|
|
|
|
// emitted when we know for sure that on remote server tx list
|
|
// changed (usually for current wallet)
|
|
REMOTE_TRANSACTIONS_COUNT_CHANGED: 'REMOTE_TRANSACTIONS_COUNT_CHANGED',
|
|
|
|
// emitted when QR scanner scanned address that should be used in CREATE TRANSACTION screen
|
|
// thus, previous screen (CREATE TRANSACTION screen) will update it's input content
|
|
CREATE_TRANSACTION_NEW_DESTINATION_ADDRESS: 'CREATE_TRANSACTION_NEW_DESTINATION_ADDRESS',
|
|
|
|
// RECEIVE_ADDRESS_CHANGED: 'RECEIVE_ADDRESS_CHANGED',
|
|
};
|
|
|
|
module.exports = EV;
|