Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit445bcc9

Browse files
committed
refactor services into actions
1 parentc91a79f commit445bcc9

File tree

136 files changed

+802
-771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+802
-771
lines changed

‎lib/actions/_types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ exports.PACKAGE_SET = 'PACKAGE_SET';
1010
exports.PAGE_NEXT='PAGE_NEXT';
1111
exports.PAGE_SET='PAGE_SET';
1212
exports.POSITION_SET='POSITION_SET';
13+
exports.PROGRESS_LOAD='PROGRESS_LOAD';
1314
exports.ROUTE_SET='ROUTE_SET';
1415
exports.SETUP_VERIFY='SETUP_VERIFY';
1516
exports.TEST_COMPLETE='TEST_COMPLETE';
1617
exports.TEST_RESULT='TEST_RESULT';
1718
exports.TEST_RUN='TEST_RUN';
19+
exports.TESTS_LOAD='TESTS_LOAD';
1820
exports.TUTORIAL_SET='TUTORIAL_SET';
1921
exports.TUTORIAL_UPDATE='TUTORIAL_UPDATE';
2022
exports.TUTORIALS_FIND='TUTORIALS_FIND';

‎lib/actions/alert.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ var _types_1 = require('./_types');
44
functionalertToggle(alert){
55
varisOpen=store_1.store.getState().alert.open;
66
if(!alert){
7-
alert={message:'',action:'',open:false};
7+
alert={
8+
action:'',
9+
message:'',
10+
open:false,
11+
};
812
}
913
else{
1014
alert=Object.assign({},{open:!isOpen},alert);
1115
}
12-
return{type:_types_1.ALERT_TOGGLE,payload:{alert:alert}};
16+
return{
17+
payload:{alert:alert},
18+
type:_types_1.ALERT_TOGGLE,
19+
};
1320
}
1421
exports.alertToggle=alertToggle;
1522
functionalertReplay(){

‎lib/actions/globals.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎lib/actions/hint.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
"use strict";
22
var_types_1=require('./_types');
33
functionhintPositionSet(hintPosition){
4-
return{type:_types_1.HINT_POSITION_SET,payload:{hintPosition:hintPosition}};
4+
return{
5+
payload:{hintPosition:hintPosition},
6+
type:_types_1.HINT_POSITION_SET,
7+
};
58
}
69
exports.hintPositionSet=hintPositionSet;
710
functionhintShow(){

‎lib/actions/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
varalert_1=require('./alert');
33
exports.alertToggle=alert_1.alertToggle;
44
exports.alertReplay=alert_1.alertReplay;
5-
varcomplete_1=require('./complete');
6-
exports.completePage=complete_1.completePage;
7-
exports.completeChapter=complete_1.completeChapter;
8-
exports.completeTutorial=complete_1.completeTutorial;
5+
varprogress_1=require('./progress');
6+
exports.progressLoad=progress_1.progressLoad;
7+
exports.completePage=progress_1.completePage;
8+
exports.completeChapter=progress_1.completeChapter;
9+
exports.completeTutorial=progress_1.completeTutorial;
910
varhint_1=require('./hint');
1011
exports.hintShow=hint_1.hintShow;
1112
exports.hintPositionSet=hint_1.hintPositionSet;
@@ -22,6 +23,7 @@ var test_1 = require('./test');
2223
exports.testRun=test_1.testRun;
2324
exports.testComplete=test_1.testComplete;
2425
exports.testResult=test_1.testResult;
26+
exports.testsLoad=test_1.testsLoad;
2527
vartutorial_1=require('./tutorial');
2628
exports.tutorialsFind=tutorial_1.tutorialsFind;
2729
exports.tutorialSet=tutorial_1.tutorialSet;

‎lib/actions/page.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
"use strict";
22
var_types_1=require('./_types');
33
varstore_1=require('../store');
4-
vartutorial_package_1=require('../services/tutorial-package');
54
functionpageNext(){
65
varposition=store_1.store.getState().position;
7-
varnextPosition=tutorial_package_1.default.getNextPosition(position);
8-
returnpageSet(nextPosition);
6+
return{type:_types_1.PAGE_NEXT,payload:{position:position}};
97
}
108
exports.pageNext=pageNext;
11-
functionpageSet(selectedPosition){
12-
if(selectedPosition===void0){selectedPosition={chapter:0,page:0};}
13-
if(selectedPosition.completed){
14-
return{type:_types_1.ROUTE_SET,payload:{route:'final'}};
9+
functionpageSet(position){
10+
if(position===void0){position={chapter:0,page:0};}
11+
if(position.completed){
12+
return{
13+
payload:{route:'final'},
14+
type:_types_1.ROUTE_SET,
15+
};
1516
}
16-
varpage=tutorial_package_1.default.getPage(selectedPosition);
17-
vartasks=tutorial_package_1.default.getTasks(selectedPosition);
18-
vartaskTests=[].concat.apply([],tasks.map(function(task){returntask.tests||[];}));
19-
varactions=tasks.map(function(task){returntask.actions||[];});
20-
return{type:_types_1.PAGE_SET,payload:{page:page,tasks:tasks,position:selectedPosition,taskTests:taskTests,actions:actions}};
17+
return{
18+
payload:{position:position},
19+
type:_types_1.PAGE_SET,
20+
};
2121
}
2222
exports.pageSet=pageSet;

‎lib/actions/position.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"use strict";
22
var_types_1=require('./_types');
33
functionpositionSet(position){
4-
return{type:_types_1.POSITION_SET,payload:{position:position}};
4+
return{
5+
payload:{position:position},
6+
type:_types_1.POSITION_SET,
7+
};
58
}
69
exports.positionSet=positionSet;

‎lib/actions/complete.jsrenamed to ‎lib/actions/progress.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
"use strict";
22
var_types_1=require('./_types');
33
varstore_1=require('../store');
4+
functionprogressLoad(){
5+
return{type:_types_1.PROGRESS_LOAD};
6+
}
7+
exports.progressLoad=progressLoad;
48
functioncompletePage(){
59
varposition=store_1.store.getState().position;
610
varpageLength=store_1.store.getState().progress.chapters[position.chapter].pages.length;
711
if(position.page>=pageLength-1){
812
returncompleteChapter();
913
}
10-
return{type:_types_1.COMPLETE_PAGE,payload:{position:position}};
14+
return{
15+
payload:{position:position},
16+
type:_types_1.COMPLETE_PAGE,
17+
};
1118
}
1219
exports.completePage=completePage;
1320
functioncompleteChapter(){
@@ -16,7 +23,10 @@ function completeChapter() {
1623
if(chapter>=chapterLength-1){
1724
returncompleteTutorial();
1825
}
19-
return{type:_types_1.COMPLETE_CHAPTER,payload:{chapter:chapter}};
26+
return{
27+
payload:{chapter:chapter},
28+
type:_types_1.COMPLETE_CHAPTER,
29+
};
2030
}
2131
exports.completeChapter=completeChapter;
2232
functioncompleteTutorial(){

‎lib/actions/route.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ function setRoute(route) {
1010
store_1.store.dispatch(tutorial_1.tutorialsFind());
1111
}
1212
previous=route;
13-
return{type:_types_1.ROUTE_SET,payload:{route:route}};
13+
return{
14+
payload:{route:route},
15+
type:_types_1.ROUTE_SET,
16+
};
1417
}
1518
}
1619
exports.setRoute=setRoute;

‎lib/actions/test.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ function testRun() {
77
exports.testRun=testRun;
88
functiontestResult(result){
99
varactions=store_1.store.getState().editorActions;
10-
return{type:_types_1.TEST_RESULT,payload:{result:result,actions:actions}};
10+
return{
11+
payload:{result:result,actions:actions},
12+
type:_types_1.TEST_RESULT,
13+
};
1114
}
1215
exports.testResult=testResult;
1316
functiontestComplete(){
1417
return{type:_types_1.TEST_COMPLETE};
1518
}
1619
exports.testComplete=testComplete;
20+
functiontestsLoad(){
21+
return{type:_types_1.TESTS_LOAD};
22+
}
23+
exports.testsLoad=testsLoad;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp