Skip to content

Commit

Permalink
Fix missing runtime context (PolymerLabs#4107)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianull authored Nov 20, 2019
1 parent 7011613 commit ade1f8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion shells/pipes-shell/source/pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ export const busReady = async (bus, {manifest}) => {
const configureRuntime = async ({rootPath, urlMap, storage, manifest}, bus) => {
// configure arcs runtime environment
Runtime.init(rootPath, urlMap);
// marshal context
// marshal and bind context
const context = await requireContext(manifest || config.manifest);
Runtime.getRuntime().bindContext(context);
// attach verb-handlers to dispatcher
populateDispatcher(dispatcher, storage, context);
// send pipe identifiers to client
Expand Down
7 changes: 6 additions & 1 deletion src/runtime/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let runtime: Runtime | null = null;
// currently imported by ArcsLib.js. Once that refactoring is done, we can
// think about what the api should actually look like.
export class Runtime {
public readonly context: Manifest;
public context: Manifest;
public readonly pecFactory: PecFactory;
private cacheService: RuntimeCacheService;
private loader: Loader | null;
Expand Down Expand Up @@ -146,6 +146,11 @@ export class Runtime {
destroy() {
}

// Allow dynamic context binding to this runtime.
bindContext(context: Manifest) {
this.context = context;
}

/**
* Given an arc name, return either:
* (1) the already running arc
Expand Down

0 comments on commit ade1f8a

Please sign in to comment.