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
var AppDispatcher = require('../dispatcher/AppDispatcher'); | |
var AppConstants = require('../constants/AppConstants'); | |
var EventEmitter = require('events').EventEmitter; | |
var assign = require('object-assign'); | |
var ActionTypes = AppConstants.ActionTypes; | |
var CHANGE_EVENT = 'change'; | |
var ExampleStore = assign({}, EventEmitter.prototype, { |
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 EventEmitter from 'events'; | |
var CHANGE_EVENT = 'change'; | |
class Store extends EventEmitter { | |
constructor() { | |
super(); | |
} |
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 FluxStore from './FluxStore'; | |
import AppDispatcher from '../dispatcher/AppDispatcher'; | |
import {ActionTypes} from '../constants/AppConstants'; | |
let appState; | |
function reset() { | |
appState = {}; | |
} |
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
Object.defineProperty(exports, '__esModule', { value: true }); | |
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { | |
var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if | |
('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, | |
protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | |
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, | |
receiver = _x3; desc = parent = getter = undefined; _again = false; var desc = Object.getOwnPropertyDescriptor(object, |
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
(def raw-data [ | |
{ | |
:id "m_1" | |
:threadID "t_1" | |
:threadName "Jing and Bill" | |
:authorName "Bill" | |
:text "Hey Jing want to give a Flux talk at ForwardJS?" | |
:timestamp (- (dt/now) 99999)} | |
{ | |
:id "m_2" |
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
(def reconciler | |
(om/reconciler {:state {:threads (reduce threads [] raw-data)} | |
:parser (om/parser {:read read})})) | |
(om/add-root! reconciler | |
ChatApp | |
(gdom/getElement "app")) |
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
{:threads | |
[{:thread/id "t_1", | |
:thread/name "Jing and Bill", | |
:thread/messages | |
[{:message/id "m_1", | |
:message/author-name "Bill", | |
:message/text "Hey Jing want to give a Flux talk at ForwardJS?", | |
:message/date #inst "2015-11-24T12:59:52.245-00:00"} | |
{:message/id "m_2", | |
:message/author-name "Bill", |
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
{:threads | |
[[:threads/by-id "t_1"] | |
[:threads/by-id "t_2"] | |
[:threads/by-id "t_3"]], | |
:messages/by-id | |
{"m_1" | |
{:message/id "m_1", | |
:message/author-name "Bill", | |
:message/text "Hey Jing want to give a Flux talk at ForwardJS?", | |
:message/date #inst "2015-11-24T15:48:21.793-00:00"}, |
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
(defui MessageItem | |
static om/Ident | |
(ident [this {:keys [message/id]}] | |
[:messages/by-id id]) | |
static om/IQuery | |
(query [this] | |
[:message/id :message/author-name :message/date :message/text]) | |
Object |
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
{:threads | |
[[:threads/by-id "t_1"] | |
[:threads/by-id "t_2"] | |
[:threads/by-id "t_3"]], | |
:messages/bucket | |
{"m_1" | |
{:message/id "m_1", | |
:message/author-name "Bill", | |
:message/text "Hey Jing want to give a Flux talk at ForwardJS?", | |
:message/date #inst "2015-12-08T14:48:34.292-00:00"}, |
OlderNewer