Skip to content

Commit

Permalink
fix: use global scope for metadata storage (#929)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzjunior authored May 4, 2024
1 parent c7c4477 commit c0ec22a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/storage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { MetadataStorage } from './MetadataStorage';
import { getGlobal } from './utils';

const globalScope = getGlobal();

/**
* Default metadata storage is used as singleton and can be used to storage all metadatas.
*/
export const defaultMetadataStorage = new MetadataStorage();
if (!globalScope.classTransformerMetadataStorage) {
globalScope.classTransformerMetadataStorage = new MetadataStorage();
}

export const defaultMetadataStorage = globalScope.classTransformerMetadataStorage;

0 comments on commit c0ec22a

Please sign in to comment.