mobx#observable JavaScript Examples
The following examples show how to use
mobx#observable.
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: index.js From choerodon-front-base with Apache License 2.0 | 6 votes |
StoreProvider = (props) => {
const dsStore = [];
const { children } = props;
const value = {
...props,
dsStore: observable(props.dsStore || dsStore),
};
return (
<Store.Provider value={value}>
{children}
</Store.Provider>
);
}
Example #2
Source File: tx-context.js From albedo with MIT License | 6 votes |
/**
* 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 #3
Source File: account-transactions-history.js From albedo with MIT License | 6 votes |
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 #4
Source File: account-ledger-data.js From albedo with MIT License | 6 votes |
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: intent-request.js From albedo with MIT License | 6 votes |
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 #6
Source File: authorization.js From albedo with MIT License | 6 votes |
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 #7
Source File: action-context.js From albedo with MIT License | 6 votes |
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 #8
Source File: account.js From albedo with MIT License | 6 votes |
constructor(params) {
super(params)
this.accountType = ACCOUNT_TYPES.EPHEMERAL_ACCOUNT
this.friendlyName = 'Stellar account'
makeObservable(this, {
secret: observable,
setSecret: action
})
}
Example #9
Source File: account.js From albedo with MIT License | 6 votes |
/**
* 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 #10
Source File: account-manager.js From albedo with MIT License | 6 votes |
constructor() {
makeObservable(this, {
selectorVisible: observable,
activeAccount: observable,
accounts: observable.shallow,
setActiveAccount: action,
loadAvailableAccounts: action,
addAccount: action
})
}
Example #11
Source File: index.js From choerodon-front-base with Apache License 2.0 | 6 votes |
StoreProvider = (props) => {
const dsStore = observable([props.dsStore[0], []]);
const { children } = props;
const value = {
...props,
dsStore,
};
return (
<Store.Provider value={value}>
{children}
</Store.Provider>
);
}
Example #12
Source File: extensions.js From lens-extension-cc with MIT License | 6 votes |
Common = {
Catalog: {
KubernetesCluster,
CatalogEntity,
CatalogCategory,
catalogEntities: {
activeEntity: observable.object({}),
getItemsForCategory: () => [],
},
},
Store: {
ExtensionStore: class ExtensionStore extends Singleton {},
},
Util: {
Singleton,
getAppVersion: () => '1.0.0',
},
logger: {
// eslint-disable-next-line no-console
info: console.info,
// eslint-disable-next-line no-console
error: console.error,
// eslint-disable-next-line no-console
warn: console.warn,
// eslint-disable-next-line no-console
log: console.log,
},
EventBus: {
appEventBus: {
emit: () => {},
},
},
}
Example #13
Source File: uploader.js From content-components with Apache License 2.0 | 6 votes |
decorate(Uploader, { uploads: observable, uploadsInProgress: observable, statusWindowVisible: observable, successfulUpload: observable, getUploads: action, showStatusWindow: action, uploadFile: action, uploadFiles: action, clearCompletedUploads: action });
Example #14
Source File: routing-store.js From content-components with Apache License 2.0 | 6 votes |
decorate(RoutingStore, {
// props
page: observable,
queryParams: observable,
subView: observable,
// actions
setRouteCtx: action,
setPage: action,
setSubView: action
});
Example #15
Source File: uploader.js From content-components with Apache License 2.0 | 6 votes |
decorate(Uploader, { uploads: observable, uploadsInProgress: observable, statusWindowVisible: observable, successfulUpload: observable, getUploads: action, uploadFile: action, uploadFiles: action, clearCompletedUploads: action });
Example #16
Source File: routing-store.js From content-components with Apache License 2.0 | 6 votes |
decorate(RoutingStore, {
// props
page: observable,
queryParams: observable,
subView: observable,
// actions
setRouteCtx: action,
setPage: action,
setSubView: action
});
Example #17
Source File: extensions.js From lens-extension-cc with MIT License | 6 votes |
Renderer = {
Ipc,
Component: {
Select,
Spinner,
Notifications: {
error: () => {},
},
Button: Button,
Icon: Icon,
ConfirmDialog: {
// eslint-disable-next-line no-undef
open: jest.fn(),
},
},
Catalog: {
KubernetesCluster,
catalogEntities: {
activeEntity: observable.object({}),
},
catalogCategories: {
getForGroupKind: () => Common.Catalog.KubernetesCluster,
add: () => () => {},
},
},
K8sApi: {
KubeObject: class {},
},
}
Example #18
Source File: uploader.js From content-components with Apache License 2.0 | 5 votes |
decorate(Uploader, { uploadProgress: observable, uploadFile: action, reset: action });
Example #19
Source File: index.js From pineapple with MIT License | 5 votes |
store = observable({ })
Example #20
Source File: permission-store.js From content-components with Apache License 2.0 | 5 votes |
decorate(PermissionStore, {
// props
permissions: observable,
// actions
setPermissions: action,
});
Example #21
Source File: iap.js From react-native-iaphub with MIT License | 5 votes |
decorate(IAPStore, { isInitialized: observable, skuProcessing: observable, productsForSale: observable, activeProducts: observable })
Example #22
Source File: app.js From react-native-iaphub with MIT License | 5 votes |
decorate(AppStore, { isLogged: observable })
Example #23
Source File: dashboard-settings.js From albedo with MIT License | 5 votes |
constructor() {
makeAutoObservable(this, {currentNetwork: observable})
this.currentNetwork = 'testnet'
}
Example #24
Source File: QueryStore.jsx From graphql-sample-apps with Apache License 2.0 | 5 votes |
decorate(QueryStore, { query: observable, setQuery: action, });
Example #25
Source File: NotificationStore.js From surveillance-forms with MIT License | 5 votes |
decorate(NotificationStore, { open: observable, message: observable, durationMs: observable, onClose: observable, showMessage: action });
Example #26
Source File: LanguageStore.js From surveillance-forms with MIT License | 5 votes |
decorate(LanguageStore, { lang: observable, langCode: observable, setLanguage: action, });
Example #27
Source File: notifications.js From albedo with MIT License | 5 votes |
constructor() {
makeObservable(this, {
notification: observable,
showNotification: action,
closeNotification: action
})
}