-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
25 lines (23 loc) · 849 Bytes
/
index.ts
File metadata and controls
25 lines (23 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {PureSelect} from "./pureSelect";
let demoSelect = new PureSelect('#demo', {
fetchRemote: (query, callback)=> {
fetch(`https://api.github.com/legacy/repos/search/${encodeURIComponent(query.term)}`)
.then(res => res.json())
.then((response)=> {
let entities = response.repositories;
callback({
entities: entities.map((entry)=> {
return {
label: `${entry.name}(${entry.owner})`,
value: entry,
id: entry.url
}
}),
query: {
term: query.term,
more: entities.length > 0
}
});
})
}
});