File tree Expand file tree Collapse file tree
Resources/Private/TypeScript Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,4 +55,13 @@ import {componentLoader} from "@packages/Application/FormatD.ComponentLoader/Res
5555componentLoader .addDefaultImport (' Vendor.Website:MyComponent' , () => import (' ../private/Fusion/MyComponent' ));
5656// ...
5757componentLoader .initialize ()
58+ ```
59+
60+ The optional callback can be used to initialize custom js not managed by the component manager
61+ ``` typescript
62+ componentLoader .initialize (async (domSection , reason ) => {
63+ if (document .querySelector (' body' )) {
64+ // add stuff here
65+ }
66+ });
5867```
Original file line number Diff line number Diff line change 1+ export default class Logger {
2+
3+ protected scope : string
4+ protected enabled : boolean
5+ protected filterScopes : string [ ]
6+
7+ constructor ( scope ) {
8+ this . scope = scope ;
9+ this . enabled = window . __ComponentLoaderComponentRegistry . context . isDevelopment ;
10+ this . filterScopes = [ ] ; // NO filter active
11+ //this.filterScopes = ['ModalEnabled']; // display only ModalEnabled Scope
12+ }
13+
14+ /**
15+ * Logs all provided arguments if enabled
16+ */
17+ log ( ...args ) {
18+ if ( this . enabled && ( this . filterScopes . length === 0 || this . filterScopes . indexOf ( this . scope ) !== - 1 ) ) {
19+ console . log ( this . scope + ':' , ...args ) ;
20+ }
21+ }
22+
23+ /**
24+ * Logs all provided arguments
25+ */
26+ error ( ...args ) {
27+ console . error ( this . scope + ':' , ...args ) ;
28+ }
29+
30+ }
You can’t perform that action at this time.
0 commit comments