Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Factory } from './Factory'
|
||||
import { Collection } from '../../util'
|
||||
import {DependencyRequirement, PropertyDependency} from "../types";
|
||||
import {DependencyKey, DependencyRequirement, PropertyDependency} from '../types'
|
||||
|
||||
/**
|
||||
* Container factory which returns its token as its value, without attempting
|
||||
@@ -19,29 +19,23 @@ import {DependencyRequirement, PropertyDependency} from "../types";
|
||||
*
|
||||
* @extends Factory
|
||||
*/
|
||||
export default class SingletonFactory extends Factory {
|
||||
export default class SingletonFactory<T> extends Factory<T> {
|
||||
constructor(
|
||||
/**
|
||||
* Instantiated value of this factory.
|
||||
* @type FunctionConstructor
|
||||
* Token identifying this singleton.
|
||||
*/
|
||||
protected token: FunctionConstructor,
|
||||
protected token: DependencyKey,
|
||||
|
||||
/**
|
||||
* String name of this singleton identifying it in the container.
|
||||
* @type string
|
||||
* The value of this singleton.
|
||||
*/
|
||||
protected key: string,
|
||||
protected value: T,
|
||||
) {
|
||||
super(token)
|
||||
}
|
||||
|
||||
produce(dependencies: any[], parameters: any[]) {
|
||||
return this.token
|
||||
}
|
||||
|
||||
match(something: any) {
|
||||
return something === this.key
|
||||
produce(): T {
|
||||
return this.value
|
||||
}
|
||||
|
||||
getDependencyKeys(): Collection<DependencyRequirement> {
|
||||
|
||||
Reference in New Issue
Block a user