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.

Feature request: latestMap

See original GitHub issue

I would love a method to is almost like an .switchMap() but the big difference is that it should wait until the latest “project” Observable is completed before it starts the latest “project” Observable.

Why?

When you are working with an api that isn’t cancelable and that specific function can only be executed once and have to wait until the callback is executed before you can executed that function/method again and only the lastest value is important.

A use case

When you have a player for instance and want to seek to a current time in playback. Doing multiple seeking at the same time is not desired and in my case also actually crashes the app (smart tv development). To write this code right now is very complicated. We added debounce the seek but this sometimes fails because of slow buffering.

How our code looks like right now

currentTimeChanged$
  .debounceTime(1000)
  .switchMap(currentTime => Observable
    .create((observer) => {
      // This api has no cancelation of setCurrentTime and
      // can only be executed while not currently seeking.
      player.setCurrentTime(currentTime, (error) => {
        if (error) return observer.error(error);
        observer.complete();
      });
    })
    // The only solution right now is to do something like this
    // but sometimes crashes probably because legacy browser and unstable native api.
    .retryWhen(error$ => error$.delay(100))
  );

Desired code

currentTimeChanged$ // A stream that represent a progress bar
  .debounceTime(1000)
  // Should subscribe next latest project when idle.
  // Should not subscribe latest project until previous project is completed.
  .latestMap((currentTime) => { 
    return Observable.create((observer) => {
      // player.setCurrentTime can only be executed while not "running"
      player.setCurrentTime(currentTime, () => observer.complete());
    });
  });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
trxcllntcommented, Nov 16, 2017

@EloB from what I can tell, I think this is auditMap – if so, you should be able to achieve something similar via source.auditTime(1000).exhaustMap((x) => asyncThing(x))

0reactions
lock[bot]commented, Jun 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Roadmap and Feature Requests Tool - Beamer
Create a public Roadmap for your SaaS product and collect feature requests from users with Beamer. No-code, easy to use tool. Start free...
Read more >
Existing Map Appearance - Feature Requests - DroneDeploy
... a project that includes a couple of work areas that are not completely connected it always pulls up the latest map which...
Read more >
Toggle between feature request modes - ArcGIS Developers
Use different feature request modes to populate the map from a service feature ... The feature request modes have different performance characteristics.
Read more >
Update your Hyundai vehicle with the latest map and software
Learn how to update your Hyundai vehicle with the latest map and software ... to add new and improved functionality to your Hyundai...
Read more >
Waze - Don't forget to to register for the latest Map... | Facebook
Don't forget to to register for the latest Map Editing Webinar, coming up this Sunday! ... For feature requests like this, feel free...
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