mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Upgrade telepath
This commit is contained in:
@@ -75,7 +75,7 @@ class EditSession
|
||||
|
||||
@displayBuffer.on 'grammar-changed', => @handleGrammarChange()
|
||||
|
||||
@state.observe ({key, newValue}) =>
|
||||
@state.on 'changed', ({key, newValue}) =>
|
||||
switch key
|
||||
when 'scrollTop'
|
||||
@trigger 'scroll-top-changed', newValue
|
||||
|
||||
@@ -18,7 +18,7 @@ class PaneAxis extends View
|
||||
@state = telepath.Document.create(deserializer: @className(), children: [])
|
||||
@addChild(child) for child in args
|
||||
|
||||
@state.get('children').observe ({index, inserted, removed, site}) =>
|
||||
@state.get('children').on 'changed', ({index, inserted, removed, site}) =>
|
||||
return if site is @state.site.id
|
||||
for childState in removed
|
||||
@removeChild(@children(":eq(#{index})").view(), updateState: false)
|
||||
|
||||
@@ -24,7 +24,7 @@ class PaneContainer extends View
|
||||
else
|
||||
@state = telepath.Document.create(deserializer: 'PaneContainer')
|
||||
|
||||
@state.observe ({key, newValue, site}) =>
|
||||
@state.on 'changed', ({key, newValue, site}) =>
|
||||
return if site is @state.site.id
|
||||
if key is 'root'
|
||||
@setRoot(deserialize(newValue), updateState: false)
|
||||
|
||||
@@ -35,14 +35,14 @@ class Pane extends View
|
||||
deserializer: 'Pane'
|
||||
items: @items.map (item) -> item.getState?() ? item.serialize()
|
||||
|
||||
@state.get('items').observe ({index, removed, inserted, site}) =>
|
||||
@state.get('items').on 'changed', ({index, removed, inserted, site}) =>
|
||||
return if site is @state.site.id
|
||||
for itemState in removed
|
||||
@removeItemAtIndex(index, updateState: false)
|
||||
for itemState, i in inserted
|
||||
@addItem(deserialize(itemState), index + i, updateState: false)
|
||||
|
||||
@state.observe ({key, newValue, site}) =>
|
||||
@state.on 'changed', ({key, newValue, site}) =>
|
||||
return if site is @state.site.id
|
||||
@showItemForUri(newValue) if key is 'activeItemUri'
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class GuestSession
|
||||
console.log 'connection opened'
|
||||
connection.once 'data', (data) =>
|
||||
console.log 'received document'
|
||||
doc = telepath.Document.deserialize(telepath.createSite(@getId()), data)
|
||||
doc = telepath.Document.deserialize(data, site: telepath.createSite(@getId()))
|
||||
atom.windowState = doc.get('windowState')
|
||||
@participants = doc.get('participants')
|
||||
connectDocument(doc, connection)
|
||||
|
||||
@@ -22,11 +22,10 @@ class HostSession
|
||||
@participants.push
|
||||
id: @getId()
|
||||
email: git.getConfigValue('user.email')
|
||||
@participants.observe =>
|
||||
@participants.on 'changed', =>
|
||||
@trigger 'participants-changed', @participants.toObject()
|
||||
|
||||
@peer.on 'connection', (connection) =>
|
||||
console.log connection
|
||||
connection.on 'open', =>
|
||||
console.log 'sending document'
|
||||
connection.send(@doc.serialize())
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports =
|
||||
event.id = nextOutputEventId++
|
||||
console.log 'sending event', event.id, event
|
||||
connection.send(event)
|
||||
doc.outputEvents.on('changed', outputListener)
|
||||
doc.on('output', outputListener)
|
||||
|
||||
queuedEvents = []
|
||||
nextInputEventId = 1
|
||||
@@ -40,7 +40,7 @@ module.exports =
|
||||
queuedEvents.push(event)
|
||||
|
||||
connection.on 'close', ->
|
||||
doc.outputEvents.removeListener('changed', outputListener)
|
||||
doc.off('changed', outputListener)
|
||||
|
||||
connection.on 'error', (error) ->
|
||||
console.error 'connection error', error.stack ? error
|
||||
|
||||
2
vendor/telepath
vendored
2
vendor/telepath
vendored
Submodule vendor/telepath updated: 3b465ef7e0...a120988f18
Reference in New Issue
Block a user