goog.gears.WorkerChannel
Classgoog.gears.WorkerChannel
> goog.messaging.AbstractChannel
> goog.Disposable
goog.gears.WorkerChannel(worker)
Creates a message channel for the given Gears worker.
worker
{goog.gears.Worker
}
.FLAG
{string
}The flag added to messages that are sent by a GearsWorkerChannel, and are meant to be handled by one on the other side.
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.checkMessageOrigin(messageOrigin)
[protected]Checks whether the origin for a given message is the expected origin. If it's not, a warning is logged and the message is ignored. This checks that the origin matches the peerOrigin property. It can be overridden if more complex origin detection is necessary.
messageOrigin
{string
}
boolean
}
.connect()
Inherited from goog.messaging.AbstractChannel
.
Immediately calls opt_connectCb if given, and is otherwise a no-op. If subclasses have configuration that needs to happen before the channel is connected, they should override this and {@link #isConnected}.
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.decodePayload(serviceName, payload, objectPayload)
[protected]Inherited from goog.messaging.AbstractChannel
.
Converts the message payload into the format expected by the registered service (either JSON or string).
serviceName
{string
}
payload
{string
|!Object
}
objectPayload
{boolean
}
string
|Object
}
.deliver(serviceName, payload)
[protected]Inherited from goog.messaging.AbstractChannel
.
Delivers a message to the appropriate service. This is meant to be called by subclasses when they receive messages. This method takes into account both explicitly-registered and default services, as well as making sure that JSON payloads are decoded when necessary. If the subclass is capable of passing objects as payloads, those objects can be passed in to this method directly. Otherwise, the (potentially JSON-encoded) strings should be passed in.
serviceName
{string
}
payload
{string
|!Object
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:
mypackage.MyClass = function() { goog.base(this); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { goog.base(this, 'disposeInternal'); // Dispose logic specific to MyClass. ... };
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getService(serviceName, payload)
[protected]Inherited from goog.messaging.AbstractChannel
.
Find the service object for a given service name. If there's no service explicitly registered, but there is a default service, a service object is constructed for it.
serviceName
{string
}
payload
{string
|!Object
}
callback
: function
((string
|!Object
)), objectPayload
: boolean
}}
.isConnected()
Inherited from goog.messaging.AbstractChannel
.
Always returns true. If subclasses have configuration that needs to happen before the channel is connected, they should override this and {@link #connect}.
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.logger
[protected] {goog.debug.Logger
}Logger for this class.
.peerOrigin
{?string
}The expected origin of the other end of the worker channel, represented as a string of the form SCHEME://DOMAIN[:PORT]. The port may be omitted for standard ports (http port 80, https port 443). If this is set, all GearsWorkerChannel messages are validated to come from this origin, and ignored (with a warning) if they don't. Messages that aren't in the GearsWorkerChannel format are not validated. If more complex origin validation is required, the checkMessageOrigin method can be overridden.
.registerDefaultService()
Inherited from goog.messaging.AbstractChannel
.
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.registerService()
Inherited from goog.messaging.AbstractChannel
.
.send()