open-index/open-npm huggingface dataset:
npm package: @liukai2_p/react-native-idle-timer
Description: A cros-platform bridge that allows you to enable and disable the screen idle timer in your React Native app
Author: Marc Shilling
Latest version: 1.0.0

# react-native-idle-timer

A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app

## Install

`yarn add react-native-idle-timer`

## Link

#### Automatically

`react-native link react-native-idle-timer`

#### Manually

##### iOS
1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ `Add Files to <...>`
2. Go to `node_modules` ➜ `react-native-idle-timer` ➜ `ios` ➜ select `RNIdleTimer.xcodeproj`
3. Add `libRNIdleTimer.a` to `Build Phases -> Link Binary With Libraries`

##### Android

1. in `android/settings.gradle`

```gradle
...
include ':react-native-idle-timer'
project(':react-native-idle-timer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-idle-timer/android')
```

2. in `android/app/build.gradle` add:

```gradle
dependencies {
  ...
  compile project(':react-native-idle-timer')
}
```

3. and finally, in `android/src/main/java/com/{YOUR_APP_NAME}/MainActivity.java` add:

```java
//...
import com.marcshilling.idletimer.IdleTimerPackage; // <--- This!

//...
@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
    new MainReactPackage(),
    new IdleTimerPackage() // <---- and This!
  );
}
```

## Usage

### In your React Native javascript code, bring in the native module:

```javascript
import IdleTimerManager from 'react-native-idle-timer';
```
<br/>

### To disable the idle timer while a certain component is mounted:

Class component
```javascript
componentWillMount() {
  IdleTimerManager.setIdleTimerDisabled(true);
}

componentWillUnmount() {
  IdleTimerManager.setIdleTimerDisabled(false);
}
```


Function component

```javascript
useEffect(() => {
  IdleTimerManager.setIdleTimerDisabled(true);

  return () => IdleTimerManager.setIdleTimerDisabled(false);
}, [])
```
<br/>

### If you have multiple components that are responsible for interacting with the idle timer, you can pass a tag as the second parameter:

```javascript
useEffect(() => {
  IdleTimerManager.setIdleTimerDisabled(true, "video");

  return () => IdleTimerManager.setIdleTimerDisabled(false, "video");
}, [])
```
<br/>

### If you need to interact from the native Android or iOS side:

Android
```java
IdleTimerManager.activate(activity, "video");
IdleTimerManager.deactivate(activity, "video");
```

iOS
```objectivec
[IdleTimerManager activate:@"video"];
[IdleTimerManager deactivate:@"video"];
```
npm package: @liukangjie/uni-request-queue
Description: A smart request queue manager for UniApp with retry, offline cache, priority, cancel, and caching support.
Author: Kangjie Liu
Latest version: 1.2.0

# uni-request-queue

> 🚀 专为 UniApp 打造的生产级请求库 —— 支持队列、缓存、重试、离线队列、多实例、独立拦截器

[![npm](https://img.shields.io/npm/v/@liukangjie/uni-request-queue.svg)](https://www.npmjs.com/package/@liukangjie/uni-request-queue)
[![npm downloads](https://img.shields.io/npm/dw/@liukangjie/uni-request-queue.svg)](https://www.npmjs.com/package/@liukangjie/uni-request-queue)
[![License](https://img.shields.io/npm/l/@liukangjie/uni-request-queue.svg)](LICENSE)

`uni-request-queue` 是一个轻量、健壮、功能丰富的 UniApp 请求库，支持：

- ✅ 请求队列与优先级
- ✅ 全局 Loading 自动控制
- ✅ 请求缓存（GET）
- ✅ 失败重试 & 延迟
- ✅ 离线队列（断网自动重发）
- ✅ 多实例 & **独立拦截器**（v1.1.0 新增）
- ✅ 防抖去重
- ✅ 401 自动跳转登录
- ✅ 取消请求

---

## 📦 安装

```bash
npm install @liukangjie/uni-request-queue
```

## 🚀 快速开始

```bash
import request from '@liukangjie/uni-request-queue';

// GET 请求
request.get('/api/user/profile').then(data => {
    console.log(data);
});

// POST 请求
request.post('/api/login', {
    username: 'admin',
    password: '123456'
}).then(res => {
    console.log('登录成功');
});
```

## 🌟 核心特性

```bash
// 用户 API 实例
const apiUser = request.create({
    baseUrl: 'https://api.example.com/user',
    timeout: 10000
});

// 自动携带 token
apiUser.interceptors.request.use(config => {
    const token = uni.getStorageSync('token');
    if (token) {
        config.header['Authorization'] = 'Bearer ' + token;
    }
    return config;
});

// 上传 API 实例
const apiUpload = request.create({
    baseUrl: 'https://api.example.com/upload',
    timeout: 30000
});

// 自动设置 multipart
apiUpload.interceptors.request.use(config => {
    config.header['Content-Type'] = 'multipart/form-data';
    return config;
});

// ✅ 互不影响
apiUser.get('/profile');   // 有 token，无 multipart
apiUpload.post('/file');   // 有 multipart，无 token
```