Metadata-Version: 2.4
Name: dash-offline-detect-plugin
Version: 0.1.2
Summary: Offline detect plugin for Dash applications using Dash Hooks.
Home-page: https://github.com/CNFeffery/dash-offline-detect-plugin
Author: CNFeffery
Author-email: fefferypzy@gmail.com
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dash>=3.0.4
Dynamic: author
Dynamic: author-email
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: summary

# dash-offline-detect-plugin

Offline detect plugin for Dash applications using Dash Hooks. You can check out this project on PyPi at: https://pypi.org/project/dash-offline-detect-plugin

## Installation

```bash
pip install dash-offline-detect-plugin
```

## Usage

```python
from dash import Dash
# Import the offline detect plugin
from dash_offline_detect_plugin import setup_offline_detect_plugin

# Enable the offline detect plugin for the current app
setup_offline_detect_plugin()

app = Dash(__name__)
# Rest of your app code...
```

## Example

Run the included example:

```bash
python example.py
```

<center><img src="./images/demo.gif" /></center>

## API Reference

### `setup_offline_detect_plugin()`

This function enables the offline detection feature for your Dash application.

| Parameter     | Type  | Default                                                              | Description                                                                                                                      |
| ------------- | ----- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `interval`    | `int` | `5000`                                                               | Interval of detection in browser (milliseconds). Controls how frequently the browser checks if the backend service is available. |
| `title`       | `str` | `"Service Unavailable"`                                              | Title of the overlay displayed when the service is unavailable.                                                                  |
| `description` | `str` | `"Unable to connect to the backend service, trying to reconnect..."` | Description text displayed in the overlay when the service is unavailable.                                                       |
