@@ -123,41 +123,52 @@ export function setShowError(value: boolean) {
123123
124124export  class  ZippedAssetPackage  extends  BaseNative < com . carto . utils . ZippedAssetPackage ,  ZippedAssetPackageOptions >  { 
125125    mInterface : com . akylas . carto . additions . AKAssetPackage . Interface ; 
126+     mBaseAssetPackage : com . akylas . carto . additions . AKAssetPackage ; 
127+     mAssetPackage : com . akylas . carto . additions . AKAssetPackage ; 
128+     mVectorTileStyleSetData : com . carto . core . BinaryData ; 
126129    constructor ( options )  { 
127130        super ( options ) ; 
128-         for  ( const  property  of  [ 'mInterface' ] )  { 
129-             const  descriptor  =  Object . getOwnPropertyDescriptor ( DirAssetPackage . prototype ,  property ) ; 
130-             if  ( descriptor )  { 
131-                 descriptor . enumerable  =  false ; 
132-             } 
133-         } 
131+         // Object.defineProperty(this, 'mInterface', { enumerable: false }); 
132+         // Object.defineProperty(this, 'mBaseAssetPackage', { enumerable: false }); 
133+         // Object.defineProperty(this, 'mAssetPackage', { enumerable: false }); 
134+         // Object.defineProperty(this, 'mVectorTileStyleSetData', { enumerable: false }); 
135+         // for (const property of ['mInterface']) { 
136+         //     const descriptor = Object.getOwnPropertyDescriptor(DirAssetPackage.prototype, property); 
137+         //     if (descriptor) { 
138+         //         descriptor.enumerable = false; 
139+         //     } 
140+         // } 
141+     } 
142+     dispose ( ) : void   { 
143+         super . dispose ( ) ; 
144+         this . mInterface  =  null ; 
145+         this . mBaseAssetPackage  =  null ; 
146+         this . mAssetPackage  =  null ; 
147+         this . mVectorTileStyleSetData  =  null ; 
134148    } 
135149    createNative ( options : ZippedAssetPackageOptions )  { 
136150        // if (File.exists(options.zipPath)) { 
137-         let  vectorTileStyleSetData : com . carto . core . BinaryData ; 
138151        if  ( options . liveReload  ===  true )  { 
139152            const  data  =  File . fromPath ( getFileName ( options . zipPath ) ) . readSync ( ) ; 
140-             vectorTileStyleSetData  =  new  com . carto . core . BinaryData ( data ) ; 
153+             this . mVectorTileStyleSetData  =  new  com . carto . core . BinaryData ( data ) ; 
141154        }  else  { 
142155            const  zipPath  =  getRelativePathToApp ( options . zipPath ) ; 
143-             console . log ( 'zipPath' ,  zipPath ) ; 
144-             vectorTileStyleSetData  =  com . carto . utils . AssetUtils . loadAsset ( zipPath ) ; 
156+             this . mVectorTileStyleSetData  =  com . carto . utils . AssetUtils . loadAsset ( zipPath ) ; 
145157        } 
146-         let  assetPackage : com . akylas . carto . additions . AKAssetPackage ; 
147158        if  ( options . basePack )  { 
148-             assetPackage  =  options . basePack . getNative ( ) ; 
159+             this . mBaseAssetPackage  =  options . basePack . getNative ( ) ; 
149160        } 
150161        if  ( options . loadAsset  &&  options . getAssetNames )  { 
151162            this . mInterface  =  new  com . akylas . carto . additions . AKAssetPackage . Interface ( { 
152163                getAssetNames : options . getAssetNames , 
153164                loadAsset : options . loadAsset 
154165            } ) ; 
155-             assetPackage  =  new  com . akylas . carto . additions . AKAssetPackage ( this . mInterface ,  assetPackage ) ; 
166+             this . mAssetPackage  =  new  com . akylas . carto . additions . AKAssetPackage ( this . mInterface ,  this . mBaseAssetPackage ) ; 
156167        } 
157-         if  ( assetPackage )  { 
158-             return  new  com . carto . utils . ZippedAssetPackage ( vectorTileStyleSetData ,   assetPackage ) ; 
168+         if  ( this . mBaseAssetPackage   ||   this . mAssetPackage )  { 
169+             return  new  com . carto . utils . ZippedAssetPackage ( this . mVectorTileStyleSetData ,   this . mAssetPackage   ||   this . mBaseAssetPackage ) ; 
159170        }  else  { 
160-             return  new  com . carto . utils . ZippedAssetPackage ( vectorTileStyleSetData ) ; 
171+             return  new  com . carto . utils . ZippedAssetPackage ( this . mVectorTileStyleSetData ) ; 
161172        } 
162173        // } else { 
163174        //     console.error(`could not find zip file: ${options.zipPath}`); 
@@ -182,20 +193,28 @@ function walkDir(dirPath: string, cb: (str: string) => void, currentSubDir?: str
182193    } ) ; 
183194} 
184195export  class  DirAssetPackage  extends  BaseNative < com . akylas . carto . additions . AKAssetPackage ,  DirAssetPackageOptions >  { 
185-     assetNames : com . carto . core . StringVector ; 
196+     mAssetNames : com . carto . core . StringVector ; 
186197    mDirPath : string ; 
187198    mCartoDirPath : string ; 
188199    loadUsingNS  =  false ; 
189200    mInterface : com . akylas . carto . additions . AKAssetPackage . Interface ; 
190201    constructor ( options )  { 
191202        super ( options ) ; 
203+ 
204+         // Object.defineProperty(this, 'mInterface', { enumerable: false }); 
205+         // Object.defineProperty(this, 'mAssetNames', { enumerable: false }); 
192206        for  ( const  property  of  [ 'mInterface' ] )  { 
193207            const  descriptor  =  Object . getOwnPropertyDescriptor ( DirAssetPackage . prototype ,  property ) ; 
194208            if  ( descriptor )  { 
195209                descriptor . enumerable  =  false ; 
196210            } 
197211        } 
198212    } 
213+     dispose ( ) : void   { 
214+         this . mInterface  =  null ; 
215+         this . mAssetNames  =  null ; 
216+         super . dispose ( ) ; 
217+     } 
199218    createNative ( options : DirAssetPackageOptions )  { 
200219        if  ( Folder . exists ( getFileName ( options . dirPath ) ) )  { 
201220            const  dirPath  =  options . dirPath ; 
@@ -227,15 +246,15 @@ export class DirAssetPackage extends BaseNative<com.akylas.carto.additions.AKAss
227246        return  result ; 
228247    } 
229248    public  getAssetNames ( )  { 
230-         if  ( ! this . assetNames )  { 
249+         if  ( ! this . mAssetNames )  { 
231250            try  { 
232-                 this . assetNames  =  new  com . carto . core . StringVector ( ) ; 
251+                 this . mAssetNames  =  new  com . carto . core . StringVector ( ) ; 
233252                walkDir ( this . mDirPath ,  ( fileRelPath : string )  =>  { 
234-                     this . assetNames . add ( fileRelPath ) ; 
253+                     this . mAssetNames . add ( fileRelPath ) ; 
235254                } ) ; 
236255            }  catch  ( e )  { } 
237256        } 
238-         return  this . assetNames ; 
257+         return  this . mAssetNames ; 
239258    } 
240259} 
241260
0 commit comments