Skip to content

Instantly share code, notes, and snippets.

@gorhgorh
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save gorhgorh/8916319 to your computer and use it in GitHub Desktop.

Select an option

Save gorhgorh/8916319 to your computer and use it in GitHub Desktop.
Modernizr test for leap motion
function checkLeap () {
// Hard dependency on websockets; quick exit if not supported
if (!Modernizr.websockets) {
Modernizr.addTest('leap', false);
}
// Try and connect to the leap daemon
var ws = new WebSocket("ws://localhost:6437/");
ws.onopen = function(event) {
Modernizr.addTest('leap', true);
};
ws.onerror = function(event) {
Modernizr.addTest('leap', false);
};
}
checkLeap();
@stucox
Copy link

stucox commented Feb 11, 2014

Modernizr.load isn’t deprecated yet – but will be from v3.0.0. In v2.x you need to include it explicitly via the builder on http://modernizr.com/download though (in the “Extras” section on the right hand side).

@gorhgorh
Copy link
Author

ahh ok, i'm using the plain development version right now, planned on making a modular build later, i guess it is not included in it.

thanks for this wondefull tool by the way :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment