question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: watchAtMost

See original GitHub issue

i have an idea :


const watchAtMost = (source, fn, options = { max = 1 }) => {
  const { max } = options
  const count = ref(0)
  const stop = watch(source, (...args) => {
    fn(...args)
    count.value >= max && stop()
    count.value++
  }, options)
  return { count , stop }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
webfansplzcommented, Sep 16, 2021

A good idea, but I think antfu will say that it is better to write a count filter so that it can then be applied to a whole family of functions.

nice suggest ! I will do so if this idea is approved.

1reaction
webfansplzcommented, Sep 16, 2021

why does the function not return { count, stop }?

good idea ~ will expose it

Read more comments on GitHub >

github_iconTop Results From Across the Web

watchAtMost - VueUse
Usage #. Similar to watch with an extra option count which set up the number of times the callback function is triggered. After...
Read more >
Hamshine Hamind Watch Smartwatch for Men Women Health ...
Featuring 14 sports modes to help you exercise at a higher level. ... touch screen doesnt respond well. touchscreen is not accurate. its...
Read more >
Casio Men's GA-100 XL Series G-Shock Quartz 200M WR ...
Shock-resistant sports watch featuring camouflage patterned dial with LED light, countdown timer, and 1/1000-second stopwatch; 51 mm stainless steel case ...
Read more >
Boy hand dp - Pinterest
This premium designed watch combines unique new handcrafted wood types with luxurious stainless steel dials and backplates.
Read more >
The New Lift Tickets - SKI Magazine
... our online education hub featuring in-depth fitness, nutrition, ... directly to your watch at most SKIDATA resorts around the world.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found