Contenu connexe
Similaire à Firefox OSアプリ開発ハンズオン(Hello World編) (20)
Plus de Noritada Shimizu (18)
Firefox OSアプリ開発ハンズオン(Hello World編)
- 47. var indicator;
var displayBrightness = function(element, value){
element.textContent = value;
};
var handleDeviceLightEvent = function(event){
var lux = event.value;
if(indicator != null){
displayBrightness(indicator, lux);
}
};
window.addEventListener("devicelight", handleDeviceLightEvent);
- 48. var initApp = function(){
indicator = document.querySelector("h1");
};
window.addEventListener("load", initApp);
- 49. var indicator;
var displayBrightness = function(element, value){
element.textContent = value;
};
var handleDeviceLightEvent = function(event){
var lux = event.value;
if(indicator != null){
displayBrightness(indicator, lux);
}
};
window.addEventListener("devicelight", handleDeviceLightEvent);