Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
var sessionPrestartConfirm_func = function (event_name, data) {
self.sessions[self.playerToSession[data['rand_user']]].sessionPrestartConfirm(data);
};
var sendFrame_func = function (event_name, data) {
self.sessions[self.playerToSession[data['rand_user']]].sendFrame(data);
};
var completedRound_func = function (event_name, data) {
self.sessions[self.playerToSession[data['rand_user']]].completedRound(data);
};
var terminateSession_func = function (event_name, data) {
console.log("Terminate Session: ", data['session_id']);
delete self.sessions[data['session_id']];
};
// sets the pubsub handlers for the dispatcher
this.readyForSession_pubsub = PubSub.subscribe('readyForSession', readyForSession_func);
this.readyPlayer_pubsub = PubSub.subscribe('playerReady', readyPlayer_func);
this.readyNotPlayer_pubsub = PubSub.subscribe('playerNotReady', readyNotPlayerr_func);
this.sessionPrestartConfirm_pubsub = PubSub.subscribe('sessionPrestartConfirm', sessionPrestartConfirm_func);
this.sendFrame_pubsub = PubSub.subscribe('sendFrame', sendFrame_func);
this.completedRound_pubsub = PubSub.subscribe('completedRound', completedRound_func);
this.exitSessionQuene_pubsub = PubSub.subscribe('exitSessionQuene', exitSessionQuene_func);
this.confirmedConnection_pubsub = PubSub.subscribe('confirmedSession', confirmed_connection_func);
this.leaveSession_pubsub = PubSub.subscribe('leaveSession', leaveSessionn_func);
this.disconnectUser_pubsub = PubSub.subscribe('disconnectUser', disconnectUser_func);
this.terminateSession_pubsub = PubSub.subscribe('terminateSession', terminateSession_func);
}
componentWillMount: function() {
var self = this;
// Setup all the subscriptions.
PubSub.subscribe(Editor.topics().ContentChange, self.handleContentChange);
PubSub.subscribe(MenuBar.topics().ModeChange, self.handleModeChange);
PubSub.subscribe(MenuBar.topics().ItemClick, self.handleMenuItemClick);
PubSub.subscribe(GitHub.topics().Token, self.handleGatekeeperToken);
PubSub.subscribe(Avatar.topics().LoginClick, self.handleLoginClick);
// If there's a gist id in the url, retrieve the gist.
var match = location.href.match(/[a-z\d]+$/);
if (match) {
GitHub.readGist(this.getToken(), match[0])
.then(function(gist) {
// Instruct Output to render all code.
self.makeOutputRenderAllCode.pop();
self.makeOutputRenderAllCode.push(true);
// Extract code contents and selected mode.
var data = GitHub.convertGistToLivecodingData(gist);
module.exports = () => {
let currentGameId = null;
function lookingAtGame(gameId) {
currentGameId = gameId;
}
function notLookingAtGame() {
currentGameId = null;
}
PubSub.subscribe('viewing_game', (msg, data) => {
lookingAtGame(data.gameId);
});
PubSub.subscribe('exited_game', () => {
notLookingAtGame();
});
return {
getCurrentGame: () => currentGameId,
};
};
componentDidMount () {
this._isMounted = true
this.subEvent = PubSub.subscribe('DomainVoteTokenDistribution.getPoll', this.getPoll)
if (this.props.domainData) {
this.getPoll()
}
}
module.exports = () => {
let currentGameId = null;
function lookingAtGame(gameId) {
currentGameId = gameId;
}
function notLookingAtGame() {
currentGameId = null;
}
PubSub.subscribe('viewing_game', (msg, data) => {
lookingAtGame(data.gameId);
});
PubSub.subscribe('exited_game', () => {
notLookingAtGame();
});
return {
getCurrentGame: () => currentGameId,
};
};
pubsubSubscription () {
this.startWalkthroughEvent = PubSub.subscribe('RegistryWalkthrough.startJoyride', this.startJoyride)
this.handleWalkthroughCallbackEvent = PubSub.subscribe('RegistryWalkthrough.handleJoyride', this.handleJoyrideCallback)
this.resumeWalkthroughEvent = PubSub.subscribe('RegistryWalkthrough.resumeJoyride', this.resumeJoyride)
this.toggleOverlayEvent = PubSub.subscribe('RegistryWalkthrough.toggleOverlay', this.toggleOverlay)
this.confirmWalkthroughEvent = PubSub.subscribe('RegistryWalkthrough.confirmWalkthrough', this.confirmWalkthrough)
this.resetStepsEvent = PubSub.subscribe('RegistryWalkthrough.resetSteps', this.resetSteps)
}
}
pubsubSubscription () {
this.startRegistryWalkthroughEvent = PubSub.subscribe('RegistryGuideModal.startRegistryWalkthrough', this.startRegistryWalkthrough)
this.viewGuideEvent = PubSub.subscribe('RegistryGuideModal.show', this.show)
this.redirectEvent = PubSub.subscribe('RegistryGuideModal.redirect', this.redirect)
this.returnToMenuEvent = PubSub.subscribe('RegistryGuideModal.returnToMenu', this.returnToMenu)
}
}
].forEach(( msg ) => Pubsub.subscribe( msg, handleBroadcast ));
}
componentDidMount () {
PubSub.subscribe(ADD_MODAL, this.addModal.bind(this));
PubSub.subscribe(REMOVE_MODAL, this.removeModal.bind(this));
PubSub.subscribe(CLICKAWAY, () => {
let props = modals[modals.length - 1];
if (props.clickaway) {
PubSub.publish(REMOVE_MODAL);
}
});
}
return music !== item;
})
});
});
PubSub.subscribe('PLAY_NEXT', () => {
this.playNext();
});
PubSub.subscribe('PLAY_PREV', () => {
this.playNext('prev');
});
let repeatList = [
'cycle',
'once',
'random'
];
PubSub.subscribe('CHANAGE_REPEAT', () => {
let index = repeatList.indexOf(this.state.repeatType);
index = (index + 1) % repeatList.length;
this.setState({
repeatType: repeatList[index]
});
});
},
componentWillUnmount() {