aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-09-16 16:26:16 +1200
committerAldo Cortesi <aldo@nullcube.com>2014-09-16 16:27:09 +1200
commit6efe1aa6a92ce7f9f264903e9d27fb5cf6c32bfe (patch)
treee654b27eeb7a44c61c0e1a43850966735aefb3cd
parent6bac1540bd9383c4e6e0510d9b75db34346187ed (diff)
downloadmitmproxy-6efe1aa6a92ce7f9f264903e9d27fb5cf6c32bfe.tar.gz
mitmproxy-6efe1aa6a92ce7f9f264903e9d27fb5cf6c32bfe.tar.bz2
mitmproxy-6efe1aa6a92ce7f9f264903e9d27fb5cf6c32bfe.zip
We're not ready for ES6
Lets re-evaluate in June next year when it's actually released
-rw-r--r--.gitignore3
-rw-r--r--libmproxy/web/static/js/app.js74
-rw-r--r--web/gulpfile.js24
-rw-r--r--web/src/js/actions.js (renamed from web/src/js/actions.es6.js)4
-rw-r--r--web/src/js/components/eventlog.jsx (renamed from web/src/js/components/EventLog.react.js)17
-rw-r--r--web/src/js/components/footer.jsx (renamed from web/src/js/components/Footer.react.js)4
-rw-r--r--web/src/js/components/header.jsx (renamed from web/src/js/components/Header.react.js)18
-rw-r--r--web/src/js/components/proxyapp.jsx (renamed from web/src/js/components/ProxyApp.react.js)20
-rw-r--r--web/src/js/components/traffictable.jsx (renamed from web/src/js/components/TrafficTable.react.js)12
-rw-r--r--web/src/js/connection.js (renamed from web/src/js/Connection.es6.js)31
-rw-r--r--web/src/js/dispatcher.js (renamed from web/src/js/Dispatcher.es6.js)22
-rw-r--r--web/src/js/stores/SettingsStore.es6.js27
-rw-r--r--web/src/js/stores/base.js (renamed from web/src/js/stores/base.es6.js)16
-rw-r--r--web/src/js/stores/eventlogstore.js (renamed from web/src/js/stores/EventLogStore.es6.js)46
-rw-r--r--web/src/js/stores/settingstore.js27
15 files changed, 176 insertions, 169 deletions
diff --git a/.gitignore b/.gitignore
index d75774f3..e1d46dc1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.DS_Store
MANIFEST
/build
/dist
@@ -23,4 +24,4 @@ libpathod
node_modules
bower_components
*.compiled.js
-*.map \ No newline at end of file
+*.map
diff --git a/libmproxy/web/static/js/app.js b/libmproxy/web/static/js/app.js
index dbaa5cb4..991f9af3 100644
--- a/libmproxy/web/static/js/app.js
+++ b/libmproxy/web/static/js/app.js
@@ -33,6 +33,7 @@ AppDispatcher.dispatchServerAction = function(action) {
action.actionSource = PayloadSources.SERVER_ACTION;
this.dispatch(action);
};
+
var ActionTypes = {
SETTINGS_UPDATE: "SETTINGS_UPDATE",
EVENTLOG_ADD: "EVENTLOG_ADD"
@@ -51,7 +52,7 @@ var SettingsActions = {
}
};
- function EventEmitter() {"use strict";
+function EventEmitter() {"use strict";
this.listeners = {};
}
EventEmitter.prototype.emit=function(event) {"use strict";
@@ -103,6 +104,7 @@ for(var EventEmitter____Key in EventEmitter){if(EventEmitter.hasOwnProperty(Even
var SettingsStore = new _SettingsStore();
AppDispatcher.register(SettingsStore.handle.bind(SettingsStore));
+
//
// We have an EventLogView and an EventLogStore:
// The basic architecture is that one can request views on the event log
@@ -188,7 +190,7 @@ for(EventEmitter____Key in EventEmitter){if(EventEmitter.hasOwnProperty(EventEmi
var EventLogStore = new _EventLogStore();
AppDispatcher.register(EventLogStore.handle.bind(EventLogStore));
- function _Connection(root) {"use strict";
+function _Connection(root) {"use strict";
if (!root) {
root = location.origin + "/api/v1";
}
@@ -221,15 +223,16 @@ AppDispatcher.register(EventLogStore.handle.bind(EventLogStore));
};
var Connection = new _Connection();
+
/** @jsx React.DOM */
var MainMenu = React.createClass({displayName: 'MainMenu',
- toggleEventLog:function() {
+ toggleEventLog: function() {
SettingsActions.update({
showEventLog: !this.props.settings.showEventLog
});
},
- render:function(){
+ render: function(){
return (
React.DOM.div(null,
React.DOM.button({className: "btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default"), onClick: this.toggleEventLog},
@@ -240,12 +243,12 @@ var MainMenu = React.createClass({displayName: 'MainMenu',
}
});
var ToolsMenu = React.createClass({displayName: 'ToolsMenu',
- render:function(){
+ render: function(){
return React.DOM.div(null, "Tools Menu");
}
});
var ReportsMenu = React.createClass({displayName: 'ReportsMenu',
- render:function(){
+ render: function(){
return React.DOM.div(null, "Reports Menu");
}
});
@@ -270,20 +273,20 @@ var _Header_Entries = {
};
var Header = React.createClass({displayName: 'Header',
- getInitialState:function(){
+ getInitialState: function(){
return {
active: "main"
};
},
- handleClick:function(active){
+ handleClick: function(active){
this.setState({active: active});
ReactRouter.transitionTo(_Header_Entries[active].route);
return false;
},
- handleFileClick:function(){
+ handleFileClick: function(){
console.log("File click");
},
- render:function(){
+ render: function(){
var header = [];
for(var item in _Header_Entries){
var classes = this.state.active == item ? "active" : "";
@@ -310,28 +313,29 @@ var Header = React.createClass({displayName: 'Header',
);
}
});
+
/** @jsx React.DOM */
var TrafficTable = React.createClass({displayName: 'TrafficTable',
- getInitialState:function() {
+ getInitialState: function() {
return {
flows: []
};
},
- componentDidMount:function() {
+ componentDidMount: function() {
//this.flowStore = FlowStore.getView();
//this.flowStore.addListener("change",this.onFlowChange);
},
- componentWillUnmount:function() {
+ componentWillUnmount: function() {
//this.flowStore.removeListener("change",this.onFlowChange);
//this.flowStore.close();
},
- onFlowChange:function() {
+ onFlowChange: function() {
this.setState({
//flows: this.flowStore.getAll()
});
},
- render:function() {
+ render: function() {
/*var flows = this.state.flows.map(function(flow){
return <div>{flow.request.method} {flow.request.scheme}://{flow.request.host}{flow.request.path}</div>;
}); */
@@ -344,34 +348,36 @@ var TrafficTable = React.createClass({displayName: 'TrafficTable',
);
}
});
+
/** @jsx React.DOM */
var EventLog = React.createClass({displayName: 'EventLog',
- getInitialState:function() {
+ getInitialState: function() {
return {
log: []
};
},
- componentDidMount:function() {
+ componentDidMount: function() {
this.log = EventLogStore.getView();
this.log.addListener("change", this.onEventLogChange);
},
- componentWillUnmount:function() {
+ componentWillUnmount: function() {
this.log.removeListener("change", this.onEventLogChange);
this.log.close();
},
- onEventLogChange:function() {
+ onEventLogChange: function() {
this.setState({
log: this.log.getAll()
});
},
- close:function() {
+ close: function() {
SettingsActions.update({
showEventLog: false
});
},
- render:function() {
- var messages = this.state.log.map(function(row) {return React.DOM.div({key: row.id}, row.message);});
+ render: function() {
+ //var messages = this.state.log.map(row => (<div key={row.id}>{row.message}</div>));
+ var messages = [];
return (
React.DOM.div({className: "eventlog"},
React.DOM.pre(null,
@@ -382,10 +388,11 @@ var EventLog = React.createClass({displayName: 'EventLog',
);
}
});
+
/** @jsx React.DOM */
var Footer = React.createClass({displayName: 'Footer',
- render:function(){
+ render: function(){
var mode = this.props.settings.mode;
return (
React.DOM.footer(null,
@@ -394,37 +401,38 @@ var Footer = React.createClass({displayName: 'Footer',
);
}
});
+
/** @jsx React.DOM */
//TODO: Move out of here, just a stub.
var Reports = React.createClass({displayName: 'Reports',
- render:function(){
+ render: function(){
return React.DOM.div(null, "Report Editor");
}
});
var ProxyAppMain = React.createClass({displayName: 'ProxyAppMain',
- getInitialState:function(){
+ getInitialState: function(){
return { settings: SettingsStore.getAll() };
},
- componentDidMount:function(){
+ componentDidMount: function(){
SettingsStore.addListener("change", this.onSettingsChange);
},
- componentWillUnmount:function(){
+ componentWillUnmount: function(){
SettingsStore.removeListener("change", this.onSettingsChange);
},
- onSettingsChange:function(){
+ onSettingsChange: function(){
console.log("onSettingsChange");
this.setState({settings: SettingsStore.getAll()});
},
- render:function() {
+ render: function() {
return (
React.DOM.div({id: "container"},
- Header({settings: this.state.settings}),
- React.DOM.div({id: "main"}, this.props.activeRouteHandler(null)),
- this.state.settings.showEventLog ? EventLog(null) : null,
- Footer({settings: this.state.settings})
+ Header({settings: this.state.settings}),
+ React.DOM.div({id: "main"}, this.props.activeRouteHandler(null)),
+ this.state.settings.showEventLog ? EventLog(null) : null,
+ Footer({settings: this.state.settings})
)
);
}
diff --git a/web/gulpfile.js b/web/gulpfile.js
index 6f72016b..50c1a3fa 100644
--- a/web/gulpfile.js
+++ b/web/gulpfile.js
@@ -32,17 +32,17 @@ var path = {
'vendor/react-bootstrap/react-bootstrap.js'
],
app: [
- 'js/Dispatcher.es6.js',
- 'js/actions.es6.js',
- 'js/stores/base.es6.js',
- 'js/stores/SettingsStore.es6.js',
- 'js/stores/EventLogStore.es6.js',
- 'js/Connection.es6.js',
- 'js/components/Header.react.js',
- 'js/components/TrafficTable.react.js',
- 'js/components/EventLog.react.js',
- 'js/components/Footer.react.js',
- 'js/components/ProxyApp.react.js',
+ 'js/dispatcher.js',
+ 'js/actions.js',
+ 'js/stores/base.js',
+ 'js/stores/settingstore.js',
+ 'js/stores/eventlogstore.js',
+ 'js/connection.js',
+ 'js/components/header.jsx',
+ 'js/components/traffictable.jsx',
+ 'js/components/eventlog.jsx',
+ 'js/components/footer.jsx',
+ 'js/components/proxyapp.jsx',
'js/app.js',
],
},
@@ -81,7 +81,7 @@ function scripts(files, filename, dev) {
return gulp.src(files, {base: "src", cwd: "src"})
.pipe(dev ? dont_break_on_errors(): gutil.noop())
.pipe(dev ? sourcemaps.init() : gutil.noop())
- .pipe(react({harmony: true}))
+ .pipe(react({harmony: false}))
.pipe(concat(filename))
.pipe(!dev ? uglify() : gutil.noop())
.pipe(dev ? sourcemaps.write(".", {sourceRoot: "/static"}) : gutil.noop())
diff --git a/web/src/js/actions.es6.js b/web/src/js/actions.js
index 55cb4552..6eecd78e 100644
--- a/web/src/js/actions.es6.js
+++ b/web/src/js/actions.js
@@ -4,7 +4,7 @@ var ActionTypes = {
};
var SettingsActions = {
- update(settings) {
+ update:function(settings) {
settings = _.merge({}, SettingsStore.getAll(), settings);
//TODO: Update server.
@@ -14,4 +14,4 @@ var SettingsActions = {
settings: settings
});
}
-}; \ No newline at end of file
+};
diff --git a/web/src/js/components/EventLog.react.js b/web/src/js/components/eventlog.jsx
index 6c7a7c58..530e9f4f 100644
--- a/web/src/js/components/EventLog.react.js
+++ b/web/src/js/components/eventlog.jsx
@@ -1,31 +1,32 @@
/** @jsx React.DOM */
var EventLog = React.createClass({
- getInitialState() {
+ getInitialState: function() {
return {
log: []
};
},
- componentDidMount() {
+ componentDidMount: function() {
this.log = EventLogStore.getView();
this.log.addListener("change", this.onEventLogChange);
},
- componentWillUnmount() {
+ componentWillUnmount: function() {
this.log.removeListener("change", this.onEventLogChange);
this.log.close();
},
- onEventLogChange() {
+ onEventLogChange: function() {
this.setState({
log: this.log.getAll()
});
},
- close() {
+ close: function() {
SettingsActions.update({
showEventLog: false
});
},
- render() {
- var messages = this.state.log.map(row => (<div key={row.id}>{row.message}</div>));
+ render: function() {
+ //var messages = this.state.log.map(row => (<div key={row.id}>{row.message}</div>));
+ var messages = [];
return (
<div className="eventlog">
<pre>
@@ -35,4 +36,4 @@ var EventLog = React.createClass({
</div>
);
}
-}); \ No newline at end of file
+});
diff --git a/web/src/js/components/Footer.react.js b/web/src/js/components/footer.jsx
index 20a4abfb..6d5b75a1 100644
--- a/web/src/js/components/Footer.react.js
+++ b/web/src/js/components/footer.jsx
@@ -1,7 +1,7 @@
/** @jsx React.DOM */
var Footer = React.createClass({
- render(){
+ render: function(){
var mode = this.props.settings.mode;
return (
<footer>
@@ -9,4 +9,4 @@ var Footer = React.createClass({
</footer>
);
}
-}); \ No newline at end of file
+});
diff --git a/web/src/js/components/Header.react.js b/web/src/js/components/header.jsx
index 0131d350..e6350171 100644
--- a/web/src/js/components/Header.react.js
+++ b/web/src/js/components/header.jsx
@@ -1,12 +1,12 @@
/** @jsx React.DOM */
var MainMenu = React.createClass({
- toggleEventLog() {
+ toggleEventLog: function() {
SettingsActions.update({
showEventLog: !this.props.settings.showEventLog
});
},
- render(){
+ render: function(){
return (
<div>
<button className={"btn " + (this.props.settings.showEventLog ? "btn-primary" : "btn-default")} onClick={this.toggleEventLog}>
@@ -17,12 +17,12 @@ var MainMenu = React.createClass({
}
});
var ToolsMenu = React.createClass({
- render(){
+ render: function(){
return <div>Tools Menu</div>;
}
});
var ReportsMenu = React.createClass({
- render(){
+ render: function(){
return <div>Reports Menu</div>;
}
});
@@ -47,20 +47,20 @@ var _Header_Entries = {
};
var Header = React.createClass({
- getInitialState(){
+ getInitialState: function(){
return {
active: "main"
};
},
- handleClick(active){
+ handleClick: function(active){
this.setState({active: active});
ReactRouter.transitionTo(_Header_Entries[active].route);
return false;
},
- handleFileClick(){
+ handleFileClick: function(){
console.log("File click");
},
- render(){
+ render: function(){
var header = [];
for(var item in _Header_Entries){
var classes = this.state.active == item ? "active" : "";
@@ -86,4 +86,4 @@ var Header = React.createClass({
</header>
);
}
-}); \ No newline at end of file
+});
diff --git a/web/src/js/components/ProxyApp.react.js b/web/src/js/components/proxyapp.jsx
index 07d66440..c0196461 100644
--- a/web/src/js/components/ProxyApp.react.js
+++ b/web/src/js/components/proxyapp.jsx
@@ -2,33 +2,33 @@
//TODO: Move out of here, just a stub.
var Reports = React.createClass({
- render(){
+ render: function(){
return <div>Report Editor</div>;
}
});
var ProxyAppMain = React.createClass({
- getInitialState(){
+ getInitialState: function(){
return { settings: SettingsStore.getAll() };
},
- componentDidMount(){
+ componentDidMount: function(){
SettingsStore.addListener("change", this.onSettingsChange);
},
- componentWillUnmount(){
+ componentWillUnmount: function(){
SettingsStore.removeListener("change", this.onSettingsChange);
},
- onSettingsChange(){
+ onSettingsChange: function(){
console.log("onSettingsChange");
this.setState({settings: SettingsStore.getAll()});
},
- render() {
+ render: function() {
return (
<div id="container">
- <Header settings={this.state.settings}/>
- <div id="main"><this.props.activeRouteHandler/></div>
- {this.state.settings.showEventLog ? <EventLog/> : null}
- <Footer settings={this.state.settings}/>
+ <Header settings={this.state.settings}/>
+ <div id="main"><this.props.activeRouteHandler/></div>
+ {this.state.settings.showEventLog ? <EventLog/> : null}
+ <Footer settings={this.state.settings}/>
</div>
);
}
diff --git a/web/src/js/components/TrafficTable.react.js b/web/src/js/components/traffictable.jsx
index 7e9e26e3..1ed6fbc8 100644
--- a/web/src/js/components/TrafficTable.react.js
+++ b/web/src/js/components/traffictable.jsx
@@ -1,25 +1,25 @@
/** @jsx React.DOM */
var TrafficTable = React.createClass({
- getInitialState() {
+ getInitialState: function() {
return {
flows: []
};
},
- componentDidMount() {
+ componentDidMount: function() {
//this.flowStore = FlowStore.getView();
//this.flowStore.addListener("change",this.onFlowChange);
},
- componentWillUnmount() {
+ componentWillUnmount: function() {
//this.flowStore.removeListener("change",this.onFlowChange);
//this.flowStore.close();
},
- onFlowChange() {
+ onFlowChange: function() {
this.setState({
//flows: this.flowStore.getAll()
});
},
- render() {
+ render: function() {
/*var flows = this.state.flows.map(function(flow){
return <div>{flow.request.method} {flow.request.scheme}://{flow.request.host}{flow.request.path}</div>;
}); */
@@ -31,4 +31,4 @@ var TrafficTable = React.createClass({
<div><pre> { x } </pre></div>
);
}
-}); \ No newline at end of file
+});
diff --git a/web/src/js/Connection.es6.js b/web/src/js/connection.js
index 7250dd39..1f2daeef 100644
--- a/web/src/js/Connection.es6.js
+++ b/web/src/js/connection.js
@@ -1,14 +1,13 @@
-class _Connection {
- constructor(root) {
+function _Connection(root) {"use strict";
if (!root) {
root = location.origin + "/api/v1";
}
this.root = root;
}
- init() {
+ _Connection.prototype.init=function() {"use strict";
this.openWebSocketConnection();
- }
- openWebSocketConnection() {
+ };
+ _Connection.prototype.openWebSocketConnection=function() {"use strict";
this.ws = new WebSocket(this.root.replace("http", "ws") + "/ws");
var ws = this.ws;
@@ -16,19 +15,19 @@ class _Connection {
ws.onmessage = this.onmessage.bind(this);
ws.onerror = this.onerror.bind(this);
ws.onclose = this.onclose.bind(this);
- }
- onopen(open) {
+ };
+ _Connection.prototype.onopen=function(open) {"use strict";
console.log("onopen", this, arguments);
- }
- onmessage(message) {
+ };
+ _Connection.prototype.onmessage=function(message) {"use strict";
//AppDispatcher.dispatchServerAction(...);
console.log("onmessage", this, arguments);
- }
- onerror(error) {
+ };
+ _Connection.prototype.onerror=function(error) {"use strict";
console.log("onerror", this, arguments);
- }
- onclose(close) {
+ };
+ _Connection.prototype.onclose=function(close) {"use strict";
console.log("onclose", this, arguments);
- }
-}
-var Connection = new _Connection(); \ No newline at end of file
+ };
+
+var Connection = new _Connection();
diff --git a/web/src/js/Dispatcher.es6.js b/web/src/js/dispatcher.js
index f1f36cc8..310f9a7f 100644
--- a/web/src/js/Dispatcher.es6.js
+++ b/web/src/js/dispatcher.js
@@ -3,26 +3,26 @@ const PayloadSources = {
SERVER_ACTION: "SERVER_ACTION"
};
-class Dispatcher {
- constructor() {
+
+ function Dispatcher() {"use strict";
this.callbacks = [];
}
- register(callback) {
+ Dispatcher.prototype.register=function(callback) {"use strict";
this.callbacks.push(callback);
- }
- unregister(callback) {
+ };
+ Dispatcher.prototype.unregister=function(callback) {"use strict";
var index = this.callbacks.indexOf(f);
if (index >= 0) {
this.callbacks.splice(this.callbacks.indexOf(f), 1);
}
- }
- dispatch(payload) {
+ };
+ Dispatcher.prototype.dispatch=function(payload) {"use strict";
console.debug("dispatch", payload);
- this.callbacks.forEach((callback) => {
+ this.callbacks.forEach(function(callback) {
callback(payload);
});
- }
-}
+ };
+
AppDispatcher = new Dispatcher();
AppDispatcher.dispatchViewAction = function(action) {
@@ -32,4 +32,4 @@ AppDispatcher.dispatchViewAction = function(action) {
AppDispatcher.dispatchServerAction = function(action) {
action.actionSource = PayloadSources.SERVER_ACTION;
this.dispatch(action);
-}; \ No newline at end of file
+};
diff --git a/web/src/js/stores/SettingsStore.es6.js b/web/src/js/stores/SettingsStore.es6.js
deleted file mode 100644
index 29971fa7..00000000
--- a/web/src/js/stores/SettingsStore.es6.js
+++ /dev/null
@@ -1,27 +0,0 @@
-class _SettingsStore extends EventEmitter {
- constructor() {
- super();
-
- //FIXME: What do we do if we haven't requested anything from the server yet?
- this.settings = {
- version: "0.12",
- showEventLog: true,
- mode: "transparent",
- };
- }
- getAll() {
- return this.settings;
- }
- handle(action) {
- switch (action.actionType) {
- case ActionTypes.SETTINGS_UPDATE:
- this.settings = action.settings;
- this.emit("change");
- break;
- default:
- return;
- }
- }
-}
-var SettingsStore = new _SettingsStore();
-AppDispatcher.register(SettingsStore.handle.bind(SettingsStore)); \ No newline at end of file
diff --git a/web/src/js/stores/base.es6.js b/web/src/js/stores/base.js
index 1dc4ca2f..55808deb 100644
--- a/web/src/js/stores/base.es6.js
+++ b/web/src/js/stores/base.js
@@ -1,20 +1,19 @@
-class EventEmitter {
- constructor() {
+function EventEmitter() {"use strict";
this.listeners = {};
}
- emit(event) {
+ EventEmitter.prototype.emit=function(event) {"use strict";
if (!(event in this.listeners)) {
return;
}
this.listeners[event].forEach(function(listener) {
listener.apply(this, arguments);
}.bind(this));
- }
- addListener(event, f) {
+ };
+ EventEmitter.prototype.addListener=function(event, f) {"use strict";
this.listeners[event] = this.listeners[event] || [];
this.listeners[event].push(f);
- }
- removeListener(event, f) {
+ };
+ EventEmitter.prototype.removeListener=function(event, f) {"use strict";
if (!(event in this.listeners)) {
return false;
}
@@ -22,5 +21,4 @@ class EventEmitter {
if (index >= 0) {
this.listeners[event].splice(index, 1);
}
- }
-} \ No newline at end of file
+ };
diff --git a/web/src/js/stores/EventLogStore.es6.js b/web/src/js/stores/eventlogstore.js
index e470f44f..f9d8cf27 100644
--- a/web/src/js/stores/EventLogStore.es6.js
+++ b/web/src/js/stores/eventlogstore.js
@@ -6,40 +6,40 @@
//
// See also: components/EventLog.react.js
-class EventLogView extends EventEmitter {
- constructor(store, live) {
- super();
- this._store = store;
+for(var EventEmitter____Key in EventEmitter){if(EventEmitter.hasOwnProperty(EventEmitter____Key)){EventLogView[EventEmitter____Key]=EventEmitter[EventEmitter____Key];}}var ____SuperProtoOfEventEmitter=EventEmitter===null?null:EventEmitter.prototype;EventLogView.prototype=Object.create(____SuperProtoOfEventEmitter);EventLogView.prototype.constructor=EventLogView;EventLogView.__superConstructor__=EventEmitter;
+ function EventLogView(store, live) {"use strict";
+ EventEmitter.call(this);
+ this.$EventLogView_store = store;
this.live = live;
this.log = [];
this.add = this.add.bind(this);
if (live) {
- this._store.addListener("new_entry", this.add);
+ this.$EventLogView_store.addListener("new_entry", this.add);
}
}
- close() {
- this._store.removeListener("new_entry", this.add);
- }
- getAll() {
+ EventLogView.prototype.close=function() {"use strict";
+ this.$EventLogView_store.removeListener("new_entry", this.add);
+ };
+ EventLogView.prototype.getAll=function() {"use strict";
return this.log;
- }
- add(entry) {
+ };
+ EventLogView.prototype.add=function(entry) {"use strict";
this.log.push(entry);
this.emit("change");
- }
- add_bulk(messages) {
+ };
+ EventLogView.prototype.add_bulk=function(messages) {"use strict";
var log = messages;
var last_id = log[log.length - 1].id;
- var to_add = _.filter(this.log, entry => entry.id > last_id);
+ var to_add = _.filter(this.log, function(entry) {return entry.id > last_id;});
this.log = log.concat(to_add);
this.emit("change");
- }
-}
+ };
-class _EventLogStore extends EventEmitter {
- getView(since) {
+
+for(EventEmitter____Key in EventEmitter){if(EventEmitter.hasOwnProperty(EventEmitter____Key)){_EventLogStore[EventEmitter____Key]=EventEmitter[EventEmitter____Key];}}_EventLogStore.prototype=Object.create(____SuperProtoOfEventEmitter);_EventLogStore.prototype.constructor=_EventLogStore;_EventLogStore.__superConstructor__=EventEmitter;function _EventLogStore(){"use strict";if(EventEmitter!==null){EventEmitter.apply(this,arguments);}}
+ _EventLogStore.prototype.getView=function(since) {"use strict";
var view = new EventLogView(this, !since);
//TODO: Really do bulk retrieval of last messages.
@@ -69,8 +69,8 @@ class _EventLogStore extends EventEmitter {
});
}, 1000);
return view;
- }
- handle(action) {
+ };
+ _EventLogStore.prototype.handle=function(action) {"use strict";
switch (action.actionType) {
case ActionTypes.EVENTLOG_ADD:
this.emit("new_message", action.message);
@@ -78,7 +78,7 @@ class _EventLogStore extends EventEmitter {
default:
return;
}
- }
-}
+ };
+
var EventLogStore = new _EventLogStore();
-AppDispatcher.register(EventLogStore.handle.bind(EventLogStore)); \ No newline at end of file
+AppDispatcher.register(EventLogStore.handle.bind(EventLogStore));
diff --git a/web/src/js/stores/settingstore.js b/web/src/js/stores/settingstore.js
new file mode 100644
index 00000000..5ceed7db
--- /dev/null
+++ b/web/src/js/stores/settingstore.js
@@ -0,0 +1,27 @@
+for(var EventEmitter____Key in EventEmitter){if(EventEmitter.hasOwnProperty(EventEmitter____Key)){_SettingsStore[EventEmitter____Key]=EventEmitter[EventEmitter____Key];}}var ____SuperProtoOfEventEmitter=EventEmitter===null?null:EventEmitter.prototype;_SettingsStore.prototype=Object.create(____SuperProtoOfEventEmitter);_SettingsStore.prototype.constructor=_SettingsStore;_SettingsStore.__superConstructor__=EventEmitter;
+ function _SettingsStore() {"use strict";
+ EventEmitter.call(this);
+
+ //FIXME: What do we do if we haven't requested anything from the server yet?
+ this.settings = {
+ version: "0.12",
+ showEventLog: true,
+ mode: "transparent",
+ };
+ }
+ _SettingsStore.prototype.getAll=function() {"use strict";
+ return this.settings;
+ };
+ _SettingsStore.prototype.handle=function(action) {"use strict";
+ switch (action.actionType) {
+ case ActionTypes.SETTINGS_UPDATE:
+ this.settings = action.settings;
+ this.emit("change");
+ break;
+ default:
+ return;
+ }
+ };
+
+var SettingsStore = new _SettingsStore();
+AppDispatcher.register(SettingsStore.handle.bind(SettingsStore));