mirror of
https://github.com/embarklabs/subspace.git
synced 2025-02-03 02:04:06 +00:00
if property is methodArgs is not an array transform it into one
This commit is contained in:
parent
06617898ec
commit
52aac845f1
2
examples/react-example1/src/App.js
vendored
2
examples/react-example1/src/App.js
vendored
@ -28,7 +28,7 @@ class App extends React.Component {
|
|||||||
window.web3 = web3;
|
window.web3 = web3;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
title: subspace.trackProperty(Product, "products", [0]).pipe(map(x => x.title)),
|
title: subspace.trackProperty(Product, "products", 0).pipe(map(x => x.title)),
|
||||||
averageRating: rating$.pipe($average()),
|
averageRating: rating$.pipe($average()),
|
||||||
minRating: rating$.pipe($min()),
|
minRating: rating$.pipe($min()),
|
||||||
maxRating: rating$.pipe($max()),
|
maxRating: rating$.pipe($max()),
|
||||||
|
@ -95,6 +95,10 @@ export default class Subspace {
|
|||||||
trackProperty(contractInstance, propName, methodArgs = [], callArgs = {}) {
|
trackProperty(contractInstance, propName, methodArgs = [], callArgs = {}) {
|
||||||
const sub = new ReplaySubject();
|
const sub = new ReplaySubject();
|
||||||
|
|
||||||
|
if (!Array.isArray(methodArgs)) {
|
||||||
|
methodArgs = [methodArgs]
|
||||||
|
}
|
||||||
|
|
||||||
const method = contractInstance.methods[propName].apply(contractInstance.methods[propName], methodArgs)
|
const method = contractInstance.methods[propName].apply(contractInstance.methods[propName], methodArgs)
|
||||||
const callContractMethod = () => {
|
const callContractMethod = () => {
|
||||||
method.call.apply(method.call, [callArgs, (err, result) => {
|
method.call.apply(method.call, [callArgs, (err, result) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user