Skip to content

Commit

Permalink
Added togetherState API, see #208 and phetsims/concentration#34
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Mar 7, 2015
1 parent b706c14 commit 4ea64fa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion js/Sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,17 @@ define( function( require ) {
},

getStateJSON: function() {
return JSON.stringify( this.getState(), SimJSON.replacer );
return JSON.stringify( this.getState(), SimJSON.replacer, 2 );
},

// Assuming that together.js API features are enabled, return the state for this screen
get togetherState() {
return JSON.stringify( phet.together.getState( this ), SimJSON.replacer, 2 );
},

set togetherState( stateString ) {
var state = JSON.parse( stateString, SimJSON.reviver );
phet.together.setState( this, state );
},

getScreenshotDataURL: function() {
Expand Down

0 comments on commit 4ea64fa

Please sign in to comment.