Enable use of EventeListeners to inform when link is enqueued and dequeued
Used this implementation in our app and it helped us along with notifying the UI to act accordingly.
Can be used as follows
QueueLink.addLinkQueueEventListener("feedback", "enqueue", (item: any) => {
// react to event as is appropriate to your application at this event.
});
Please merge/edit/ignore if you find this useful and aligning with project plan.
Sorry for the delay @zesarone! I think this makes sense and I'd be open to merging it, but can you tell me a bit more about your use case first? Are you using it to build offline persistence, or do something else?
Codecov Report
Merging #35 (584c26d) into master (21d4b80) will decrease coverage by
37.17%. The diff coverage is61.33%.
:exclamation: Current head 584c26d differs from pull request most recent head eefdd2a. Consider uploading reports for the commit eefdd2a to get more accurate results
@@ Coverage Diff @@
## master #35 +/- ##
============================================
- Coverage 100.00% 62.82% -37.18%
============================================
Files 1 2 +1
Lines 26 78 +52
Branches 3 18 +15
============================================
+ Hits 26 49 +23
- Misses 0 29 +29
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Utils.ts | 20.00% <20.00%> (ø) |
|
| src/QueueLink.ts | 65.75% <64.28%> (-34.25%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 21d4b80...eefdd2a. Read the comment docs.
@helfer Our use case is as you mention to do offline persistence. the idea is to have a convenient access point to trigger actions in the UI and others when things get queued. Got some other changes from @fishyFrogFace in to handle cleanup of listeners etc.