apollo-link-queue icon indicating copy to clipboard operation
apollo-link-queue copied to clipboard

Enable use of EventeListeners to inform when link is enqueued and dequeued

Open zesarone opened this issue 4 years ago • 3 comments

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.

zesarone avatar Feb 11 '21 19:02 zesarone

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?

helfer avatar Apr 29 '21 04:04 helfer

Codecov Report

Merging #35 (584c26d) into master (21d4b80) will decrease coverage by 37.17%. The diff coverage is 61.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

Impacted file tree graph

@@             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 data Powered by Codecov. Last update 21d4b80...eefdd2a. Read the comment docs.

codecov-commenter avatar Apr 29 '21 08:04 codecov-commenter

@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.

zesarone avatar Apr 29 '21 09:04 zesarone