added update method to JavaScript lib