MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / onJSONLoaded

Function onJSONLoaded

docs/search/worker.js:36–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36function onJSONLoaded () {
37 data = JSON.parse(this.responseText);
38 var scriptsToLoad = ['lunr.js'];
39 if (data.config && data.config.lang && data.config.lang.length) {
40 lang = data.config.lang;
41 }
42 if (lang.length > 1 || lang[0] !== "en") {
43 scriptsToLoad.push('lunr.stemmer.support.js');
44 if (lang.length > 1) {
45 scriptsToLoad.push('lunr.multi.js');
46 }
47 for (var i=0; i < lang.length; i++) {
48 if (lang[i] != 'en') {
49 scriptsToLoad.push(['lunr', lang[i], 'js'].join('.'));
50 }
51 }
52 }
53 loadScripts(scriptsToLoad, onScriptsLoaded);
54}
55
56function onScriptsLoaded () {
57 console.log('All search scripts loaded, building Lunr index...');

Callers

nothing calls this directly

Calls 3

loadScriptsFunction · 0.85
pushMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected