here is the code , the url is a visual host
I wonder why , when I shut down the wifi , the alfred will return the result more quickly?
If turn on the wifi,will be more slow, I have logged the url in alfy.fetch function,which shows
they both use the cached data .
alfy.fetch('http://linuxcmd.com/data.json',
{maxAge: 86400000}).then(result => {
var commands = [];
var e = 0;
for(var a in result){
++e;
result[a]['id'] = e;
commands.push(result[a]);
}
var i=0,
page_size = commands.length,
arrResult = [],
query=alfy.input;
if(commands&&commands.length&&toString.call(commands).indexOf('Array')>-1){
var count = 0
for (; i < page_size; i++) {
if(isSreachIndexOF(commands[i].n,query)
|| isSreachIndexOF(commands[i].d,query)
){
if(count < page_size){
arrResult.push(commands[i]);
++count;
}
}
}
}
var items = [];
for(var i = 0;i< arrResult.length;i++){
items.push({
title: arrResult[i].n,
subtitle: arrResult[i].d,
arg: arrResult[i].n
})
}
if(items.length < 1){
items.push({
title: "没有搜素到内容",
subtitle: "请尝试其它关键字",
})
}
alfy.output(items);
});
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too