Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr committed Sep 24, 2024
1 parent 15941f4 commit 54d78cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/contributing/998-archived/01-compile-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ new cloud.Function(inflight ()=> {
// push a message to queue
queue.push("m");
// sleep according to target
if util.env("WING_TARGET") == "sim" {
if @target == "sim" {
log("Running on Simulator, sleeping for 1s");
util.sleep(1s);
} else {
Expand All @@ -85,7 +85,7 @@ new cloud.Function(inflight ()=> {
});
```

In this example, we want to sleep briefly for the Simulator target and for 30 seconds for cloud targets, this is achieved using the `WING_TARGET` environment variable.
In this example, we want to sleep briefly for the simulator target and for 30 seconds for cloud targets, this is achieved using the `@target` intrinsic function.

## Compiler plugins

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/03-platforms/01-understanding-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ vpc_api_gateway = true

There might be times when you need to write code that is specific to a particular platform target. For example, you may want to activate a verbose logging service only when testing locally to save on cloud log storage costs.

With the Wing `util` library, you can access environment variables. The `WING_TARGET` environment variable contains the current platform target as it's value, which you can use to conditionally run target-specific code. See the example below:
The `@target` intrinsic returns the current platform target as a string value, which you can use to conditionally run target-specific code. See the example below:

```js playground example
bring cloud;
Expand All @@ -138,7 +138,7 @@ new cloud.Function(inflight ()=> {
// push a message to queue
queue.push("m");
// sleep according to target
if util.env("WING_TARGET") == "sim" {
if @target == "sim" {
log("Running on Simulator, sleeping for 1s");
util.sleep(1s);
} else {
Expand Down

0 comments on commit 54d78cc

Please sign in to comment.