Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Created September 20, 2015 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r7kamura/c4e3529e6b018dafffcd to your computer and use it in GitHub Desktop.
Save r7kamura/c4e3529e6b018dafffcd to your computer and use it in GitHub Desktop.
import EventPublisher from '../../shared/libraries/event-publisher'
export default class State extends EventPublisher {
constructor() {
super();
this.selectedSheet = null;
this.sheets = [];
}
addSheet(sheet) {
this.sheets = [...this.sheets, sheet].sort((a, b) => b.stats.mtime - a.stats.mtime);
this.publish('changed');
}
selectSheet(sheet) {
this.selectedSheet = sheet;
this.publish('changed');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment