Skip to content

Instantly share code, notes, and snippets.

@MacLeek
Created July 15, 2017 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MacLeek/fbb27cfa63c3b37d0b7d8a3e64aa1165 to your computer and use it in GitHub Desktop.
Save MacLeek/fbb27cfa63c3b37d0b7d8a3e64aa1165 to your computer and use it in GitHub Desktop.
V2_F_AWAY
var initialValue = 99999;
var initialized = false;
window.addEventListener("devicelight", function (event) {
var luminosity = event.value;
if (!initialized) {
if (initialValue > luminosity) {
initialValue = luminosity;
}
} else {
if (luminosity - initialValue > 10) {
console.log("The fuck you looking at?");
}
}
console.log(luminosity);
});
console.log("Please move away in 10s now!");
setTimeout(function () {
initialized = true;
console.log("Initialized!");
}, 10000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment