Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitzm@lovullo.com>2017-02-07 15:36:28 -0500
committerMike Gerwitz <gerwitzm@lovullo.com>2017-02-07 15:38:33 -0500
commite3b6ee05fa9a12f99650d42cc15f7bd5a46ca086 (patch)
tree573d3c6496c0340acc3ae052f9812057c7f30c8b
parenta65f568714719363e04df947ceb915e96bfdf97b (diff)
downloadliza-e3b6ee05fa9a12f99650d42cc15f7bd5a46ca086.tar.gz
liza-e3b6ee05fa9a12f99650d42cc15f7bd5a46ca086.tar.bz2
liza-e3b6ee05fa9a12f99650d42cc15f7bd5a46ca086.zip
tools/gen-index: Generate getters
LoVullo dropped support for IE<9, so getters can now be used to lazy-load modules. This also means that, during the transition from LoVullo's internal rating-fw repo to liza, and broken require paths (program/, mainly) will not cause problems unless the module containing those requires is explicitly requested. * tools/gen-index.js: Generate getters.
-rwxr-xr-xtools/gen-index4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/gen-index b/tools/gen-index
index 85a3d11..84abf0b 100755
--- a/tools/gen-index
+++ b/tools/gen-index
@@ -40,7 +40,7 @@ for module in "$destpath"/!(index).js; do
echo ,
fi
- echo -n " '$modname': require( './$modname' )"
+ echo -n " get '$modname'() { return require( './$modname' ); }"
done
# include index.js for any sub-directories (namespace)
@@ -52,7 +52,7 @@ for dir in $( find "$destpath" -maxdepth 1 -mindepth 1 -type d ); do
echo ,
fi
- echo -n " '$ns': require( './$ns' )"
+ echo -n " get '$ns'() { return require('./$ns'); }"
done
echo -e "\n};"