You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
471 B
19 lines
471 B
import { container } from '../global.ts'
|
|
import { isInstantiable } from '../type/Instantiable.ts'
|
|
import { Injectable } from './Injection.ts'
|
|
|
|
const injectable = Injectable()
|
|
|
|
const Service = (name?: string): ClassDecorator => {
|
|
return (target) => {
|
|
if ( isInstantiable(target) ) {
|
|
if ( name ) container.register_named(name, target)
|
|
else container.register(target)
|
|
|
|
injectable(target)
|
|
}
|
|
}
|
|
}
|
|
|
|
export { Service }
|