박찬수

commit all

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
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
......