mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 06:35:42 +00:00
f389d7ede3
Heintroduce the old Actor/FrontClass constructors.
41 lines
984 B
JavaScript
41 lines
984 B
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
var {method, RetVal, Actor, ActorClassWithSpec, Front, FrontClassWithSpec,
|
|
generateActorSpec} = require("devtools/shared/protocol");
|
|
var Services = require("Services");
|
|
|
|
const lazySpec = generateActorSpec({
|
|
typeName: "lazy",
|
|
|
|
methods: {
|
|
hello: {
|
|
response: { str: RetVal("string") }
|
|
}
|
|
}
|
|
});
|
|
|
|
exports.LazyActor = ActorClassWithSpec(lazySpec, {
|
|
initialize: function (conn, id) {
|
|
Actor.prototype.initialize.call(this, conn);
|
|
|
|
Services.obs.notifyObservers(null, "actor", "instantiated");
|
|
},
|
|
|
|
hello: function (str) {
|
|
return "world";
|
|
}
|
|
});
|
|
|
|
Services.obs.notifyObservers(null, "actor", "loaded");
|
|
|
|
exports.LazyFront = FrontClassWithSpec(lazySpec, {
|
|
initialize: function (client, form) {
|
|
Front.prototype.initialize.call(this, client);
|
|
this.actorID = form.lazyActor;
|
|
|
|
client.addActorPool(this);
|
|
this.manage(this);
|
|
}
|
|
});
|