Skip to content

Commit

Permalink
Fix global ReferenceError (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
mantoni committed Oct 21, 2019
1 parent 44a8d16 commit 049efd8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lolex-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,9 @@ function withGlobal(_global) {
return doTick(tickValue, false);
};

if (typeof global.Promise !== "undefined") {
if (typeof _global.Promise !== "undefined") {
clock.tickAsync = function tickAsync(ms) {
return new global.Promise(function(resolve, reject) {
return new _global.Promise(function(resolve, reject) {
originalSetTimeout(function() {
try {
doTick(ms, true, resolve, reject);
Expand Down Expand Up @@ -987,9 +987,9 @@ function withGlobal(_global) {
}
};

if (typeof global.Promise !== "undefined") {
if (typeof _global.Promise !== "undefined") {
clock.nextAsync = function nextAsync() {
return new global.Promise(function(resolve, reject) {
return new _global.Promise(function(resolve, reject) {
originalSetTimeout(function() {
try {
var timer = firstTimer(clock);
Expand Down Expand Up @@ -1050,9 +1050,9 @@ function withGlobal(_global) {
return clock.tick(getTimeToNextFrame());
};

if (typeof global.Promise !== "undefined") {
if (typeof _global.Promise !== "undefined") {
clock.runAllAsync = function runAllAsync() {
return new global.Promise(function(resolve, reject) {
return new _global.Promise(function(resolve, reject) {
var i = 0;
function doRun() {
originalSetTimeout(function() {
Expand Down Expand Up @@ -1106,9 +1106,9 @@ function withGlobal(_global) {
return clock.tick(timer.callAt - clock.now);
};

if (typeof global.Promise !== "undefined") {
if (typeof _global.Promise !== "undefined") {
clock.runToLastAsync = function runToLastAsync() {
return new global.Promise(function(resolve, reject) {
return new _global.Promise(function(resolve, reject) {
originalSetTimeout(function() {
try {
var timer = lastTimer(clock);
Expand Down

0 comments on commit 049efd8

Please sign in to comment.