hello-actor.js (572B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 /* exported HelloActor */ 4 "use strict"; 5 6 const protocol = require("resource://devtools/shared/protocol.js"); 7 8 const helloSpec = protocol.generateActorSpec({ 9 typeName: "helloActor", 10 11 methods: { 12 count: { 13 request: {}, 14 response: { count: protocol.RetVal("number") }, 15 }, 16 }, 17 }); 18 19 class HelloActor extends protocol.Actor { 20 constructor(conn) { 21 super(conn, helloSpec); 22 this.counter = 0; 23 } 24 25 count() { 26 return ++this.counter; 27 } 28 }