From 989acb8febe31d8a8b8a0ce3b9f6df91e2506f5d Mon Sep 17 00:00:00 2001 From: rock Date: Sat, 13 Jun 2015 17:11:46 +0600 Subject: [PATCH] fix conflict with webpack dev server, IE11 case, close #62 --- library/modules/es6.promise.js | 9 ++++++--- modules/es6.promise.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/library/modules/es6.promise.js b/library/modules/es6.promise.js index 9394941d13ea..15e570ee772e 100644 --- a/library/modules/es6.promise.js +++ b/library/modules/es6.promise.js @@ -74,7 +74,8 @@ function isThenable(it){ } function notify(record){ var chain = record.c; - if(chain.length)asap(function(){ + // strange IE + webpack dev server bug - use .call(global) + if(chain.length)asap.call(global, function(){ var value = record.v , ok = record.s == 1 , i = 0; @@ -120,7 +121,8 @@ function $reject(value){ record.s = 2; record.a = record.c.slice(); setTimeout(function(){ - asap(function(){ + // strange IE + webpack dev server bug - use .call(global) + asap.call(global, function(){ if(isUnhandled(promise = record.p)){ if(cof(process) == 'process'){ process.emit('unhandledRejection', value, promise); @@ -141,7 +143,8 @@ function $resolve(value){ record = record.r || record; // unwrap try { if(then = isThenable(value)){ - asap(function(){ + // strange IE + webpack dev server bug - use .call(global) + asap.call(global, function(){ var wrapper = {r: record, d: false}; // wrap try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); diff --git a/modules/es6.promise.js b/modules/es6.promise.js index 9394941d13ea..15e570ee772e 100644 --- a/modules/es6.promise.js +++ b/modules/es6.promise.js @@ -74,7 +74,8 @@ function isThenable(it){ } function notify(record){ var chain = record.c; - if(chain.length)asap(function(){ + // strange IE + webpack dev server bug - use .call(global) + if(chain.length)asap.call(global, function(){ var value = record.v , ok = record.s == 1 , i = 0; @@ -120,7 +121,8 @@ function $reject(value){ record.s = 2; record.a = record.c.slice(); setTimeout(function(){ - asap(function(){ + // strange IE + webpack dev server bug - use .call(global) + asap.call(global, function(){ if(isUnhandled(promise = record.p)){ if(cof(process) == 'process'){ process.emit('unhandledRejection', value, promise); @@ -141,7 +143,8 @@ function $resolve(value){ record = record.r || record; // unwrap try { if(then = isThenable(value)){ - asap(function(){ + // strange IE + webpack dev server bug - use .call(global) + asap.call(global, function(){ var wrapper = {r: record, d: false}; // wrap try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));