MCPcopy Create free account
hub / github.com/frank-lam/fullstack-tutorial / init$1

Function init$1

notes/docsify/unpkg/docsify/lib/plugins/search.js:155–183  ·  view source on GitHub ↗
(config, vm)

Source from the content-addressed store, hash-verified

153}
154
155function init$1(config, vm) {
156 var isAuto = config.paths === 'auto';
157 var isExpired = localStorage.getItem('docsify.search.expires') < Date.now();
158
159 INDEXS = JSON.parse(localStorage.getItem('docsify.search.index'));
160
161 if (isExpired) {
162 INDEXS = {};
163 } else if (!isAuto) {
164 return
165 }
166
167 var paths = isAuto ? getAllPaths(vm.router) : config.paths;
168 var len = paths.length;
169 var count = 0;
170
171 paths.forEach(function (path) {
172 if (INDEXS[path]) {
173 return count++
174 }
175
176 Docsify
177 .get(vm.router.getFile(path), false, vm.config.requestHeaders)
178 .then(function (result) {
179 INDEXS[path] = genIndex(path, result, vm.router, config.depth);
180 len === ++count && saveData(config.maxAge);
181 });
182 });
183}
184
185var NO_DATA_TEXT = '';
186var options;

Callers 1

installFunction · 0.85

Calls 3

getAllPathsFunction · 0.85
genIndexFunction · 0.85
saveDataFunction · 0.85

Tested by

no test coverage detected