This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bluebird): patch bluebird promise and treat it as microtask (#655)
- Loading branch information
1 parent
f3b8885
commit e783bfa
Showing
8 changed files
with
704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(factory()); | ||
}(this, (function () { 'use strict'; | ||
|
||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
(function (_global) { | ||
var __symbol__ = Zone['__symbol__']; | ||
// TODO: @JiaLiPassion, we can automatically patch bluebird | ||
// if global.Promise = Bluebird, but sometimes in nodejs, | ||
// global.Promise is not Bluebird, and Bluebird is just be | ||
// used by other libraries such as sequelize, so I think it is | ||
// safe to just expose a method to patch Bluebird explicitly | ||
Zone[__symbol__('bluebird')] = function patchBluebird(Bluebird) { | ||
Bluebird.setScheduler(function (fn) { | ||
Zone.current.scheduleMicroTask('bluebird', fn); | ||
}); | ||
}; | ||
})(typeof window === 'object' && window || typeof self === 'object' && self || global); | ||
|
||
}))); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
((_global: any) => { | ||
const __symbol__ = Zone['__symbol__']; | ||
// TODO: @JiaLiPassion, we can automatically patch bluebird | ||
// if global.Promise = Bluebird, but sometimes in nodejs, | ||
// global.Promise is not Bluebird, and Bluebird is just be | ||
// used by other libraries such as sequelize, so I think it is | ||
// safe to just expose a method to patch Bluebird explicitly | ||
Zone[__symbol__('bluebird')] = function patchBluebird(Bluebird) { | ||
Bluebird.setScheduler((fn) => { | ||
Zone.current.scheduleMicroTask('bluebird', fn); | ||
}); | ||
}; | ||
})(typeof window === 'object' && window || typeof self === 'object' && self || global); |
Oops, something went wrong.