Skip to content

@istock/iswork / Exports / Application

Class: Application

应用框架入口

Hierarchy

  • ApplicationEvent

    Application

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Application(options?): Application

Parameters

NameType
optionsPartial<TApplicationOptions>

Returns

Application

Overrides

ApplicationEvent.constructor

Defined in

src/packages/iswork/src/application/application.ts:60

Properties

#CmdpEvent

Private Readonly #CmdpEvent: typeof CmdpEvent = CmdpEvent

Inherited from

ApplicationEvent.#CmdpEvent

Defined in

src/packages/iswork/src/application/application-event.ts:8


#Context

Private Readonly #Context: typeof ApplicationContext = ApplicationContext

Defined in

src/packages/iswork/src/application/application.ts:18


#MessageHandler

Private Readonly #MessageHandler: typeof MessageHandler = MessageHandler

Defined in

src/packages/iswork/src/application/application.ts:19


#compose

Private Readonly #compose: (middleware: Function[]) => (context: ApplicationContext, next?: Function) => Promise<unknown> = compose

Type declaration

▸ (middleware): (context: ApplicationContext, next?: Function) => Promise<unknown>

参考koa-compose Compose middleware returning a fully valid middleware comprised of all those which are passed.

Parameters
NameType
middlewareFunction[]
Returns

fn

▸ (context, next?): Promise<unknown>

Parameters
NameType
contextApplicationContext
next?Function
Returns

Promise<unknown>

Api

public

Defined in

src/packages/iswork/src/application/application.ts:20


#domainHandler

Private Readonly #domainHandler: DomainHandler

Defined in

src/packages/iswork/src/application/application.ts:22


#emit

Private Readonly #emit: (message: unknown, options?: { targetOrigin?: string ; transfer?: Transferable[] }) => void

Type declaration

▸ (message, options?): void

Parameters
NameType
messageunknown
options?Object
options.targetOrigin?string
options.transfer?Transferable[]
Returns

void

Inherited from

ApplicationEvent.#emit

Defined in

src/packages/iswork/src/application/application-event.ts:9


#messageCallback

Private #messageCallback: (event: MessageEvent<TCmdpMessage<any>>) => Promise<void>

Type declaration

▸ (event): Promise<void>

Parameters
NameType
eventMessageEvent<TCmdpMessage<any>>
Returns

Promise<void>

Defined in

src/packages/iswork/src/application/application.ts:25


#messageChannelManager

Private Readonly #messageChannelManager: MessageChannelManager

Defined in

src/packages/iswork/src/application/application.ts:24


#options

Private Readonly #options: TApplicationOptions

Defined in

src/packages/iswork/src/application/application.ts:21


#pipeManager

Private Readonly #pipeManager: PipeManager

Defined in

src/packages/iswork/src/application/application.ts:23


options

options: TApplicationEventOptions

Inherited from

ApplicationEvent.options

Defined in

src/packages/iswork/src/application/application-event.ts:10

Accessors

allDomain

get allDomain(): Domain<IDomainClass<unknown>>[]

Returns

Domain<IDomainClass<unknown>>[]

Defined in

src/packages/iswork/src/application/application.ts:31


emit

get emit(): (message: unknown, options?: { targetOrigin?: string ; transfer?: Transferable[] }) => void

Returns

fn

▸ (message, options?): void

Parameters
NameType
messageunknown
options?Object
options.targetOrigin?string
options.transfer?Transferable[]
Returns

void

Inherited from

ApplicationEvent.emit

Defined in

src/packages/iswork/src/application/application-event.ts:11


globalMiddleware

get globalMiddleware(): TMiddleware[]

Returns

TMiddleware[]

Defined in

src/packages/iswork/src/application/application.ts:27


messageChannelManager

get messageChannelManager(): MessageChannelManager

Returns

MessageChannelManager

Defined in

src/packages/iswork/src/application/application.ts:35


pipeFlowExecute

get pipeFlowExecute(): (pipes: { args?: unknown[] ; key: TPipeKey }[]) => unknown

批量执行pipe方法

Returns

fn

▸ (pipes): unknown

Parameters
NameType
pipes{ args?: unknown[] ; key: TPipeKey }[]
Returns

unknown

Defined in

src/packages/iswork/src/application/application.ts:42

Methods

#callback

#callback(_options?): (event: MessageEvent<TCmdpMessage<any>>) => Promise<void>

消息处理函数

Parameters

NameType
_options?unknown

Returns

fn

▸ (event): Promise<void>

Parameters
NameType
eventMessageEvent<TCmdpMessage<any>>
Returns

Promise<void>

Defined in

src/packages/iswork/src/application/application.ts:91


#messageCallbackErrorHandler

#messageCallbackErrorHandler(ctx, err): void

Parameters

NameType
ctxApplicationContext
errany

Returns

void

Defined in

src/packages/iswork/src/application/application.ts:176


close

close(): void

关闭应用

Returns

void

Defined in

src/packages/iswork/src/application/application.ts:84


closed

closed(): void

Returns

void

Inherited from

ApplicationEvent.closed

Defined in

src/packages/iswork/src/application/application-event.ts:59


getDomain

getDomain<T>(name): undefined | Domain<T>

获取domain

Type parameters

NameType
Textends IDomainClass<any>

Parameters

NameType
namestring

Returns

undefined | Domain<T>

Defined in

src/packages/iswork/src/application/application.ts:222


getPipe

getPipe<Fn>(key): Fn

获取管道函数

Type parameters

NameType
Fnextends Function

Parameters

NameType
keyTPipeKey

Returns

Fn

Defined in

src/packages/iswork/src/application/application.ts:239


getPipeRecord

getPipeRecord(): Record<string | symbol, Function>

获取全部管道函数记录

Returns

Record<string | symbol, Function>

Defined in

src/packages/iswork/src/application/application.ts:246


initialized

initialized(): void

Returns

void

Inherited from

ApplicationEvent.initialized

Defined in

src/packages/iswork/src/application/application-event.ts:39


listen

listen(domainClass): (event: MessageEvent<TCmdpMessage<any>>) => Promise<void>

通过domain获取消息处理函数

Parameters

NameType
domainClassIDomainClass<unknown>

Returns

fn

▸ (event): Promise<void>

Parameters
NameType
eventMessageEvent<TCmdpMessage<any>>
Returns

Promise<void>

Defined in

src/packages/iswork/src/application/application.ts:73


listenInput

listenInput(): void

Returns

void

Inherited from

ApplicationEvent.listenInput

Defined in

src/packages/iswork/src/application/application-event.ts:49


listenOutput

listenOutput(): void

Returns

void

Inherited from

ApplicationEvent.listenOutput

Defined in

src/packages/iswork/src/application/application-event.ts:54


listened

listened(): void

Returns

void

Inherited from

ApplicationEvent.listened

Defined in

src/packages/iswork/src/application/application-event.ts:44


sendAppMessage

sendAppMessage(controller, method, payload?): void

发送应用级消息

Parameters

NameTypeDefault value
controllerstringundefined
methodstringundefined
payloadTCmdpPayloadtrue

Returns

void

Inherited from

ApplicationEvent.sendAppMessage

Defined in

src/packages/iswork/src/application/application-event.ts:25


useDomain

useDomain(domainClass): void

新增domain

Parameters

NameType
domainClassIDomainClass<unknown>

Returns

void

Defined in

src/packages/iswork/src/application/application.ts:214


useMiddleware

useMiddleware(fn): Application

新增中间件

Parameters

NameType
fnTMiddleware

Returns

Application

Defined in

src/packages/iswork/src/application/application.ts:202


usePipe

usePipe(key, fn): void

新增管道函数

Parameters

NameType
keyTPipeKey
fnFunction

Returns

void

Defined in

src/packages/iswork/src/application/application.ts:231


#mergeOptions

#mergeOptions(options): TApplicationOptions

合并初始选项值

Parameters

NameType
optionsPartial<TApplicationOptions>

Returns

TApplicationOptions

Defined in

src/packages/iswork/src/application/application.ts:51

免责声明:本站所有信息、数据、软件仅供学习研究,都不构成投资建议,本站不承担由此导致的任何责任。