aboutsummaryrefslogtreecommitdiff
path: root/src/services/theme_data/theme_data_3.service.js
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2024-09-21 08:18:23 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2024-09-21 08:18:23 +0000
commitf127ae307b3a444f13c6f8b75ba99cf61244677e (patch)
tree9eff1b20ae2ab270c301e5555e9d4103c888f18b /src/services/theme_data/theme_data_3.service.js
parent23f8c08809d2ad38780584ef4f46643772cf5efe (diff)
parent14328917f1a25770f90dc2181fad090ace4954da (diff)
Merge branch 'piss-serialization' into 'develop'
Pleroma ISS (interface stylesheets) implementation See merge request pleroma/pleroma-fe!1943
Diffstat (limited to 'src/services/theme_data/theme_data_3.service.js')
-rw-r--r--src/services/theme_data/theme_data_3.service.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js
index cf58da11..39c8b74f 100644
--- a/src/services/theme_data/theme_data_3.service.js
+++ b/src/services/theme_data/theme_data_3.service.js
@@ -504,9 +504,21 @@ export const init = ({
console.debug('Eager processing took ' + (t2 - t1) + ' ms')
}
+ // optimization to traverse big-ass array only once instead of twice
+ const eager = []
+ const lazy = []
+
+ result.forEach(x => {
+ if (typeof x === 'function') {
+ lazy.push(x)
+ } else {
+ eager.push(x)
+ }
+ })
+
return {
- lazy: result.filter(x => typeof x === 'function'),
- eager: result.filter(x => typeof x !== 'function'),
+ lazy,
+ eager,
staticVars,
engineChecksum
}