forked from neomjs/neo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DefaultConfig.mjs
290 lines (286 loc) · 8.99 KB
/
DefaultConfig.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
const Neo = globalThis.Neo || {};
Neo.config = Neo.config || {};
/**
* Config object for the neo.mjs framework which will get passed to all workers
* You can change the configs, e.g. inside the index.html of your app
* @memberOf module:Neo
* @name config
* @type Object
*/
const DefaultConfig = {
/**
* true will apply 'neo-body' to the document.body classList
* @default true
* @memberOf! module:Neo
* @name config.applyBodyCls
* @type Boolean
*/
applyBodyCls: true,
/**
* Path to your app.mjs file. You can create multiple apps there if needed.
* @default null
* @memberOf! module:Neo
* @name config.appPath
* @type String|null
*/
appPath: null,
/**
* Path to the neo.mjs directory
* @default './'
* @memberOf! module:Neo
* @name config.basePath
* @type String
*/
basePath: './',
/**
* Pass a token in case you are using the CesiumJS main thread addon
* See: https://github.com/neomjs/neo/blob/dev/src/main/addon/CesiumJS.mjs
* @default null
* @memberOf! module:Neo
* @name config.cesiumJsToken
* @type String|null
*/
cesiumJsToken: null,
/**
* Set this config to false to disable the component logging using Ctrl-Right-Click
* @default true
* @memberOf! module:Neo
* @name config.enableComponentLogger
* @type Boolean
*/
enableComponentLogger: true,
/**
* Set this config to true to enable util.Logger (Neo.log()) based logs in production
* @default false
* @memberOf! module:Neo
* @name config.enableLogsInProduction
* @type Boolean
*/
enableLogsInProduction: false,
/**
* The current environment. Valid values: 'development', 'dist/development', 'dist/production'
* This config will get auto-generated
* @default 'dist/production'
* @memberOf! module:Neo
* @name config.environment
* @type String
*/
environment: 'dist/production',
/**
* In case you are using the GoogleMaps main thread addon, you can pass the API key here.
* @default ''
* @memberOf! module:Neo
* @name config.googleMapsApiKey
* @type String
*/
googleMapsApiKey: '',
/**
* In case you are using the GoogleAnalytics main thread addon or useGoogleAnalytics: true,
* you can change the gtag id here. Required for the online examples (gh pages)
* @default 'G-DJ13071C55'
* @memberOf! module:Neo
* @name config.gtagId
* @type String
*/
gtagId: 'G-DJ13071C55',
/**
* Flag for running on https://neomjs.github.io/pages/
* => to use local images paths instead of raw.githubusercontent.com
* @default false
* @memberOf! module:Neo
* @name config.isGitHubPages
* @type Boolean
*/
isGitHubPages: false,
/**
* Flag for running the Neo main thread inside an iframe (Siesta Browser Harness)
* @default false
* @memberOf! module:Neo
* @name config.isInsideSiesta
* @type Boolean
*/
isInsideSiesta: false,
/**
* delay in ms for the worker.Manager:loadApplication() call
* @default 20
* @memberOf! module:Neo
* @name config.loadApplicationDelay
* @type Number
*/
loadApplicationDelay: 20,
/**
* Used by Intl.DateTimeFormat, for details take a look at:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
* @default 'default'
* @memberOf! module:Neo
* @name config.locale
* @type String
*/
locale: 'default',
/**
* true will log the delta updates inside the main thread(s) as well as the requestAnimation frames
* @default false
* @memberOf! module:Neo
* @name config.logDeltaUpdates
* @type Boolean
*/
logDeltaUpdates: false,
/**
* true will log console warnings, in case a component tries to update() while a parent update is running.
* A parent update results in a short delay, so you might want to resolve these collisions.
* @default false
* @memberOf! module:Neo
* @name config.logVdomUpdateCollisions
* @type Boolean
*/
logVdomUpdateCollisions: false,
/**
* Add addons for the main thread
* ./src/main/addon/ contains all framework related options.
* You can also create your own addons within your workspace scope. Make sure to put them inside 'src/main/addon/'
* and prefix them with 'WS/' inside your neo-config.json file.
* Example: ['DragDrop', 'Stylesheet', 'WS/MyAddon']
* @default ['DragDrop', 'Navigator', 'Stylesheet']
* @memberOf! module:Neo
* @name config.mainThreadAddons
* @type String[]
*/
mainThreadAddons: ['DragDrop', 'Navigator', 'Stylesheet'],
/**
* Pass the URL of a JSON-file, which contains the services and methods from your backend,
* which you want to expose to the client.
* See: https://github.com/neomjs/neo/projects/32
* @default null
* @memberOf! module:Neo
* @name config.remotesApiUrl
* @type String|null
*/
remotesApiUrl: null,
/**
* You can visually show the amount of delta updates per second using this config.
* It expects a dom node with the id "neo-delta-updates" as the rendering target.
* @default false
* @memberOf! module:Neo
* @name config.renderCountDeltas
* @type Boolean
*/
renderCountDeltas: false,
/**
* Add themes you want to use here. The first theme will get applied.
* @default ['neo-theme-light','neo-theme-dark','neo-theme-neo-light']
* @memberOf! module:Neo
* @name config.themes
* @type String[]
*/
themes: ['neo-theme-light', 'neo-theme-dark', 'neo-theme-neo-light'],
/**
* Flag for standalone Siesta module tests => prevent registerRemote worker messages
* @default false
* @memberOf! module:Neo
* @name config.unitTestMode
* @type Boolean
*/
unitTestMode: false,
/**
* Experimental flag if an offscreen canvas worker should get created.
* @default false
* @memberOf! module:Neo
* @name config.useCanvasWorker
* @type Boolean
*/
useCanvasWorker: false,
/**
* Flag if vdom ids should get mapped into DOM element ids.
* false will convert them into a "data-neo-id" attribute.
* @default true
* @memberOf! module:Neo
* @name config.useDomIds
* @type Boolean
*/
useDomIds: true,
/**
* True will automatically include the stylesheet
* @default true
* @memberOf! module:Neo
* @name config.useFontAwesome
* @type Boolean
*/
useFontAwesome: true,
/**
* Intended for the online examples where we need an easy way to add GA to every generated app
* @default false
* @memberOf! module:Neo
* @name config.useGoogleAnalytics
* @type Boolean
*/
useGoogleAnalytics: false,
/**
* True will add the ServiceWorker main thread addon to support caching of assets (PWA)
* See: https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
* @default false
* @memberOf! module:Neo
* @name config.useServiceWorker
* @type Boolean
*/
useServiceWorker: false,
/**
* Creates App, Data & VDom as SharedWorkers.
* Set this one to true in case you want to connect multiple main threads.
* @default false
* @memberOf! module:Neo
* @name config.useSharedWorkers
* @type Boolean
*/
useSharedWorkers: false,
/**
* True will generate a new task worker, which can get filled with own expensive remote methods
* @default false
* @memberOf! module:Neo
* @name config.useTaskWorker
* @type Boolean
*/
useTaskWorker: false,
/**
* Adds global dom event listeners for mobile related events like rotate, swipe, tap
* @default true
* @memberOf! module:Neo
* @name config.useTouchEvents
* @type Boolean
*/
useTouchEvents: true,
/**
* False will create the vdom.Helper within the App worker (experimental!)
* @default true
* @memberOf! module:Neo
* @name config.useVdomWorker
* @type Boolean
*/
useVdomWorker: true,
/**
* buildScripts/injectPackageVersion.mjs will update this value
* @default '6.18.0'
* @memberOf! module:Neo
* @name config.version
* @type String
*/
version: '6.18.0'
};
Object.assign(DefaultConfig, {
/**
* Path to the top level neo.mjs resources folder
* @default Neo.config.basePath + 'resources/'
* @memberOf! module:Neo
* @name config.resourcesPath
* @type String
*/
resourcesPath: `${Neo.config.basePath || DefaultConfig.basePath}resources/`,
/**
* The default base URL for web worker entry points (App, Data, Vdom)
* @default Neo.config.basePath + 'src/worker/'
* @memberOf! module:Neo
* @name config.workerBasePath
* @type String
*/
workerBasePath: `${Neo.config.basePath || DefaultConfig.basePath}src/worker/`,
});
export default DefaultConfig;