goog.messaging.BufferedChannel
Provided By | |
---|---|
Extends | |
All Implemented Interfaces |
Creates a new BufferedChannel, which operates like its underlying channel except that it buffers calls to send until it receives a message from its peer claiming that the peer is ready to receive. The peer is also expected to be a BufferedChannel, though this is not enforced.
new BufferedChannel( messageChannel, opt_interval )
Parameters |
|
---|
Instance Methods
this.addOnDisposeCallback<T>( callback, opt_scope ) → void
void
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added. If a callback is added to an already disposed Disposable, it will be called immediately.
Defined by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.connect( opt_connectCb ) → void
void
Initiates the channel connection. When this method is called, all the information needed to connect the channel has to be available.
Implementers should only require this method to be called if the channel needs to be configured in some way between when it's created and when it becomes active. Otherwise, the channel should be immediately active and this method should do nothing but immediately call opt_connectCb.
Specified by | |||||
---|---|---|---|---|---|
Parameters |
|
this.dispose() → ?
?
Disposes of the object and its resources.
Overrides | ||
---|---|---|
Specified by | ||
Parameters | None. | |
Returns |
|
this.disposeInternal() → void
void
Performs appropriate cleanup. See description of goog.disposable.IDisposable
for examples. Classes that extend goog.Disposable
should override this
method. Not reentrant. To avoid calling it twice, it must only be called from
the subclass' disposeInternal
method. Everywhere else the public dispose
method must be used. For example:
mypackage.MyClass = function() { mypackage.MyClass.base(this, 'constructor'); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { // Dispose logic specific to MyClass. ... // Call superclass's disposeInternal at the end of the subclass's, like // in C++, to avoid hard-to-catch issues. mypackage.MyClass.base(this, 'disposeInternal'); };
Overrides | |
---|---|
Parameters | None. |
this.getDisposed() → boolean
boolean
warning Deprecated | Use |
---|
Defined by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.isConnected() → boolean
boolean
Gets whether the channel is connected.
If #connect
is not required for this class, this should always return
true. Otherwise, this should return true by the time the callback passed to
#connect
has been called and always after that.
Specified by | |||
---|---|---|---|
Parameters | None. | ||
Returns |
|
this.isDisposed() → boolean
boolean
Overrides | |||
---|---|---|---|
Specified by | |||
Parameters | None. | ||
Returns |
|
this.isPeerReady() → boolean
boolean
Parameters | None. | ||
---|---|---|---|
Returns |
|
this.registerDefaultService( callback ) → void
void
Registers a service to be called when a message is received that doesn't match any other services.
Specified by | |||||
---|---|---|---|---|---|
Parameters |
|
this.registerDisposable( disposable ) → void
void
Associates a disposable object with this object so that they will be disposed together.
Defined by | |||||
---|---|---|---|---|---|
Parameters |
|
this.registerService( serviceName, callback, opt_objectPayload ) → void
void
Registers a service to be called when a message is received.
Implementers shouldn't impose any restrictions on the service names that may
be registered. If some services are needed as control codes,
goog.messaging.MultiMessageChannel
can be used to safely split the
channel into "public" and "control" virtual channels.
Specified by | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
this.send( serviceName, payload ) → void
void
Send a message over the channel. If the peer is not ready, the message will be buffered and sent once we've received a ready message from our peer.
Specified by | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
| ||||||||
See Also | goog.net.xpc.BufferedChannel.send |
Instance Properties
this.creationStack → (string|undefined)
(string|undefined)
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.