summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/xpcshell/registertestactors-lazy.js
blob: ef04e7a8d24867247d32cbb17caf4785ba3ce4dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

var {
  RetVal,
  Actor,
  FrontClassWithSpec,
  generateActorSpec,
} = require("resource://devtools/shared/protocol.js");

const lazySpec = generateActorSpec({
  typeName: "lazy",

  methods: {
    hello: {
      response: { str: RetVal("string") },
    },
  },
});

class LazyActor extends Actor {
  constructor(conn, id) {
    super(conn, lazySpec);

    Services.obs.notifyObservers(null, "actor", "instantiated");
  }

  hello(str) {
    return "world";
  }
}
exports.LazyActor = LazyActor;

Services.obs.notifyObservers(null, "actor", "loaded");

class LazyFront extends FrontClassWithSpec(lazySpec) {
  constructor(client) {
    super(client);
  }
}
exports.LazyFront = LazyFront;