(constructor: ConstructorOf<T>, scope: Scope, newInstance: Instance)
| 57 | } |
| 58 | |
| 59 | function setInstanceInScope<T>(constructor: ConstructorOf<T>, scope: Scope, newInstance: Instance) { |
| 60 | const scopeMap: ScopeMap<Scope, Instance> = map.get(constructor) || new Map() |
| 61 | |
| 62 | scopeMap.set(scope, newInstance) |
| 63 | map.set(constructor, scopeMap) |
| 64 | newInstance[CleanupSymbol] = () => { |
| 65 | newInstance.destroy() |
| 66 | scopeMap.delete(scope) |
| 67 | } |
| 68 | |
| 69 | if (isSSREnabled()) { |
| 70 | ayanamiInstances.set(scope, (ayanamiInstances.get(scope) || []).concat(newInstance)) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | function getInstanceFrom<T>(constructor: ConstructorOf<T>, scope: Scope): T | undefined { |
| 75 | const scopeMap = map.get(constructor) |
no test coverage detected