# @jswork/hot-config-service

> A lightweight JavaScript class for dynamic configurations.

Latest version **1.0.14** (published 2025-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jswork/hot-config-service
pnpm add @jswork/hot-config-service
yarn add @jswork/hot-config-service
bun add @jswork/hot-config-service
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.14 |
| Published | 2025-07-03 |
| First published | 2023-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 76.5 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | afeiship, yujiao.luo |
| Keywords | config, hot, service |

## Links

- npm: https://www.npmjs.com/package/@jswork/hot-config-service
- Homepage: https://js.work
- npm.io page: https://npm.io/package/@jswork/hot-config-service

## Dependencies (3)

- [object-path](https://npm.io/package/object-path.md) 0.11.0
- [@jswork/fetch-mp](https://npm.io/package/@jswork/fetch-mp.md) ^1.0.5
- [@jswork/fetch-with-timeout](https://npm.io/package/@jswork/fetch-with-timeout.md) ^1.0.2

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.14 (latest) — 2025-07-03
- 1.0.13 — 2025-05-27
- 1.0.12 — 2025-05-27
- 1.0.11 — 2025-05-26
- 1.0.10 — 2025-05-22
- 1.0.9 — 2025-05-22
- 1.0.8 — 2025-05-22
- 1.0.7 — 2025-05-19
- 1.0.6 — 2025-05-13
- 1.0.5 — 2025-05-13
- 1.0.4 — 2023-12-17
- 1.0.3 — 2023-12-15
- 1.0.1 — 2023-12-15

## README

# hot-config-service
> A lightweight JavaScript class for dynamic configurations.

[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]

## installation
```shell
yarn add @jswork/hot-config-service
```

## usage
```js
import HotConfigService from '@jswork/hot-config-service';

const hotConfig = new HotConfigService({
  // 环境配置，可以设置多个环境的API地址
  envs: {
    'beta': 'https://student-api.beta.saybot.net',
    'production': 'https://student-api.alo7.com'
  },
  // 当前环境
  env: 'beta',
  // API路径，可选，默认为空
  path: '/api/v2/configurations/',
  // 请求超时时间，可选，默认为30秒
  timeout: 30000,
  // 当请求失败时的默认配置，可选
  fallback: {}
});

// 获取配置
await hotConfig.fetch();

// 获取整个配置对象
const config = hotConfig.get();

// 获取特定路径的配置值
const value = hotConfig.get('some.nested.key');
```

## license
Code released under [the MIT license](https://github.com/afeiship/hot-config-service/blob/master/LICENSE.txt).

[version-image]: https://img.shields.io/npm/v/@jswork/hot-config-service
[version-url]: https://npmjs.org/package/@jswork/hot-config-service

[license-image]: https://img.shields.io/npm/l/@jswork/hot-config-service
[license-url]: https://github.com/afeiship/hot-config-service/blob/master/LICENSE.txt

[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/hot-config-service
[size-url]: https://github.com/afeiship/hot-config-service/blob/master/dist/index.min.js

[download-image]: https://img.shields.io/npm/dm/@jswork/hot-config-service
[download-url]: https://www.npmjs.com/package/@jswork/hot-config-service

---
_Source: https://npm.io/package/@jswork/hot-config-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
