
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
HSJSSDK 是一个简单的 HookShort JavaScript SDK,用于与 JS 桥接进行交互。它提供了一个方便的接口来调用桥接方法,并处理响应。
你可以通过 npm 安装 HSJSSDK:
npm install HSJSSDK
在你的 JavaScript 或 TypeScript 项目中,你可以通过以下方式导入 HSJSSDK:
import HSJSSDK from 'HSJSSDK';
// 或者
import { invokeJsBridge } from 'HSJSSDK';
使用 invokeJsBridge
方法调用桥接方法。以下是一个示例:
async function callBridge() {
try {
const response = await invokeJsBridge('someMethod', { key: 'value' });
console.log(response);
} catch (error) {
console.error('Error invoking bridge:', error);
}
}
callBridge();
如果你在 TypeScript 项目中使用 HSJSSDK,SDK 提供了类型定义,确保你可以获得类型检查和自动补全。
import { invokeJsBridge, InvokeJsBridgeResponse } from 'HSJSSDK';
async function callBridge() {
const response: InvokeJsBridgeResponse<{ someData: string }> = await invokeJsBridge('someMethod', { key: 'value' });
console.log(response);
}
invokeJsBridge(name: string, data?: Record<string, any>, opts?: { timeout?: number | boolean }): Promise<InvokeJsBridgeResponse<T>>
false
,则禁用超时。返回一个 Promise,解析为 InvokeJsBridgeResponse<T>
类型的响应对象。
InvokeJsBridgeResponse<T>
T
或 null
。欢迎任何形式的贡献!请提交问题、请求功能或直接提交拉取请求。
此项目使用 MIT 许可证。有关详细信息,请查看 LICENSE 文件。
FAQs
hookshort web native bridge
The npm package hsjssdk receives a total of 0 weekly downloads. As such, hsjssdk popularity was classified as not popular.
We found that hsjssdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.