cheminfo / cheminfo/nmrium

Getting .nmrium file from callback

Open
#2,102 0 comments 0 reactions 1 assignee Claimed by @hamed-musallam View on GitHub
enhancement
Dominant language
TypeScript
Stars
80
Forks
34
Avg merge
2d 9h
Merged PRs (30d)
36

Description

The NMRium component has a property that contains a callback `onDataChange` that is called when the 'data' state change and `onViewChange` for when the view state changes (surprisingly no `onSettingsChange` ?

In order to be able to save the current global state in a database without the data I would:
- add a new callback `onChange` triggered when data, view or settings is changing. This callback would receive the `nmriumState`
- expose `serializeNmriumState` https://github.com/cheminfo/nmr-load-save/blob/master/src/save/serializeNmriumState.ts to be able to customize how this state should be saved

@targos Do you agree with this ? I'm wondering how to expose `serializeNmriumState` as well ? Should we add a second parameter in the callback ? Something like:

```js
onChange = (nmriumState, helpers) => {
helpers.serializeNmriumState(nmriumState, {includeData: 'dataSource'})
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.