This file contains hidden or 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
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}) |
This file contains hidden or 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
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' |
This file contains hidden or 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
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() |
This file contains hidden or 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
// | |
// 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) | |
// |
NewerOlder