Calls to window and document in src/core/ no longer break non-browser environments

This commit is contained in:
n1474335 2017-03-30 00:40:20 +01:00
parent dd5bd5d5e7
commit 6d396dbb9e
3 changed files with 7 additions and 3 deletions

View file

@ -17,7 +17,7 @@ const UUID = {
* @returns {string}
*/
runGenerateV4: function(input, args) {
if (typeof(window.crypto) !== "undefined" && typeof(window.crypto.getRandomValues) !== "undefined") {
if (window && typeof(window.crypto) !== "undefined" && typeof(window.crypto.getRandomValues) !== "undefined") {
var buf = new Uint32Array(4),
i = 0;
window.crypto.getRandomValues(buf);