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

Commit011b0e6

Browse files
committed
setup load task action and call
1 parent09de7a4 commit011b0e6

File tree

14 files changed

+66
-11
lines changed

14 files changed

+66
-11
lines changed

‎lib/components/Tutorials/SelectTutorial/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ var SelectTutorial = (function (_super) {
2424
}
2525
SelectTutorial.prototype.render=function(){
2626
var_a=this.props,tutorial=_a.tutorial,tutorialSet=_a.tutorialSet;
27-
varname=tutorial.name;
28-
return(React.createElement(FlatButton_1.default,{label:this.displayName(name),primary:true,onTouchTap:tutorialSet.bind(this,name)}));
27+
varname=tutorial.name,version=tutorial.version;
28+
console.log(name,version);
29+
return(React.createElement(FlatButton_1.default,{label:this.displayName(name),primary:true,onTouchTap:tutorialSet.bind(this,{name:name,version:version})}));
2930
};
3031
SelectTutorial.prototype.displayName=function(name){
3132
switch(true){

‎lib/modules/tests/actions.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ function testRun() {
1414
};
1515
}
1616
exports.testRun=testRun;
17+
functiontestLoad(){
18+
returnfunction(dispatch,getState){
19+
var_a=getState(),dir=_a.dir,pagePosition=_a.pagePosition,tutorial=_a.tutorial;
20+
dispatch({
21+
type:types_1.TEST_LOAD,payload:{
22+
dir:dir,
23+
pagePosition:pagePosition,
24+
tutorial:{
25+
name:tutorial.name,
26+
version:tutorial.version
27+
}
28+
}
29+
});
30+
};
31+
}
32+
exports.testLoad=testLoad;
1733
functiontestResult(result){
1834
returnfunction(dispatch,getState){
1935
var_a=getState(),taskActions=_a.taskActions,progress=_a.progress,pagePosition=_a.pagePosition;

‎lib/modules/tests/test-run/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use strict";
22
vartypes_1=require('../types');
3+
varload_1=require('./load');
34
varrun_1=require('./run');
45
varpageSetTimeout=1200;
56
vartestCompleteTimeout=800;
@@ -22,6 +23,7 @@ function runTest(testRun, action) {
2223
time:performance.now()+testCompleteTimeout,
2324
};
2425
case'PAGE_SET':
26+
load_1.default();
2527
return{
2628
running:false,
2729
time:performance.now()+pageSetTimeout,

‎lib/modules/tests/test-run/load.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use strict";
2+
functionloadTaskTests(){
3+
console.log('load');
4+
}
5+
Object.defineProperty(exports,"__esModule",{value:true});
6+
exports.default=loadTaskTests;

‎lib/modules/tests/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"use strict";
22
exports.TEST_COMPLETE='TEST_COMPLETE';
3+
exports.TEST_LOAD='TEST_LOAD';
34
exports.TEST_RESULT='TEST_RESULT';
45
exports.TEST_RUN='TEST_RUN';

‎lib/modules/tutorial/actions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"use strict";
22
vartypes_1=require('./types');
33
varcore_coderoad_1=require('core-coderoad');
4-
functiontutorialSet(name){
4+
functiontutorialSet(_a){
5+
varname=_a.name,version=_a.version;
56
returnfunction(dispatch,getState){
67
vardir=getState().dir;
7-
dispatch({type:types_1.TUTORIAL_SET,payload:{name:name,dir:dir}});
8+
dispatch({type:types_1.TUTORIAL_SET,payload:{name:name,dir:dir,version:version}});
89
dispatch(core_coderoad_1.routeSet('progress'));
910
};
1011
}

‎lib/modules/tutorial/reducer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var config_1 = require('./utils/config');
55
varconfig_paths_1=require('./utils/config-paths');
66
var_tutorial={
77
name:null,
8+
version:null,
89
info:null,
910
pages:[],
1011
packageJson:null,
@@ -15,7 +16,7 @@ function tutorialReducer(t, action) {
1516
if(t===void0){t=_tutorial;}
1617
switch(action.type){
1718
casetypes_1.TUTORIAL_SET:
18-
var_a=action.payload,name_1=_a.name,dir=_a.dir;
19+
var_a=action.payload,name_1=_a.name,dir=_a.dir,version=_a.version;
1920
varpackagePath=path_1.join(dir,'node_modules',name_1);
2021
varpackageJson=require(path_1.join(packagePath,'package.json'));
2122
varconfig=config_1.tutorialConfig(packageJson,dir);
@@ -27,6 +28,7 @@ function tutorialReducer(t, action) {
2728
configured.push(name_1);
2829
return{
2930
name:packageJson.name,
31+
version:version,
3032
info:info,
3133
pages:pages,
3234
packageJson:packageJson,

‎src/components/Tutorials/SelectTutorial/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ export default class SelectTutorial extends React.Component<{
1010
},{}>{
1111
publicrender(){
1212
const{tutorial, tutorialSet}=this.props;
13-
const{name}=tutorial;
13+
const{name, version}=tutorial;
14+
console.log(name,version);
1415
return(
1516
<FlatButton
1617
label={this.displayName(name)}
1718
primary={true}
18-
onTouchTap={tutorialSet.bind(this,name)}
19+
onTouchTap={tutorialSet.bind(this,{name, version})}
1920
/>
2021
);
2122
}

‎src/modules/tests/actions.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{alertOpen,hintPositionSet,progressCompletePage}from'../../actions';
2-
import{TEST_COMPLETE,TEST_RESULT,TEST_RUN}from'./types';
2+
import{TEST_COMPLETE,TEST_LOAD,TEST_RESULT,TEST_RUN}from'./types';
33

44
exportfunctiontestRun():ReduxThunk.ThunkInterface{
55
return(dispatch,getState):void=>{
@@ -15,6 +15,22 @@ export function testRun(): ReduxThunk.ThunkInterface {
1515
};
1616
}
1717

18+
exportfunctiontestLoad(){
19+
return(dispatch,getState):void=>{
20+
const{ dir, pagePosition, tutorial}=getState();
21+
dispatch({
22+
type:TEST_LOAD,payload:{
23+
dir,
24+
pagePosition,
25+
tutorial:{
26+
name:tutorial.name,
27+
version:tutorial.version
28+
}
29+
}
30+
});
31+
};
32+
}
33+
1834
exportfunctiontestResult(result:Test.Result):ReduxThunk.ThunkInterface{
1935
return(dispatch,getState):void=>{
2036
const{taskActions, progress, pagePosition}=getState();

‎src/modules/tests/test-run/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import{TEST_COMPLETE,TEST_RUN}from'../types';
2+
importloadTaskTestsfrom'./load';
23
importrunTaskTestsfrom'./run';
34

45
// timeouts = throttle test runs
@@ -35,6 +36,7 @@ export default function runTest(
3536
};
3637

3738
case'PAGE_SET':
39+
loadTaskTests();
3840
// add extra time, as page loading takes longer
3941
return{
4042
running:false,

‎src/modules/tests/test-run/load.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
exportdefaultfunctionloadTaskTests(){
2+
console.log('load')
3+
// tutorialConfig.run({});
4+
}

‎src/modules/tests/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
exportconstTEST_COMPLETE='TEST_COMPLETE';
2+
exportconstTEST_LOAD='TEST_LOAD';
23
exportconstTEST_RESULT='TEST_RESULT';
34
exportconstTEST_RUN='TEST_RUN';

‎src/modules/tutorial/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import{TUTORIAL_SET}from'./types';
22
import{routeSet}from'core-coderoad';
33

4-
exportfunctiontutorialSet(name:string):ReduxThunk.ThunkInterface{
4+
exportfunctiontutorialSet({name, version}):ReduxThunk.ThunkInterface{
55
return(dispatch,getState)=>{
66
const{dir}=getState();
7-
dispatch({type:TUTORIAL_SET,payload:{name, dir}});
7+
dispatch({type:TUTORIAL_SET,payload:{name, dir, version}});
88
dispatch(routeSet('progress'));
99
};
1010
}

‎src/modules/tutorial/reducer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import configPaths from './utils/config-paths';
66

77
const_tutorial:CR.Tutorial={
88
name:null,
9+
version:null,
910
info:null,
1011
pages:[],
1112
packageJson:null,
@@ -20,7 +21,7 @@ export default function tutorialReducer(
2021
switch(action.type){
2122

2223
caseTUTORIAL_SET:
23-
const{name, dir}=action.payload;
24+
const{name, dir, version}=action.payload;
2425

2526
// get tutorial package.json
2627
constpackagePath:string=join(dir,'node_modules',name);
@@ -39,6 +40,7 @@ export default function tutorialReducer(
3940
// return tutorial (info, pages) & tutorial package.json
4041
return{
4142
name:packageJson.name,
43+
version,
4244
info,
4345
pages,
4446
packageJson,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp