Fix example code on Readme

The current example code is not working, this patch updates the example based on the demo.js.