Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@clue_nidapp/plugin-api-mini

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clue_nidapp/plugin-api-mini

## 能力

latest
npmnpm
Version
0.0.2-alpha.3
Version published
Maintainers
5
Created
Source

线索通 sdk 字节小程序网络请求插件

能力

发起网络请求

初始化

需要配合 @clue_nidapp/form-core 线索通 sdk 使用

初始化线索通 SDK,详见 @clue_nidapp/form-core 使用说明

import { Core, FormOptions } from '@clue_nidapp/form-core/web';
import { API } from '@clue_nidapp/plugin-api-mini'
const options: FormOptions = {
  data: {
    formId: 0,
    advId: 0,
    clueAccountId: 0,
  },
  externalSetting: {
    scenarioType: 23,
    isExternalOpenLink: true,
  }
  // 注册插件
  plugins: [new API()]
}
const formCore = new Core(
  options,
);

支持环境

字节小程序

使用

注册后,sdk 会自动将 request 方法挂载到 Core 实例 request 方法上

目前支持 getpost 方法


interface Request {
  get: (
    url: string,       // 请求 url
    data: object,      // 请求体
    options: Options
  ) => Promise<any>;
  post: (
    url: string,       // 请求 url
    data: object,      // 请求体
    options: Options
  ) => Promise<any>;
}


请求参数 options 详细说明

interface Options {
  timeout: number;   // 超时时间,单位为毫秒
  cache: boolean;    // 开启 cache 默认为 false
}
formCore.request.get(url, data, options).then((res) => {
  // do something with res
});
formCore.request.post(url, data, options).then((res) => {
  // do something with res
});

FAQs

Package last updated on 08 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts