UNPKG

520 BPlain TextView Raw
1import { RegistrationOptions } from './registry';
2import { Factory } from './factory';
3
4// TODO - use symbol
5export const OWNER = '__owner__';
6
7export function getOwner(object: object): Owner {
8 return object[OWNER];
9}
10
11export function setOwner(object: object, owner: Owner): void {
12 object[OWNER] = owner;
13}
14
15export interface Owner {
16 identify(specifier: string, referrer?: string): string;
17
18 factoryFor(specifier: string, referrer?: string): Factory<any>;
19
20 lookup(specifier: string, referrer?: string): any;
21}