mirror of
https://github.com/embarklabs/subspace.git
synced 2025-01-23 12:59:25 +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;
|
||||
|
||||
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()),
|
||||
minRating: rating$.pipe($min()),
|
||||
maxRating: rating$.pipe($max()),
|
||||
|
@ -95,6 +95,10 @@ export default class Subspace {
|
||||
trackProperty(contractInstance, propName, methodArgs = [], callArgs = {}) {
|
||||
const sub = new ReplaySubject();
|
||||
|
||||
if (!Array.isArray(methodArgs)) {
|
||||
methodArgs = [methodArgs]
|
||||
}
|
||||
|
||||
const method = contractInstance.methods[propName].apply(contractInstance.methods[propName], methodArgs)
|
||||
const callContractMethod = () => {
|
||||
method.call.apply(method.call, [callArgs, (err, result) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user