Skip to content

Instantly share code, notes, and snippets.

View ccfiel's full-sized avatar

Chris Ian Fiel ccfiel

View GitHub Profile
@endel
endel / chat_room.js
Last active March 1, 2021 13:55
Colyseus: using the same room handler for multiple rooms.
var Room = require('colyseus').Room
class ChatRoom extends Room {
constructor (options) {
super( options )
this.name = options.name;
this.setState({ messages: [] })
@benjick
benjick / persist.js
Created June 15, 2017 11:09
mobx-state-tree persist PoC
/* 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) {