Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박찬수
/
enjoy_soccer
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박찬수
2022-06-08 15:10:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3b6db3e5d4d038a44c650220aa5f54a3835ac5ee
3b6db3e5
1 parent
3433040a
commit all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
eventemit.js
soccer.js
eventemit.js
0 → 100644
View file @
3b6db3e
function
Emitter
(){
this
.
events
=
{};
}
Emitter
.
prototype
.
on
=
function
(
type
,
listener
){
this
.
events
[
type
]
=
this
.
events
[
type
]
||
[];
this
.
events
[
type
].
push
(
listener
);
}
const
emitter
=
new
Emitter
();
emitter
.
on
(
'soccer'
,
function
(){
console
.
log
(
'soccer logged.'
);
})
Emitter
.
prototype
.
emit
=
function
(
type
){
if
(
this
.
events
[
type
]){
this
.
events
[
type
].
forEach
(
function
(
listener
){
listener
();
});
}
}
emitter
.
emit
(
'soccer'
);
\ No newline at end of file
soccer.js
View file @
3b6db3e
module
.
exports
=
{
GetPlayerInfo
:
function
(
playerID
,
season
){
var
request
=
require
(
'request'
);
var
request
=
require
(
'request'
);
var
options
=
{
method
:
'GET'
,
url
:
'https://v3.football.api-sports.io/players'
,
qs
:
{
id
:
playerID
,
season
:
season
},
qs
:
{
id
:
276
,
season
:
2019
},
headers
:
{
'x-rapidapi-host'
:
'v3.football.api-sports.io'
,
'x-rapidapi-key'
:
'526fc70a2e8b315e9a960ac4b4764191'
...
...
@@ -12,7 +10,6 @@ module.exports = {
};
request
(
options
,
function
(
error
,
response
)
{
if
(
error
)
throw
new
Error
(
error
);
console
.
log
(
response
.
body
);
});
}
}
\ No newline at end of file
\ No newline at end of file
...
...
Please
register
or
login
to post a comment