Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
1
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
d0066a0cd41e6b27c73ffdbc22d2d1721d2380d4
1 parent
403a6c85
es6 test
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
0 deletions
public/js/channel/channel.page.js
public/js/channel/es6-test.js
public/js/channel/channel.page.js
View file @
d0066a0
...
...
@@ -4,6 +4,9 @@
* @date: 2015/11/23
*/
import
{
timeout
}
from
'./es6-test'
;
var
$
=
require
(
'yoho-jquery'
),
lazyLoad
=
require
(
'yoho-jquery-lazyload'
);
...
...
@@ -13,6 +16,19 @@ var homePage = $('.home-page').data('page'),
var
yas
=
require
(
'../common/data-yas'
);
const
defTimeout
=
(
time
,
type
=
'default'
)
=>
{
return
timeout
(
time
).
then
(()
=>
{
console
.
log
(
`
$
{
type
}
timeout
`
);
});
};
(
async
function
()
{
await
defTimeout
(
10000
,
'await'
);
defTimeout
(
500
);
console
.
log
(
'async end'
);
}());
// 给头部js获取当前频道
window
.
homePage
=
homePage
;
...
...
public/js/channel/es6-test.js
0 → 100644
View file @
d0066a0
class
Animal
{
constructor
()
{
this
.
type
=
'animal'
;
}
says
(
say
=
'hi'
)
{
setTimeout
(()
=>
{
console
.
log
(
`
$
{
this
.
type
}
says
$
{
say
}
`
);
},
1000
);
}
}
class
Cat
extends
Animal
{
constructor
()
{
super
();
this
.
type
=
'cat'
;
}
setInfo
(
info
)
{
let
{
name
,
age
,
color
}
=
info
;
name
&&
(
this
.
name
=
name
);
age
&&
(
this
.
age
=
age
);
color
&&
(
this
.
color
=
color
);
}
infos
()
{
console
.
log
(
this
);
}
}
const
timeout
=
(
ms
)
=>
{
return
new
Promise
((
resolve
)
=>
{
setTimeout
(
resolve
,
ms
);
});
};
function
*
generator
()
{
yield
'hello'
;
yield
'generator'
;
}
let
cat
=
new
Cat
();
cat
.
says
();
cat
.
setInfo
({
name
:
'mini'
,
color
:
'black'
});
cat
.
infos
();
console
.
log
([...
generator
()]);
export
{
cat
,
timeout
};
...
...
杨延青
@yangyanqing
7 years ago
Master
mentioned in commit
32d91a9e
Please
register
or
login
to post a comment