From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001 From: rxliuli Date: Tue, 4 Nov 2025 05:03:50 +0800 Subject: init commit --- node_modules/@jet/environment/runtime/runtime.js | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 node_modules/@jet/environment/runtime/runtime.js (limited to 'node_modules/@jet/environment/runtime/runtime.js') diff --git a/node_modules/@jet/environment/runtime/runtime.js b/node_modules/@jet/environment/runtime/runtime.js new file mode 100644 index 0000000..3c885c5 --- /dev/null +++ b/node_modules/@jet/environment/runtime/runtime.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LegacyRuntime = exports.Runtime = void 0; +const isJetEnvironment = typeof exportService === "function"; +function nativeExportService(name, service) { + exportService(name, service); +} +class Runtime { + constructor(dispatcher, objectGraph) { + this.dispatcher = dispatcher; + this.objectGraph = objectGraph; + } + async dispatch(intent) { + return await this.dispatcher.dispatch(intent, this.objectGraph); + } +} +exports.Runtime = Runtime; +class LegacyRuntime extends Runtime { + constructor(dispatcher, objectGraph, services) { + super(dispatcher, objectGraph); + this.services = services; + } + serviceWithName(name) { + return this.services[name]; + } + exportingService(name, service) { + if (isJetEnvironment) { + nativeExportService(name, service); + } + this.services[name] = service; + return this; + } +} +exports.LegacyRuntime = LegacyRuntime; +//# sourceMappingURL=runtime.js.map \ No newline at end of file -- cgit v1.2.3