MCPcopy Create free account
hub / github.com/bajrangCoder/acode-plugin-packageAdder / loadLibraries

Method loadLibraries

src/main.js:142–182  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

140 }
141
142 async loadLibraries(url){
143 try {
144 this.pkgLists.innerHTML = '';
145 loader.create('Loading','Fetching data...');
146 const response = await fetch(url);
147 let data = await response.json();
148 loader.destroy();
149 let res = data.results;
150 res.forEach(obj => {
151 const li = tag('li');
152 this.pkgLists.append(li);
153 const pkgHeader = tag('div',{
154 className: "pkgHeader",
155 });
156 const pkgMain = tag('div',{
157 className: "pkgMain",
158 });
159 li.append(...[pkgHeader,pkgMain]);
160 const heading1 = tag('h3',{
161 textContent: obj.name,
162 });
163 const heading2 = tag('h4',{
164 textContent: this.abbreviateNumber(obj.github.stargazers_count),
165 });
166 const heading3 = tag('h4',{
167 textContent: this.abbreviateNumber(obj.github.forks),
168 });
169 pkgHeader.append(...[heading1,heading2,heading3]);
170 const descP = tag('p',{
171 textContent: obj.description,
172 });
173 const plusIcon = tag('span',{
174 textContent: '+',
175 });
176 pkgMain.append(...[descP,plusIcon]);
177 li.onclick = this.pkgDetails.bind(this,obj.name);
178 });
179 } catch (e) {
180 this.closePlugin();
181 }
182 }
183
184 searchLib(){
185 let query = this.$searchInput.value.toLowerCase()

Callers 2

runMethod · 0.95
searchLibMethod · 0.95

Calls 3

abbreviateNumberMethod · 0.95
closePluginMethod · 0.95
destroyMethod · 0.80

Tested by

no test coverage detected