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

Method changeVersion

src/main.js:252–283  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

250 }
251
252 async changeVersion(){
253 let pkg_nme = this.libName.textContent;
254 let selectedVersion = this.versionSelector.value;
255
256 let url = `https://api.cdnjs.com/libraries/${pkg_nme}/${selectedVersion}`;
257 try {
258 loader.create('Loading','Fetching files...');
259 const response = await fetch(url);
260 let data = await response.json();
261 loader.destroy();
262 this.filesList.innerHTML = '';
263 this.$sriObj = {};
264 this.$sriObj = data.sri;
265 let filteredFiles = this.filterFiles(data.files);
266 for(let i =0;i<filteredFiles.length;i++){
267 const list = tag('li');
268 const filesCheckBox = tag('input',{
269 type: "checkbox",
270 className: "filesCheckBox",
271 value: filteredFiles[i],
272 });
273 const filesLabel = tag('p',{
274 textContent: filteredFiles[i],
275 className: "filesLabel"
276 });
277 list.append(...[filesCheckBox,filesLabel]);
278 this.filesList.append(list);
279 }
280 } catch (e) {
281 this.closePlugin();
282 }
283 }
284
285 filterFiles(filesArr){
286 return filesArr.filter(item => {

Callers

nothing calls this directly

Calls 3

filterFilesMethod · 0.95
closePluginMethod · 0.95
destroyMethod · 0.80

Tested by

no test coverage detected