/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/zone.js/test/performance/promise.js
63 строки
2 KB
Joey Perrott
refactor: update license text to point to angular.dev (#57901)
24 сен 2024, 16:33
24 сен 2024, 16:33
9dbe6fc
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC 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.dev/license */ (function (_global) { var mark = _global['__zone_symbol__mark']; var measure = _global['__zone_symbol__measure']; var testRunner = _global['__zone_symbol__testRunner']; var zone = _global['__zone_symbol__callbackZone']; var nativePromise = _global['__zone_symbol__Promise']; var resolved = Promise.resolve(1); var nativeResolved = nativePromise.resolve(1); var testTarget = { title: 'Promise', times: 10, before: function () { _global['__zone_symbol__callbackContext'].measureName = 'Promise_callback'; _global['__zone_symbol__callbackContext'].type = 'microTask'; _global['__zone_symbol__callbackContext'].source = 'Promise.then'; }, apis: [ { supportClear: false, isAsync: true, method: 'Promise', nativeMethod: 'native_Promise', run: function () { return resolved.then(function () {}); }, nativeRun: function () { return nativeResolved['__zone_symbol__then'](function () {}); }, }, { isCallback: true, isAsync: true, supportClear: false, method: 'Promise_callback', nativeMethod: 'native_Promise_callback', run: function () { return zone.run(function () { return Promise.resolve(1).then(function (v) { return v; }); }); }, nativeRun: function () { var func = function () {}; return _global['__zone_symbol__Promise'].resolve(1)['__zone_symbol__then'](function () { mark('native_Promise_callback'); var result = func.apply(this, arguments); measure('native_Promise_callback', 'native_Promise_callback'); return result; }); }, }, ], }; return testRunner(testTarget); })(typeof window === 'undefined' ? global : window);