This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Room = require('colyseus').Room | |
class ChatRoom extends Room { | |
constructor (options) { | |
super( options ) | |
this.name = options.name; | |
this.setState({ messages: [] }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* globals localStorage */ | |
import { onSnapshot, applySnapshot } from 'mobx-state-tree'; | |
import Storage from './storage'; | |
export const persist = (name, store, options, schema = {}) => { | |
let hydrated = false; | |
let storage = options.storage; | |
if (typeof localStorage !== 'undefined' && localStorage === storage) { |