import { Asset } from "../assets/Asset" ; import { AssetReference } from "./AssetReference" ; import { SerializedAssetReference } from "./SerializedTypes" ; export class AssetReferenceArray < T extends Asset > { data : AssetReference < T > [ ] ; grow : ( instance ? : T ) => void ; typeName : ( ) => string ; constructor ( ctor , data ? ) { this . grow = ( instance ? ) => this . data . push ( new AssetReference ( ctor , instance ) ) ; this . typeName = ( ) => ctor . name ; this . data = data || [ ] ; } detach ( ) { for ( const ref of this . data ) { ref . detach ( ) ; } } } export interface SerializedAssetReferenceArray { typeName : string ; data : SerializedAssetReference [ ] ; }