Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sönke Kluth committed Nov 1, 2016
1 parent 6e7974f commit 7870dbd
Show file tree
Hide file tree
Showing 16 changed files with 188 additions and 199 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"react": "15.3.2",
"react-dom": "15.3.2"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
Expand Down
2 changes: 2 additions & 0 deletions src/controller/CounterCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export default class CounterCommand extends SimpleCommand {
case EventNames.SUBVIEW_LOCAL_COUNT:
counter = this.facade.getProxy(CounterProxy.NAME_LOCAL);
break;
default:
break;
}

if (counter) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/constants/NotificationNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const NotificationNames = {
DATA_CHANGE: 'DATA_CHANGE',
RENDER: 'RENDER',
STARTUP: 'STARTUP',
STARTUP_COMPLETE: 'STARTUP_COMPLETE'
STARTUP_COMPLETE: 'STARTUP_COMPLETE',
};

export default NotificationNames;
2 changes: 1 addition & 1 deletion src/core/controller/DataChangeCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class DataChangeCommand extends SimpleCommand {
localState[note.getType()] = data;

const state = this.facade.getState();
if(Object.hasOwnProperty.call(state, note.getType())){
if (Object.hasOwnProperty.call(state, note.getType())) {
this.facade.updateState(localState);
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/core/controller/StartupCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { ModelPrepCommand, ViewPrepCommand } from '../../controller/prep-command

export default class StartupCommand extends MacroCommand {

initializeMacroCommand() {
this.addSubCommand(ModelPrepCommand);
this.addSubCommand(ViewPrepCommand);
}
initializeMacroCommand() {
this.addSubCommand(ModelPrepCommand);
this.addSubCommand(ViewPrepCommand);
}

execute(note) {
execute(note) {
// console.log('StartupCommand execute()');
super.execute(note);
this.facade.removeCommand(NotificationNames.STARTUP);
this.facade.send(NotificationNames.RENDER);
}
super.execute(note);
this.facade.removeCommand(NotificationNames.STARTUP);
this.facade.send(NotificationNames.RENDER);
}
}

1 change: 0 additions & 1 deletion src/core/controller/StateChangeCommand.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SimpleCommand } from 'pmvc';
import NotificationNames from '../constants/NotificationNames';

export default class StateChangeCommand extends SimpleCommand {
execute(note) {
Expand Down
14 changes: 7 additions & 7 deletions src/core/utils/shallowEqual.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
export default function shallowEqual(objA, objB) {
if (objA === objB) {
return true
return true;
}

const keysA = Object.keys(objA)
const keysB = Object.keys(objB)
const keysA = Object.keys(objA);
const keysB = Object.keys(objB);

if (keysA.length !== keysB.length) {
return false
return false;
}

// Test for A's keys different from B.
const hasOwn = Object.prototype.hasOwnProperty
const hasOwn = Object.prototype.hasOwnProperty;
for (let i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) ||
objA[keysA[i]] !== objB[keysA[i]]) {
return false
return false;
}
}

return true
return true;
}
6 changes: 3 additions & 3 deletions src/core/utils/storeShape.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PropTypes } from 'react'
import { PropTypes } from 'react';

export default PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
})
getState: PropTypes.func.isRequired,
});
4 changes: 2 additions & 2 deletions src/core/utils/warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
export default function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message)
console.error(message);
}
/* eslint-enable no-console */
try {
// This error was thrown as a convenience so that if you enable
// "break on all exceptions" in your console,
// it would pause the execution at this line.
throw new Error(message)
throw new Error(message);
/* eslint-disable no-empty */
} catch (e) {}
/* eslint-enable no-empty */
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/wrapActionCreators.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import { bindActionCreators } from 'redux'

export default function wrapActionCreators(actionCreators){
export default function wrapActionCreators(actionCreators) {
console.log('wrapActionCreators', actionCreators);
// return dispatch => bindActionCreators(actionCreators, dispatch)
}
2 changes: 1 addition & 1 deletion src/core/view/PMVCMediator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class PMVCMediator extends Mediator {

constructor(name, view) {
if(!name){
instanceCount = instanceCount+1;
instanceCount += 1;
name = PMVCMediator.NAME+ '_'+instanceCount;
}
super(name, view);
Expand Down
1 change: 0 additions & 1 deletion src/core/view/Provider.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { Component } from 'react';
import storeShape from '../utils/storeShape'
import assign from 'object-assign';

export default class Provider extends Component {

Expand Down
Loading

0 comments on commit 7870dbd

Please sign in to comment.