Skip to content

Commit

Permalink
feat: add API to query if micro-frontend is running standalone
Browse files Browse the repository at this point in the history
The API allows to query if a micro-frontend is running standalone or
inside the workbench application platform.

closes: #130
  • Loading branch information
mofogasy authored and danielwiehl committed Sep 10, 2019
1 parent d462512 commit 10c2b45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions projects/scion/workbench-application.core/src/lib/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export const Platform = new class {
serviceRegistry.set(symbol, service);
}

/**
* Returns true if running standalone, or false if running inside the workbench application platform.
*/
public isRunningStandalone(): boolean {
return window === window.parent;
}

/**
* Destroys this platform and releases resources allocated.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ Use the global Platform object to obtain respective service reference, e.g.:
Platform.getService(RouterService).navigate(...);
```

To query if an application is running standalone or inside the platform, call the following function:

```typescript
Platform.isRunningStandalone();
```

See the other how-to's for more detailed instructions.

### Main platform services to interact with the platform
Expand Down

0 comments on commit 10c2b45

Please sign in to comment.