Update the code of JS samples for the new version of engine.