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

feat: custom events #17

Merged
merged 18 commits into from
Apr 19, 2022
Merged

feat: custom events #17

merged 18 commits into from
Apr 19, 2022

Conversation

hamed-musallam
Copy link
Collaborator

@hamed-musallam hamed-musallam commented Apr 14, 2022

we implemented event manager as a sample to use the custom event to trigger load spectra event, it contains three function

trigger (event, data) 
on (event, listener)
clean (event, listener)

To test loading spectra from external URL
1- import events from ' path /events'
2- call trigger("load",data:NMRiumData)

 events.trigger('load',  {
 spectra: [
   {
     source: {
       jcampURL:
         'https://cheminfo.github.io/nmr-dataset-demo/cytisine/13c.jdx',
     },
   },
 ],
});

We could have two main custom events
1- nmr-wrapper:load
which takes the exact data structure of the data prop of NMRium component
2- nmr-wrapper:dataChange
which returns the whole NMRium state, unless we decide they the data has to be manipulated in a specific way before triggering the event, in this case, we could return the data in this structure {type:"addPeak",data:{}}

@hamed-musallam hamed-musallam changed the title feta: custom events feat: custom events Apr 14, 2022
@CS76 CS76 merged commit df98dfa into NFDI4Chem:main Apr 19, 2022
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.

None yet

2 participants