Allow objects to be passed to `on`.

Use `Object.prototype.toString` to check object types.