Enhaced/fixed js library. Now on_close and on_error events pass the event straight. Tests added and fixed for this too
Merge pull request #100 from imton/master

on_close and on_error events fixed