Define missing onerror callback

The first commit adds strict mode and jshint config, and some changes to remove the jshint warnings.

The second commit defines the "onerror" callback when it's missing.