# @developerportalsg/console-radar

> Listen to route changes for the Developer Console with Console Radar

Latest version **1.0.2** (published 2022-12-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @developerportalsg/console-radar
pnpm add @developerportalsg/console-radar
yarn add @developerportalsg/console-radar
bun add @developerportalsg/console-radar
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-12-07 |
| First published | 2022-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Dev Portal |
| Maintainers | pinzhengg, yanbutan, teochengyong |

## Links

- npm: https://www.npmjs.com/package/@developerportalsg/console-radar
- npm.io page: https://npm.io/package/@developerportalsg/console-radar

## Dependencies (2)

- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [history](https://npm.io/package/history.md) ^5.3.0

## Recent versions

- 1.0.2 (latest) — 2022-12-07
- 1.0.1 — 2022-12-07

## README

# console-radar

For dev console app, there will be multiple tenant apps that exists in iframe.

`console-radar` is a node package to catch route changes in the tenant app and communicate said change to the parent dev console app.

## Installation

```
npm i @developerportalsg/console-radar --save
```

## Getting Started

```js
import { ConsoleRadar } from "@developerportalsg/console-radar";

const radar = new ConsoleRadar(config.parentEndpoint) // defaults to localhost:3003

// setSessionMngCallback accepts a callback function with isAuthenticated andd csrfToken as the input
// This function will get triggered when csrf message is sent from dev console
let clientSideCsrf = ''
radar.setSessionMngCallback(function({isAuthenticated, csrfToken}){
    if(isAuthenticated){
       clientSideCsrf = csrfToken
    }
})

// notifyExpiredSession will tell parent that current session is expired and to restart the login flow
const notifySessionExpiry = (e) => {
    e.preventDefault()
    radar.notifyExpiredSession()
}
```

---
_Source: https://npm.io/package/@developerportalsg/console-radar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
