mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-30 18:18:45 +03:00
Simplify method names on DeserializerManager
This commit is contained in:
parent
ca137974c9
commit
08177feb67
@ -1,20 +1,25 @@
|
||||
{Document} = require 'telepath'
|
||||
|
||||
# Public: Manages the deserializers used for serialized state
|
||||
module.exports =
|
||||
class DeserializerManager
|
||||
constructor: ->
|
||||
@deserializers = {}
|
||||
@deferredDeserializers = {}
|
||||
|
||||
registerDeserializer: (klasses...) ->
|
||||
# Public: Add a deserializer.
|
||||
add: (klasses...) ->
|
||||
@deserializers[klass.name] = klass for klass in klasses
|
||||
|
||||
registerDeferredDeserializer: (name, fn) ->
|
||||
# Public: Add a deferred deserializer.
|
||||
addDeferred: (name, fn) ->
|
||||
@deferredDeserializers[name] = fn
|
||||
|
||||
unregisterDeserializer: (klasses...) ->
|
||||
# Public: Remove a deserializer.
|
||||
remove: (klasses...) ->
|
||||
delete @deserializers[klass.name] for klass in klasses
|
||||
|
||||
# Public: Deserialize the state and params.
|
||||
deserialize: (state, params) ->
|
||||
return unless state?
|
||||
|
||||
@ -27,7 +32,8 @@ class DeserializerManager
|
||||
else
|
||||
console.warn "No deserializer found for", state
|
||||
|
||||
getDeserializer: (state) ->
|
||||
# Public: Get the deserializer for the state.
|
||||
get: (state) ->
|
||||
return unless state?
|
||||
|
||||
name = state.get?('deserializer') ? state.deserializer
|
||||
|
@ -104,17 +104,17 @@ window.onerror = ->
|
||||
atom.openDevTools()
|
||||
|
||||
window.registerDeserializers = (args...) ->
|
||||
atom.deserializers.registerDeserializer(args...)
|
||||
atom.deserializers.add(args...)
|
||||
window.registerDeserializer = (args...) ->
|
||||
atom.deserializers.registerDeserializer(args...)
|
||||
atom.deserializers.add(args...)
|
||||
window.registerDeferredDeserializer = (args...) ->
|
||||
atom.deserializers.registerDeferredDeserializer(args...)
|
||||
atom.deserializers.addDeferred(args...)
|
||||
window.unregisterDeserializer = (args...) ->
|
||||
atom.deserializers.unregisterDeserializer(args...)
|
||||
atom.deserializers.remove(args...)
|
||||
window.deserialize = (args...) ->
|
||||
atom.deserializers.deserialize(args...)
|
||||
window.getDeserializer = (args...) ->
|
||||
atom.deserializer.getDeserializer(args...)
|
||||
atom.deserializers.get(args...)
|
||||
window.requireWithGlobals = (args...) ->
|
||||
atom.requireWithGlobals(args...)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user