Comments (9)
Hmm, I understand this, but may I ask what is the root problem? What feature are you trying to achieve by wanting the periodic to keep emitting when the tab has changed?
from time.
Generating invoices from a pomodoro timer. Need the timer to continue while I work.
Nick asked me to open this issue but also recommended I use Time.animationFrames()
which offers the functionality I need.
from time.
Doesn’t the events pick up and synchronize when you return to the tab?
from time.
@Frikki It pauses the time then resumes where it left off on refocus.
from time.
What if you don't use periodic() to track time, but just use periodic() to sample time? For instance with Date.now()
. If you want a stopwatch, you can subtract from an initial timestamp.
from time.
What is the advantage of this approach over usingTime.animationFrames()
? (wanting to learn not saying it's better).
from time.
They're comparable, but either way all it's not going to run in the background, since both of them are powered by requestAnimationFrame
under the hood, and animations don't need to run in the background.
One option to consider, is that I just checked in Chrome and it seems like setImmediate
still runs in the background, albeit slower, and I wouldn't be surprised if the polyfill hack using postMessage
works as well.
I might consider powering periodic()
and others from a setImmediate
schedule to enable this. That additional flexibility in the design would also aid with implementing #29.
animationFrames
and throttleAnimation
would still be requestAnimationFrame
powered and could be used to throttle the UI as needed, so that would be okay. We could just document how requestAnimationFrame
works here.
from time.
Oh, and a use case as to why this is important: say you want to play a sound on a timer, it would not be great if it just didn't work at all because it was in a background tab. Much better to have it play 500ms later than not at all.
from time.
I started having a look and as I hoped the setImmediate
polyfill runs in the background in Chrome and Firefox, so I can go ahead with this.
from time.
Related Issues (20)
- README feedback HOT 6
- Export marble diagram images from tests HOT 6
- Expectation of delayed value with start-with value fails HOT 3
- Port xstream#tween to @cycle/time HOT 4
- Support Jasmine's done.fail() HOT 3
- Document behaviour of "simultaneous" value syntax HOT 11
- Export TimeSource type
- Support snapshot style testing with html-looks-like HOT 9
- Support alternative testing frameworks such as Ava HOT 18
- Make Time.run() return a promise HOT 2
- Add throttleIdleCallback HOT 7
- Write a specification for the marble diagram DSL HOT 3
- Add support for loading extra operators HOT 13
- throttleAnimationFrame() HOT 5
- cjs bundle means lodash deps for mocking are pulled in on production apps HOT 4
- Delete code and add moved readme HOT 1
- Move issues and pull request to monorepo HOT 2
- Can you explain why the operators are useful... HOT 1
- Add support for most.js and rxjs HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from time.