Skip to content

Instantly share code, notes, and snippets.

View mweststrate's full-sized avatar
💭
I may be slow to respond.

Michel Weststrate mweststrate

💭
I may be slow to respond.
View GitHub Profile
import uuid from 'node-uuid'
import {makeReactive} from 'mobservable'
export class NoteStore {
constructor(initialNotes=[]) {
this.notes = makeReactive(initialNotes)
}
addNote({task}) {
this.notes.push({id: uuid.v4(), task})
@mattmccray
mattmccray / immobservable.js
Created July 28, 2015 18:27
Immobservable?
import mobservable from 'mobservable/immutable' // Separate module needed?
// Not sure, but basically we need
// to mark it as immutable somehow
let user = mobservable.fromJson({
name: 'Matt',
age: 'NunYoBiznis'
})
user.name //= 'Matt'
@mattmccray
mattmccray / observant.js
Last active June 23, 2016 16:19
Port of React Mobservable ObserverMixin to Deku
import mob from 'mobservable'
export default function observant( target ) {
let _unsubscriber = null,
_updateCount = 0,
_render = target.render,
_beforeUnmount = target.beforeUnmount
target.render = ( component, setState ) => {
_unsubscriber && _unsubscriber()
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//