Use let or const to avoid scope issues and hoisting
var apiURL = 'https://api.github.com/repos/vuejs/vue/commits?per_page=3&sha='
1var apiURL = 'https://api.github.com/repos/vuejs/vue/commits?per_page=3&sha='23/**4 * Actual demo5 */67new Vue({8 el: '#demo',910 data: {11 branches: ['main', 'dev'],12 currentBranch: 'main',13 commits: null14 },1516 created: function () {17 this.fetchData()18 },1920 watch: {21 currentBranch: 'fetchData'22 },2324 filters: {25 truncate: function (v) {26 var newline = v.indexOf('\n')27 return newline > 0 ? v.slice(0, newline) : v28 },29 formatDate: function (v) {30 return v.replace(/T|Z/g, ' ')31 }32 },3334 methods: {35 fetchData: function () {36 var self = this37 var xhr = new XMLHttpRequest()38 xhr.open('GET', apiURL + self.currentBranch)39 xhr.onload = function () {40 self.commits = JSON.parse(xhr.responseText)41 console.log(self.commits[0].html_url)42 }43 xhr.send()44 }45 }46})
Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.