@@ -92,21 +92,21 @@ editor.getSession().setMode('ace/mode/javascript');
9292 - connection Send: SocketIO built-in event
9393 - disconnect Send: SocketIO built-in event
9494 - loggedIn Send: handleUserLogin
95- - editorChange Send: handleUserTyping
95+ - editorTextChange Send: handleUserTyping
9696 Receive: handleEditorChange
9797 - playerListChange Receive: handlePlayerListChange
9898 - updateState Receive: handleUpdateState
9999 - turnChange Receive: handleTurnChange
100- - changeCursor Send: handleChangeCursor
100+ - editorCursorChange Send: handleChangeCursor
101101 Receive: handleNewCursorData
102- - changeScroll Send: handleChangeScroll
102+ - editorScrollChange Send: handleeditorScrollChange
103103 Receive: handleNewScrollData
104104 - createNewGist Receive: createNewGist
105105 - newGistLink Receive: handleNewGistLink
106106 Send: (sent after creating or forking)
107107-------------------------------------------------------------- */
108108editor . getSession ( ) . on ( 'change' , handleUserTyping ) ;
109- editor . getSession ( ) . selection . on ( 'changeCursor ' , handleChangeCursor ) ;
109+ editor . getSession ( ) . selection . on ( 'editorCursorChange ' , handleChangeCursor ) ;
110110editor . getSession ( ) . on ( 'changeScrollLeft' , handleChangeScroll ) ;
111111editor . getSession ( ) . on ( 'changeScrollTop' , handleChangeScroll ) ;
112112
@@ -149,7 +149,7 @@ function handleUserTyping (event) {
149149 if ( socket . id === currentPlayerId ) {
150150 //console.log('Sending data to server!')
151151 // Send data to server
152- socket . emit ( 'editorChange ' , editor . getValue ( ) ) ;
152+ socket . emit ( 'editorTextChange ' , editor . getValue ( ) ) ;
153153 }
154154}
155155
@@ -177,7 +177,7 @@ function handleUserNameChange (event) {
177177
178178// Send cursor and selection data to server
179179function handleChangeCursor ( event ) {
180- //console.log('changeCursor fired!');
180+ //console.log('editorCursorChange fired!');
181181 //console.log('%c ' + event, 'color: green; font-weight: bold;');
182182
183183 // Cursor object:
@@ -187,16 +187,16 @@ function handleChangeCursor (event) {
187187 // { end: {column, row}, start: {column, row} }
188188
189189 // Send to server:
190- socket . emit ( 'changeCursor ' , { cursor : editor . getSession ( ) . selection . getCursor ( ) , range : editor . getSession ( ) . selection . getRange ( ) } ) ;
190+ socket . emit ( 'editorCursorChange ' , { cursor : editor . getSession ( ) . selection . getCursor ( ) , range : editor . getSession ( ) . selection . getRange ( ) } ) ;
191191}
192192
193193// Send scroll data to server
194194function handleChangeScroll ( event ) {
195- //console.log('changeScroll (left or top) fired!');
195+ //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
198198 // Send to server:
199- socket . emit ( 'changeScroll ' , { scrollLeft : editor . getSession ( ) . getScrollLeft ( ) , scrollTop : editor . getSession ( ) . getScrollTop ( ) } ) ;
199+ socket . emit ( 'editorScrollChange ' , { scrollLeft : editor . getSession ( ) . getScrollLeft ( ) , scrollTop : editor . getSession ( ) . getScrollTop ( ) } ) ;
200200}
201201
202202// TODO: Test 'input' event some more in different browsers!
@@ -205,9 +205,9 @@ function handleChangeScroll (event) {
205205/* -------------------------------------------------
206206 EVENT LISTENERS / RECEIVE DATA FROM SERVER
207207---------------------------------------------------- */
208- socket . on ( 'editorChange ' , handleEditorChange ) ;
209- socket . on ( 'changeCursor ' , handleNewCursorData ) ;
210- socket . on ( 'changeScroll ' , handleNewScrollData ) ;
208+ socket . on ( 'editorTextChange ' , handleEditorChange ) ;
209+ socket . on ( 'editorCursorChange ' , handleNewCursorData ) ;
210+ socket . on ( 'editorScrollChange ' , handleNewScrollData ) ;
211211socket . on ( 'playerListChange' , handlePlayerListChange ) ;
212212socket . on ( 'updateState' , handleUpdateState ) ;
213213socket . on ( 'turnChange' , handleTurnChange ) ;
@@ -216,7 +216,7 @@ socket.on('newGistLink', handleNewGistLink);
216216
217217// When receiving new editorInputView data from server
218218function handleEditorChange ( data ) {
219- //console.log('editorChange event received!');
219+ //console.log('editorTextChange event received!');
220220 //console.log('%c ' + data, 'color: blue; font-weight: bold;');
221221
222222 updateEditorView ( data ) ;
@@ -234,7 +234,7 @@ function handleNewCursorData (data) {
234234
235235// When receiving new scroll data from server
236236function handleNewScrollData ( data ) {
237- //console.log('%c scrollChange event received!', 'color: blue; font-weight: bold;');
237+ //console.log('%c editorScrollChange event received!', 'color: blue; font-weight: bold;');
238238 //console.dir(data);
239239
240240 // Set Ace editor's scroll position to match
0 commit comments