Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 14 additions & 26 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,26 @@
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
/* global define */

(function () {
'use strict';
'use strict';

var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);

var ExecutionEnvironment = {
var ExecutionEnvironment = {

canUseDOM: canUseDOM,
canUseDOM: canUseDOM,

canUseWorkers: typeof Worker !== 'undefined',
canUseWorkers: typeof Worker !== 'undefined',

canUseEventListeners:
canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseEventListeners:
canUseDOM && !!(window.addEventListener || window.attachEvent),

canUseViewport: canUseDOM && !!window.screen
canUseViewport: canUseDOM && !!window.screen

};
};

if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
define(function () {
return ExecutionEnvironment;
});
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = ExecutionEnvironment;
} else {
window.ExecutionEnvironment = ExecutionEnvironment;
}

}());
module.exports = ExecutionEnvironment;