mobx#makeObservable JavaScript Examples

The following examples show how to use mobx#makeObservable. 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-manager.js    From albedo with MIT License 6 votes vote down vote up
constructor() {
        makeObservable(this, {
            selectorVisible: observable,
            activeAccount: observable,
            accounts: observable.shallow,
            setActiveAccount: action,
            loadAvailableAccounts: action,
            addAccount: action
        })
    }
Example #2
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 #3
Source File: account.js    From albedo with MIT License 6 votes vote down vote up
constructor(params) {
        super(params)
        this.accountType = ACCOUNT_TYPES.EPHEMERAL_ACCOUNT
        this.friendlyName = 'Stellar account'
        makeObservable(this, {
            secret: observable,
            setSecret: action
        })
    }
Example #4
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 #5
Source File: authorization.js    From albedo with MIT License 6 votes vote down vote up
constructor() {
        makeObservable(this, {
            dialogOpen: observable,
            reset: action,
            requestAuthorization: action
        })
        this.sessions = {}

        setTimeout(() => { //TODO: address the loading sequence problem and rewrite this dirty hack
            navigation.history.listen((location, action) => {
                this.dialogOpen = false // hide auth dialog when navigation occurred
            })
        }, 200)

        setInterval(() => {
            const now = new Date().getTime()
            for (let key of Object.keys(this.sessions))
                if (this.sessions[key].expires < now) {
                    delete this.sessions[key]
                }
        }, 5000)
    }
Example #6
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 #7
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 #8
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 #9
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 #10
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,
    });
  }
Example #11
Source File: CloudStore.js    From lens-extension-cc with MIT License 5 votes vote down vote up
constructor() {
    super({
      configName: 'cloud-store',
      defaults: CloudStore.getDefaults(),
    });
    makeObservable(this);
  }
Example #12
Source File: SyncStore.js    From lens-extension-cc with MIT License 5 votes vote down vote up
constructor() {
    super({
      configName: 'sync-store',
      defaults: SyncStore.getDefaults(),
    });
    makeObservable(this);
  }
Example #13
Source File: notifications.js    From albedo with MIT License 5 votes vote down vote up
constructor() {
        makeObservable(this, {
            notification: observable,
            showNotification: action,
            closeNotification: action
        })
    }