Skip to content

Commit

Permalink
Update the Tips section in README
Browse files Browse the repository at this point in the history
  • Loading branch information
Amphiluke committed May 25, 2017
1 parent b12c275 commit 2014e8d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,11 @@ Note that the potential parameters are also available as direct instance propert
The overridden method `toJSON()` allows the instances of the potprox potential classes to be easily serialized to a JSON string, and restored from the JSON string later on.

```javascript
// Create and serialize
let morse = new potprox.Morse({d0: 0.0368, r0: 5.316, a: 0.867});
// Serialize
let json = JSON.stringify(morse);
// Unserialize
// Unserialize and restore
let potentialData = JSON.parse(json);
let morseCopy = new potprox[potentialData.type](potentialData);
```

0 comments on commit 2014e8d

Please sign in to comment.