@@ -88,27 +88,27 @@ editor.getSession().setMode('ace/mode/javascript');
8888/* ------------------------------------------------------------
8989 EVENT LISTENERS / SEND DATA TO SERVER
9090
91- EVENT NAMES: CLIENT FUNCTIONS:
92- - connection Send: SocketIO built-in event
93- - disconnect Send: SocketIO built-in event
94- - loggedIn Send: handleUserLogin
95- - editorTextChange Send: handleUserTyping
96- Receive: handleEditorChange
97- - playerListChange Receive: handlePlayerListChange
98- - updateState Receive: handleUpdateState
99- - turnChange Receive: handleTurnChange
100- - editorCursorChange Send: handleChangeCursor
101- Receive: handleNewCursorData
102- - editorScrollChange Send: handleeditorScrollChange
103- Receive: handleNewScrollData
104- - createNewGist Receive: createNewGist
105- - newGistLink Receive: handleNewGistLink
106- Send: (sent after creating or forking)
91+ EVENT NAMES: CLIENT FUNCTIONS:
92+ - connection Send: SocketIO built-in event
93+ - disconnect Send: SocketIO built-in event
94+ - loggedIn Send: handleUserLogin
95+ - editorTextChange Send: handleLocalEditorTextChange
96+ Receive: handleServerEditorTextChange
97+ - playerListChange Receive: handlePlayerListChange
98+ - updateState Receive: handleUpdateState
99+ - turnChange Receive: handleTurnChange
100+ - editorCursorChange Send: handleLocalEditorCursorChange
101+ Receive: handleServerEditorCursorChange
102+ - editorScrollChange Send: handleLocalEditorScrollChange
103+ Receive: handleServerEditorScrollChange
104+ - createNewGist Receive: createNewGist
105+ - newGistLink Receive: handleNewGistLink
106+ Send: (sent after creating or forking)
107107-------------------------------------------------------------- */
108- editor . getSession ( ) . on ( 'change' , handleUserTyping ) ;
109- editor . getSession ( ) . selection . on ( 'editorCursorChange' , handleChangeCursor ) ;
110- editor . getSession ( ) . on ( 'changeScrollLeft' , handleChangeScroll ) ;
111- editor . getSession ( ) . on ( 'changeScrollTop' , handleChangeScroll ) ;
108+ editor . getSession ( ) . on ( 'change' , handleLocalEditorTextChange ) ;
109+ editor . getSession ( ) . selection . on ( 'editorCursorChange' , handleLocalEditorCursorChange ) ;
110+ editor . getSession ( ) . on ( 'changeScrollLeft' , handleLocalEditorScrollChange ) ;
111+ editor . getSession ( ) . on ( 'changeScrollTop' , handleLocalEditorScrollChange ) ;
112112
113113// When client connects to server,
114114socket . on ( 'connect' , function ( ) {
@@ -139,8 +139,8 @@ function handleUserLogin (userData) {
139139}
140140
141141// Send editorInputView data to server
142- function handleUserTyping ( event ) {
143- //console.log('handleUserTyping event! value: ');
142+ function handleLocalEditorTextChange ( event ) {
143+ //console.log('handleLocalEditorTextChange event! value: ');
144144 //console.log(event);
145145
146146 //console.log('%c ' + editor.getValue(), 'color: green; font-weight: bold;');
@@ -176,7 +176,7 @@ function handleUserNameChange (event) {
176176}
177177
178178// Send cursor and selection data to server
179- function handleChangeCursor ( event ) {
179+ function handleLocalEditorCursorChange ( event ) {
180180 //console.log('editorCursorChange fired!');
181181 //console.log('%c ' + event, 'color: green; font-weight: bold;');
182182
@@ -191,7 +191,7 @@ function handleChangeCursor (event) {
191191}
192192
193193// Send scroll data to server
194- function handleChangeScroll ( event ) {
194+ function handleLocalEditorScrollChange ( event ) {
195195 //console.log('editorScrollChange (left or top) fired!');
196196 //console.log('%c scrollLeft: ' + editor.getSession().getScrollLeft() + ', scrollTop: ' + editor.getSession().getScrollTop(), 'color: green; font-weight: bold;');
197197
@@ -205,25 +205,25 @@ function handleChangeScroll (event) {
205205/* -------------------------------------------------
206206 EVENT LISTENERS / RECEIVE DATA FROM SERVER
207207---------------------------------------------------- */
208- socket . on ( 'editorTextChange' , handleEditorChange ) ;
209- socket . on ( 'editorCursorChange' , handleNewCursorData ) ;
210- socket . on ( 'editorScrollChange' , handleNewScrollData ) ;
208+ socket . on ( 'editorTextChange' , handleServerEditorTextChange ) ;
209+ socket . on ( 'editorCursorChange' , handleServerEditorCursorChange ) ;
210+ socket . on ( 'editorScrollChange' , handleServerEditorScrollChange ) ;
211211socket . on ( 'playerListChange' , handlePlayerListChange ) ;
212212socket . on ( 'updateState' , handleUpdateState ) ;
213213socket . on ( 'turnChange' , handleTurnChange ) ;
214214socket . on ( 'createNewGist' , createNewGist ) ;
215215socket . on ( 'newGistLink' , handleNewGistLink ) ;
216216
217217// When receiving new editorInputView data from server
218- function handleEditorChange ( data ) {
218+ function handleServerEditorTextChange ( data ) {
219219 //console.log('editorTextChange event received!');
220220 //console.log('%c ' + data, 'color: blue; font-weight: bold;');
221221
222222 updateEditorView ( data ) ;
223223}
224224
225225// When receiving new cursor/selection data from server
226- function handleNewCursorData ( data ) {
226+ function handleServerEditorCursorChange ( data ) {
227227 //console.log('%c cursorChange event received!', 'color: blue; font-weight: bold;');
228228 //console.dir(data);
229229
@@ -233,7 +233,7 @@ function handleNewCursorData (data) {
233233}
234234
235235// When receiving new scroll data from server
236- function handleNewScrollData ( data ) {
236+ function handleServerEditorScrollChange ( data ) {
237237 //console.log('%c editorScrollChange event received!', 'color: blue; font-weight: bold;');
238238 //console.dir(data);
239239
0 commit comments