I use the following JS code to get notified of Solidity events and it works well for incoming new events:
myContract.myEvent().watch((error, result) => {
if (error)
console.log('Error in myEvent event handler: ' + error);
else
console.log('myEvent: ' + JSON.stringify(result.args));
});
I would like to use the same code for initializing the JS app on startup. e.g. I start the JS app on block 100 but there were already some events fired at block 20 and 30. These two past events are not being processed with the code above. As alternatives, I also tried via
myContract.myEvent((error, result) => {
and
myContract.myEvent({fromBlock: 0, toBlock: 'latest'}, (error, result) => {
Still these two options don't give me past events.
{}
in the parameter as demonstrated in ethereum.stackexchange.com/a/4453/1268 – The Officious BokkyPooBah Feb 2 '17 at 15:45drelContract.PropertyAdded({}, { fromBlock: 0, toBlock: 'latest' }).get((error, result) => { console.log('!!! event handler: ' + JSON.stringify(result));});
– SCBuergel.eth Feb 2 '17 at 16:09