Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
warden
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚广胤
warden
Commits
774187c4
Commit
774187c4
authored
Mar 14, 2018
by
姚广胤
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除
parent
d0cb87a3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
49 deletions
+0
-49
demo.js
server/demo.js
+0
-40
test.js
server/test.js
+0
-9
No files found.
server/demo.js
deleted
100644 → 0
View file @
d0cb87a3
// 回调地狱
module
.
exports
=
function
(
param
,
cb
)
{
asyncFun1
(
param
,
function
(
result1
)
{
asyncFun2
(
result1
,
function
(
result2
)
{
asyncFun3
(
result2
,
function
(
result3
)
{
cb
(
result3
)
})
})
})
};
// Promise
module
.
exports
=
function
(
param
,
cb
)
{
asyncFun1
(
param
).
then
(
function
(
result1
)
{
return
result1
;
}
).
then
(
function
(
result1
)
{
return
asyncFun2
(
param
);
}).
then
(
function
(
result2
)
{
return
asyncFun3
(
param
);
}).
then
(
function
(
result3
)
{
cb
(
result3
);
});
}
// ES6 Generator
module
.
exports
=
function
*
(
param
,
cb
)
{
const
result1
=
yield
asyncFun1
(
param
);
const
result2
=
yield
asyncFun2
(
result1
);
const
result3
=
yield
asyncFun3
(
result2
);
cb
(
result3
);
};
// ES7
module
.
exports
=
async
(
param
,
cb
)
=>
{
const
result1
=
await
asyncFun1
(
param
);
const
result2
=
await
asyncFun2
(
result1
);
const
result3
=
await
asyncFun3
(
result2
);
cb
(
result3
);
};
server/test.js
deleted
100644 → 0
View file @
d0cb87a3
var
schedule
=
require
(
"node-schedule"
);
var
date
=
new
Date
(
2018
,
2
,
12
,
16
,
56
,
0
);
var
j
=
schedule
.
scheduleJob
(
date
,
function
(){
console
.
log
(
"执行任务"
);
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment