runtime.js
 1  "use strict";
 2  Object.defineProperty(exports, "__esModule", { value: true });
 3  exports.LegacyRuntime = exports.Runtime = void 0;
 4  const isJetEnvironment = typeof exportService === "function";
 5  function nativeExportService(name, service) {
 6      exportService(name, service);
 7  }
 8  class Runtime {
 9      constructor(dispatcher, objectGraph) {
10          this.dispatcher = dispatcher;
11          this.objectGraph = objectGraph;
12      }
13      async dispatch(intent) {
14          return await this.dispatcher.dispatch(intent, this.objectGraph);
15      }
16  }
17  exports.Runtime = Runtime;
18  class LegacyRuntime extends Runtime {
19      constructor(dispatcher, objectGraph, services) {
20          super(dispatcher, objectGraph);
21          this.services = services;
22      }
23      serviceWithName(name) {
24          return this.services[name];
25      }
26      exportingService(name, service) {
27          if (isJetEnvironment) {
28              nativeExportService(name, service);
29          }
30          this.services[name] = service;
31          return this;
32      }
33  }
34  exports.LegacyRuntime = LegacyRuntime;
35  //# sourceMappingURL=runtime.js.map