You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A React wrapper for [NMRium](https://www.nmrium.org/) that is already used in [nmrXiv](https://nmrxiv.org/) and [Chemotion](https://www.chemotion.net/), and we recommend to use it with any platform embedding [NMRium](https://www.nmrium.org/)
- Start the development server by opening a new terminal and running:
68
+
69
+
```bash
70
+
npm run build
71
+
```
72
+
73
+
The production server will run on localhost:1337.
74
+
75
+
## Wrapper Events
76
+
NMRium wrapper uses a custom event to handle the communication between NMRium and the parent application, for that we create [MessageEvent](https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent)s by using a [window interface](https://developer.mozilla.org/en-US/docs/Web/API/Window). We provide two events helper functions in /src/events/event.ts, which you can use by importing events
You can pass NMRium data that you get when you export the data from the NMRium or what you received from dataChange event
126
+
```ts
127
+
events.trigger('load', {
128
+
data: {
129
+
spectra:[
130
+
source:{
131
+
jcampURL:""
132
+
}
133
+
]
134
+
},
135
+
type:"nmrium"
136
+
}
137
+
);
138
+
```
139
+
140
+
#### Error handler example:
141
+
142
+
```ts
143
+
events.on('error', (error)=>{
144
+
// you code here
145
+
});
146
+
```
147
+
148
+
#### Data change hander example:
23
149
24
-
```docker-compose stop```
150
+
```ts
151
+
events.on('dataChange', (data)=>{
152
+
// you code here
153
+
});
154
+
```
155
+
156
+
## Contribution
157
+
### Contribute to The Code
158
+
-**Branching**: Create a new branch from the`development`. The branch name should be all small with words separated by a hyphen.
159
+
-**Pull requests**: Pull requests should go towards (also known as a PR) to the `development` branch. Please link the issues which the pull request solves ti it. Finally, assign a reviewer.
160
+
-**Delete the stale branch**: After your branch is merged and the pull request is closed, please don't forget to delete your stale branch.
0 commit comments