Skip to content

Commit ae11eb4

Browse files
docs : load event
1 parent ec0d6ac commit ae11eb4

1 file changed

Lines changed: 35 additions & 17 deletions

File tree

README.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,53 @@ window.addEventListener(`message`, listenerHandler)
5959

6060
| name | data/handler | description |
6161
|:---- |------------------- | :---- |
62-
| loadURLs | { urls: [] } | load spectra from external URL |
63-
| load | NMRiumData | load nmrium data |
62+
| load | LoadData Object | load spectra and molecules |
6463
| error | (error:Error)=>ErrorHanlder | triggered once error happen at level of the wrapper |
6564
| dataChange | (data:NMRiumData)=>{} | triggered when changes happen on the side of NMRIum |
6665

67-
#### Load spectra and molfile from external URLs example:
66+
67+
68+
#### Load spectra and molfile files:
6869
```ts
6970
import events from '../events';
7071

71-
events.trigger('loadURLs', {
72-
urls: [
73-
'https://cheminfo.github.io/nmr-dataset-demo/cytisine/13c.jdx',
74-
'https://cheminfo.github.io/nmr-dataset-demo/cytisine/1h.jdx',
75-
'https://cheminfo.github.io/bruker-data-test/data/zipped/aspirin-1h.zip',
76-
],
77-
});
72+
events.trigger('load', {
73+
data: [{data:ArrayBuffer,name:file1.dx},{data:ArrayBuffer,name:file2.dx}, ....etc],
74+
type:"file"
75+
}
76+
);
77+
```
78+
79+
#### Load spectra and molfile from external URLs example:
80+
```ts
81+
import events from '../events';
82+
83+
events.trigger('load', {
84+
data: [
85+
'https://cheminfo.github.io/nmr-dataset-demo/cytisine/13c.jdx',
86+
'https://cheminfo.github.io/bruker-data-test/data/zipped/aspirin-1h.zip',
87+
...etc
88+
],
89+
type:"url"
90+
}
91+
);
7892
```
7993

8094
#### Load NMRium data example:
8195

8296
You can pass NMRium data that you get when you export the data from the NMRium or what you received from dataChange event
8397
```ts
84-
events.trigger('load', {
85-
spectra:[
86-
source:{
87-
jcampURL:""
88-
}
89-
]
90-
});
98+
events.trigger('load', {
99+
data: {
100+
spectra:[
101+
source:{
102+
jcampURL:""
103+
}
104+
]
105+
},
106+
type:"nmrium"
107+
}
108+
);
91109
```
92110

93111
#### Error handler example:

0 commit comments

Comments
 (0)