Skip to content

Commit

Permalink
fix conflict with webpack dev server, IE11 case, close #62
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 13, 2015
1 parent 8357099 commit 989acb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions library/modules/es6.promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand Down
9 changes: 6 additions & 3 deletions modules/es6.promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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));
Expand Down

0 comments on commit 989acb8

Please sign in to comment.