當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Kernel.load方法代碼示例

本文整理匯總了TypeScript中inversify.Kernel.load方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Kernel.load方法的具體用法?TypeScript Kernel.load怎麽用?TypeScript Kernel.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在inversify.Kernel的用法示例。


在下文中一共展示了Kernel.load方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: require

/// <reference path="../../node_modules/inversify-dts/inversify/inversify.d.ts" />
import { Kernel, interfaces } from "inversify"

import * as Mod1 from './mod1/inversify'

const mod1_schema: JSON = require('./overrides/mod1_schema.json')

const default_kernel = new Kernel()
default_kernel.load(Mod1.kernel_module)

const kernel = new Kernel()
kernel.parent = default_kernel

kernel
	.bind<Mod1.Schema>(Mod1.TYPES.Schema)
	.toConstantValue(mod1_schema as Mod1.Schema)

kernel
	.bind<Mod1.StaticData>(Mod1.TYPES.StaticData)
	.toConstantValue([ { name: 'OV Mod1 foo'}] as Mod1.StaticData)

export default kernel
開發者ID:Offirmo,項目名稱:web-tech-experiments,代碼行數:22,代碼來源:inversify.ts

示例2: Kernel

import { Kernel } from 'inversify';
import * as morgan from 'morgan';
import * as bodyParser from 'body-parser';
import * as cors from 'cors';
import * as jwt from 'express-jwt';

import { commands, controllers, infra, queries } from './bootstrap';
import { config } from './config';

import { DonorsFeed } from './donors-feed';
import { TYPES } from './lib/types';

import * as http from 'http';

let kernel = new Kernel();
kernel.load(infra, commands, queries, controllers);

let server = new InversifyExpressServer(kernel);

let httpServer = http.createServer();

server.setConfig((app) => {

    app.use(bodyParser.urlencoded({ extended: true }));
    app.use(bodyParser.json());
    app.use(morgan('combined'));
    app.use(cors({
        origin: (origin, callback) => {
            try {
                let ok: boolean = config.originsWhitelist.indexOf(origin) !== -1
                callback(null, ok);
開發者ID:kibiluzbad,項目名稱:kamrusepa,代碼行數:31,代碼來源:server.ts

示例3: Kernel

import { Kernel } from 'inversify';
import { diModule } from 'retax-di';

const kernel = new Kernel();
kernel.load(diModule);

export default kernel;
開發者ID:gitter-badger,項目名稱:retax-1,代碼行數:7,代碼來源:di.ts

示例4: createKernel

export function createKernel(option?: KernelOption) {
    let kernel = new i.Kernel();
    kernel.load(CoreModules);
    return new Kernel(kernel);
}
開發者ID:takeshi,項目名稱:froster,代碼行數:5,代碼來源:kernel.ts


注:本文中的inversify.Kernel.load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。