developit / greenlet

🦎 Move an async function into its own thread.
https://npm.im/greenlet
4.67k stars 100 forks source link

_ref is not defined #57

Open bbhxwl opened 11 months ago

bbhxwl commented 11 months ago

vue2 ,

  methods: {
    async btnTest() {
      let getName = greenlet( async username => {
        let url = `https://api.github.com/users/${username}`
        let res = await fetch(url)
        let profile = await res.json()
        return profile.name
      })
      console.log(await getName('developit'))
    },
  },