michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: michael@0: const DELAY_MS = "2000"; michael@0: michael@0: let timer; michael@0: michael@0: function handleRequest(req, resp) { michael@0: resp.processAsync(); michael@0: resp.setHeader("Cache-Control", "no-cache", false); michael@0: resp.setHeader("Content-Type", "text/html;charset=utf-8", false); michael@0: michael@0: timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); michael@0: timer.init(() => { michael@0: resp.write("hi"); michael@0: resp.finish(); michael@0: }, DELAY_MS, Ci.nsITimer.TYPE_ONE_SHOT); michael@0: }