Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

zesarone
Copy link

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.

- It is now possible to add an eventlistener to be notified after beeing queued and before beeing dequeued for further processing.
@helfer
Copy link
Owner

helfer commented Apr 29, 2021

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?

* Removal of old listeners

- Return a GUID on creation of a listener
- Function for removing the listener by passing GUID, opName and event

* Remove tslint rules that are no longer in use
@codecov-commenter
Copy link

codecov-commenter commented Apr 29, 2021

Codecov Report

Merging #35 (584c26d) into master (21d4b80) will decrease coverage by 37.17%.
The diff coverage is 61.33%.

❗ 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%) ⬇️

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.

@zesarone
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants