MCPcopy Create free account
hub / github.com/Boris-code/feapder / init

Function init

docs/lib/docsify/lib/plugins/search.js:166–198  ·  view source on GitHub ↗
(config, vm)

Source from the content-addressed store, hash-verified

164 }
165
166 function init(config, vm) {
167 var isAuto = config.paths === 'auto';
168
169 var expireKey = resolveExpireKey(config.namespace);
170 var indexKey = resolveIndexKey(config.namespace);
171
172 var isExpired = localStorage.getItem(expireKey) < Date.now();
173
174 INDEXS = JSON.parse(localStorage.getItem(indexKey));
175
176 if (isExpired) {
177 INDEXS = {};
178 } else if (!isAuto) {
179 return
180 }
181
182 var paths = isAuto ? getAllPaths(vm.router) : config.paths;
183 var len = paths.length;
184 var count = 0;
185
186 paths.forEach(function (path) {
187 if (INDEXS[path]) {
188 return count++
189 }
190
191 Docsify
192 .get(vm.router.getFile(path), false, vm.config.requestHeaders)
193 .then(function (result) {
194 INDEXS[path] = genIndex(path, result, vm.router, config.depth);
195 len === ++count && saveData(config.maxAge, expireKey, indexKey);
196 });
197 });
198 }
199
200 var NO_DATA_TEXT = '';
201 var options;

Callers 1

installFunction · 0.70

Calls 7

resolveExpireKeyFunction · 0.85
resolveIndexKeyFunction · 0.85
getAllPathsFunction · 0.85
genIndexFunction · 0.85
saveDataFunction · 0.85
parseMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected