新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
27 lines
1.1 KiB
JavaScript
27 lines
1.1 KiB
JavaScript
'use strict';
|
|
var $ = require('../internals/export');
|
|
var IS_PURE = require('../internals/is-pure');
|
|
var FORCED_PROMISE_CONSTRUCTOR = require('../internals/promise-constructor-detection').CONSTRUCTOR;
|
|
var NativePromiseConstructor = require('../internals/promise-native-constructor');
|
|
var getBuiltIn = require('../internals/get-built-in');
|
|
var isCallable = require('../internals/is-callable');
|
|
var defineBuiltIn = require('../internals/define-built-in');
|
|
|
|
var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
|
|
|
|
// `Promise.prototype.catch` method
|
|
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
$({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR, real: true }, {
|
|
'catch': function (onRejected) {
|
|
return this.then(undefined, onRejected);
|
|
}
|
|
});
|
|
|
|
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
if (!IS_PURE && isCallable(NativePromiseConstructor)) {
|
|
var method = getBuiltIn('Promise').prototype['catch'];
|
|
if (NativePromisePrototype['catch'] !== method) {
|
|
defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
}
|
|
}
|