From e5021187e96b78b53203bd95d08d6818aea47d17 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Wed, 14 Jul 2021 15:10:31 +0200 Subject: New Ignite 7.0.6 app --- app/models/extensions/with-environment.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/models/extensions/with-environment.ts (limited to 'app/models/extensions/with-environment.ts') diff --git a/app/models/extensions/with-environment.ts b/app/models/extensions/with-environment.ts new file mode 100644 index 0000000..9fe5fd5 --- /dev/null +++ b/app/models/extensions/with-environment.ts @@ -0,0 +1,17 @@ +import { getEnv, IStateTreeNode } from "mobx-state-tree" +import { Environment } from "../environment" + +/** + * Adds a environment property to the node for accessing our + * Environment in strongly typed. + */ +export const withEnvironment = (self: IStateTreeNode) => ({ + views: { + /** + * The environment. + */ + get environment() { + return getEnv(self) + }, + }, +}) -- cgit v1.2.3