mrdoob/three.js — pull request #5523 by pehrlich (2014-10-27 20:44:21+00:00)
Title: [VREffect] Add onWindowed and onFullscreen callbacks

This allows callbacks for `onFullScreen` and `onWindowed` for VREffect. These allow users to manage VRstate changes without having to track `vrMode` themselves, which can be erroneously done (e.g. flipping state only when hotkey `f` is pressed, and ignoring the `escape` key).

Some questions present:
- It's a bit confusing to have both the done callback, and options with two more callbacks. Perhaps there's a better way to report errors?
- It's probably fine to use `bind`, as this feature is targeting new browsers, and there's (exactly) one usage of `bind` already in the THREE.js code base.

Example usage:

```javascript
vrEffect = new THREE.VREffect(renderer, null, {
onWindowed: function(){
Leap.loopController.setOptimizeHMD(false);
},
onFullscreen: function(){
Leap.loopController.setOptimizeHMD(true);
}
});
```