mobx#computed JavaScript Examples

The following examples show how to use mobx#computed. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: account.js    From albedo with MIT License 6 votes vote down vote up
/**
     * Create an Account instance from the stored account data
     * @param {Object} params - An object containing account properties
     */
    constructor(params) {
        makeObservable(this, {
            friendlyName: observable,
            displayName: computed,
            shortDisplayName: computed,
            requestAccountSecret: action
        })

        Object.assign(this, params)
    }
Example #2
Source File: action-context.js    From albedo with MIT License 6 votes vote down vote up
constructor() {
        makeObservable(this, {
            status: observable,
            intentRequests: observable,
            origin: observable,
            networkParams: observable,
            intentParams: observable.shallow,
            intentErrors: observable,
            runtimeErrors: observable,
            requestedPubkey: observable,
            selectedAccount: observable,
            selectedAccountInfo: observable,
            isBatchRequest: computed,
            reset: action,
            setIntentError: action,
            confirmRequest: action,
            setStatus: action,
            selectAccount: action,
            cancelAction: action,
            loadSelectedAccountInfo: action
        })
    }
Example #3
Source File: intent-request.js    From albedo with MIT License 6 votes vote down vote up
constructor(intent, intentParams) {
        this.intent = intent
        this.intentParams = intentParams
        makeObservable(this, {
            intent: observable,
            intentParams: observable.shallow,
            txContext: observable,
            intentErrors: observable,
            requiresExistingAlbedoAccount: computed,
            autoSubmitToHorizon: computed,
            setTxContext: action
        })
    }
Example #4
Source File: account-ledger-data.js    From albedo with MIT License 6 votes vote down vote up
constructor() {
        makeObservable(this, {
            address: observable,
            network: observable,
            history: observable,
            accountData: observable.ref,
            balances: observable.ref,
            pendingLiabilities: observable.ref,
            notificationCounters: observable,
            init: action,
            reset: action,
            error: observable,
            loaded: observable,
            nonExisting: observable,
            balancesWithPriority: computed
        })
        this.pendingLiabilities = {}
        this.balances = {}
    }
Example #5
Source File: account-transactions-history.js    From albedo with MIT License 6 votes vote down vote up
constructor(network, address) {
        this.address = address
        this.network = network
        this.records = []
        makeObservable(this, {
            records: observable,
            loadingNextPagePromise: observable.ref,
            loadNextPage: action,
            startStreaming: action,
            addInProgressTx: action,
            addNewTx: action,
            removeInProgressTx: action,
            loading: computed
        })
    }
Example #6
Source File: tx-context.js    From albedo with MIT License 6 votes vote down vote up
/**
     * Initialize transaction execution context for an intent request.
     * @param {Transaction} transaction
     * @param {Object} intentParams
     * @param {StellarNetworkParams} networkParams
     */
    constructor(transaction, intentParams, networkParams) {
        makeObservable(this, {
            availableSigners: observable.shallow,
            signatures: observable.shallow,
            signatureSchema: observable,
            setAvailableSigners: action,
            isFullySigned: computed,
            isPartiallySigned: computed,
            setTxSourceAccount: action,
            setTxSequence: action,
            removeSignatureByKey: action,
            removeSignatureByHint: action,
            updateSignatureSchema: action,
            sign: action
        })

        this.tx = transaction
        //TODO: retrieve pre-set signatures from tx
        this.signatures = [...transaction.signatures]
        this.availableSigners = []
        this.mapSignatureKeys()
    }
Example #7
Source File: extensions.js    From lens-extension-cc with MIT License 5 votes vote down vote up
constructor(props) {
    super(props);
    makeObservable(this, {
      selectedOption: computed,
      options: computed,
    });
  }