'use strict';
function echo( msg ) {
console.log( msg );
document.getElementById('output').innerHTML += msg+'
';
}
window.addEventListener(
'load',
function() {
function checkMember( name, type ) {
if( globalThis[name] || globalThis.hasOwnProperty(name) ) {
var tmpType = typeof globalThis[name];
if( tmpType === type )
echo("globalThis["+name+"] is of type '" + type + "'" );
else
echo("globalThis["+name+"] is NOT of type '" + type + "' ('" + tmpType + "')" );
} else {
echo("globalThis["+name+"] does not exists!");
}
};
echo("typeof globalThis: " + (typeof globalThis) );
checkMember( "getComputedStyle", "function" );
checkMember( "addEventListener", "function" );
// globalThis.addEventListener('keydown', function(e) { console.log('keydown'); } );
checkMember( "devicePixelRatio", "number" );
checkMember( "innerWidth", "number" );
checkMember( "innerHeight", "number" );
checkMember( "setTimeout", "function" );
}
);