Easy Function For GetElementById
function $(id){ return document.getElementById(id); }
Make Canvas Listen for key event
function $(id){ return document.getElementById(id); }
$('canvas').setAttribute('tabindex','10');
$('canvas').focus();
Make Div Full With Screen
For <div class=”App”></div>:
.App {
text-align: center;
border: 1px solid #F00;
height: 100vh;
width: 100vw;
}
Create URL For Uploaded File
function getObjectURL(file) {
var url = null ;
if (window.createObjectURL !== undefined) { // basic
url = window.createObjectURL(file) ;
} else if (window.URL !== undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file) ;
} else if (window.webkitURL !== undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file) ;
}
return url ;
}