Created
January 9, 2016 11:48
-
-
Save janx/8a82c4294421daef347c to your computer and use it in GitHub Desktop.
Web3.js event watch problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if 2nd arg is 'latest', everything is fine | |
var event = book.NewRecord(null, 'latest'); | |
//event.get(function(err, results) { | |
// console.log(results); | |
//}); | |
event.watch(function(err, result) { | |
if(err) { | |
console.log("error:", err); | |
} else { | |
console.log(result); | |
} | |
}); | |
// if 2nd arg is {fromBlock: 0, ...}, I get infinite errors on line#23: | |
// error: Error: Can only serialize integers(...) | |
var event = book.NewRecord(null, {fromBlock: 0, toBlock: 'latest'}); | |
//event.get(function(err, results) { | |
// console.log(results); | |
//}); | |
event.watch(function(err, result) { | |
if(err) { | |
console.log("error:", err); | |
} else { | |
console.log(result); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment