Skip to content

Commit 1e1fc7a

Browse files
committed
feat: 抽离shared
1 parent 2ce348b commit 1e1fc7a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

packages/ioc/src/middleware/middleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
poolContainer,
1212
isBoolean,
1313
} from '@kever/shared'
14-
import { middlewarePatchPool } from './patch'
14+
import { middlewarePatchContainer } from './patch'
1515
import { isPromise } from '../utils'
1616

1717
export const middlewareGlobalContainer = Object.create({})
@@ -138,7 +138,7 @@ export const destoryAllMiddleware = () => {
138138
export const Middleware =
139139
(tag: Tag, type: MType): ClassDecorator =>
140140
(target) => {
141-
const middlewareOptions = middlewarePatchPool.use(tag)
141+
const middlewareOptions = middlewarePatchContainer.use(tag)
142142
const parameter: unknown[] = []
143143
if (middlewareOptions) {
144144
parameter.push(middlewareOptions)
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { InstancePool } from '../instancePool'
2-
import { Tag } from '../utils/types'
1+
import { Tag, Container } from '@kever/shared'
32

43
type Payload = (() => unknown) | string | number | symbol | any[] | object
54
type PayloadExcludeFn = Exclude<Payload, () => unknown>
65

7-
export const middlewarePatchPool = new InstancePool<Tag, PayloadExcludeFn>()
6+
export const middlewarePatchContainer = new Container<Tag, PayloadExcludeFn>()
87

98
export const middlewarePatch = (tag: Tag, payload: Payload) => {
109
let option: PayloadExcludeFn
@@ -13,5 +12,5 @@ export const middlewarePatch = (tag: Tag, payload: Payload) => {
1312
} else {
1413
option = payload
1514
}
16-
middlewarePatchPool.bind(tag, option)
15+
middlewarePatchContainer.bind(tag, option)
1716
}

0 commit comments

Comments
 (0)