本文整理汇总了TypeScript中bluebird.config函数的典型用法代码示例。如果您正苦于以下问题:TypeScript config函数的具体用法?TypeScript config怎么用?TypeScript config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: configure
ďťżimport {Aurelia} from 'aurelia-framework';
// we want font-awesome to load as soon as possible to show the fa-spinner
import '../styles/styles.css';
import 'font-awesome/css/font-awesome.css';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap';
// comment out if you don't want a Promise polyfill (remove also from webpack.config.js)
import * as Bluebird from 'bluebird';
Bluebird.config({ warnings: false });
export async function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
// Uncomment the line below to enable animation.
// aurelia.use.plugin('aurelia-animator-css');
// if the css animator is enabled, add swap-order="after" to all router-view elements
// Anyone wanting to use HTMLImports to load views, will need to install the following plugin.
// aurelia.use.plugin('aurelia-html-import-template-loader')
await aurelia.start();
aurelia.setRoot('app');
// if you would like your website to work offline (Service Worker),
// install and enable the @easy-webpack/config-offline package in webpack.config.js and uncomment the following code:
/*
const offline = await System.import('offline-plugin/runtime');
offline.install();
示例2: configure
/// <reference types="aurelia-loader-webpack/src/webpack-hot-interface"/>
// we want font-awesome to load as soon as possible to show the fa-spinner
import {Aurelia} from 'aurelia-framework'
import environment from './environment';
import {PLATFORM} from 'aurelia-pal';
import * as Bluebird from 'bluebird';
// remove out if you don't want a Promise polyfill (remove also from webpack.config.js)
Bluebird.config({ warnings: { wForgottenReturn: false } });
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'));
// Uncomment the line below to enable animation.
// aurelia.use.plugin(PLATFORM.moduleName('aurelia-animator-css'));
// if the css animator is enabled, add swap-order="after" to all router-view elements
// Anyone wanting to use HTMLImports to load views, will need to install the following plugin.
// aurelia.use.plugin(PLATFORM.moduleName('aurelia-html-import-template-loader'));
if (environment.debug) {
aurelia.use.developmentLogging();
}
if (environment.testing) {
aurelia.use.plugin(PLATFORM.moduleName('aurelia-testing'));
}
return aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
示例3: configure
import { Aurelia } from 'aurelia-framework';
import { PLATFORM } from 'aurelia-pal';
import environment from './environment';
import 'bootstrap';
import { logLevel } from 'aurelia-logging';
import * as Bluebird from 'bluebird';
Bluebird.config({
longStackTraces: false,
warnings: {
wForgottenReturn: false
}
});
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.plugin(PLATFORM.moduleName('aurelia-validation'))
.feature(PLATFORM.moduleName('aurelia-json-schema-form/index'), options => {
options.logLevel = logLevel.debug;
})
.globalResources([PLATFORM.moduleName('random-number-generator')]);
// Uncomment the line below to enable animation.
// aurelia.use.plugin(PLATFORM.moduleName('aurelia-animator-css'));
// if the css animator is enabled, add swap-order="after" to all router-view elements
// Anyone wanting to use HTMLImports to load views, will need to install the following plugin.
// aurelia.use.plugin(PLATFORM.moduleName("aurelia-html-import-template-loader"));
if (environment.debug) {
示例4: require
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// tslint:disable: no-require-imports no-var-requires no-console no-unnecessary-class no-magic-numbers prefer-template
import axios from 'axios';
import * as Promise from 'bluebird';
const buildURL = require('axios/lib/helpers/buildURL');
const isURLSameOrigin = require('axios/lib/helpers/isURLSameOrigin');
const btoa = require('axios/lib/helpers/btoa');
const cookies = require('axios/lib/helpers/cookies');
const settle = require('axios/lib/core/settle');
Promise.config({
longStackTraces: true
});
export interface IKeyValue {
[key: string]: any;
}
// The default adapter
let defaultAdapter: any;
/**
* The mock adapter that gets installed.
*
* @param resolve The function to call when Promise is resolved
* @param reject The function to call when Promise is rejected
* @param config The config object to be used for the request
示例5: require
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const express = require('express');
const loopback = require('loopback');
const chalk = require('chalk');
const path = require('path');
const Promise = require('bluebird');
Promise.config({
// Enables all warnings except forgotten return statements.
warnings: {
wForgottenReturn: false
}
});
if (process.env.NODE_ENV == 'development') {
var log = console.log;
console.log = function() {
let stack = new Error().stack;
stack = StackTraceParser.parse(stack);
let line: any = stack[1];
line = `${line.file}:${line.lineNumber}:${line.column}`;
line = chalk.gray(line);
log(' ');
log('<--');
log(line);
log.apply(log, arguments);
示例6: require
const
Bluebird = require('bluebird')
try {
Bluebird.config({
//cancellation: true,
monitoring: process.env.NODE_ENV === 'development',
longStackTraces: process.env.NODE_ENV === 'development',
warnings: {
wForgottenReturn: false
}
})
} catch (err) {
try {
console.warn(`Unable to configure promises, likely already configured`)
} catch (err2) {}
}
const
g = global as any
Promise = Bluebird
g.Promise = Bluebird
/**
* Replace es6-promise with bluebird
*/
require('babel-runtime/core-js/promise').default = require('bluebird')
示例7:
// Patches the global Promise to enable long Error stack traces
// To be required when running mocha with --require
import Bluebird from 'bluebird'
Bluebird.config({ longStackTraces: true })
global.Promise = Bluebird