npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@glodon-ecs/web-bridge-sdk

v0.4.0

Published

ecs web-bridge-sdk

Readme

ECS-BRIDGE-SDK

ECSHub Panel 存在与多个宿主环境交互的场景,因此抽离出桥接的 SDK,以适配不同宿主环境。

已支持:

  • [x] SketchUp
  • [ ] QT
  • [ ] Web(for test)
  • [ ] Rhino
  • [x] Concetto

前置项

  • node >= 16

安装

npm install @glodon-ecs/web-bridge-sdk

使用示例

import ECSHubBridge, { BridgeEnv } from '@glodon-ecs/web-bridge-sdk';
// 或使用命名导入:import { ECSHubBridge, BridgeEnv } from "@glodon-ecs/web-bridge-sdk";

// 使用示例
async function main() {
  // initialize 方法需要先被调用
  // await ECSHubBridge.initialize(); // 自动检测初始化,QT、SU、Web环境
  const options = { env: BridgeEnv.sketchup, logger: window.console }; // options 可选
  await ECSHubBridge.initialize(options);
  const bridge = ECSHubBridge.getInstance();

  // 调用方法
  const data = await bridge.callMethod('getInitialData', 'param1');

  // 订阅
  const unsubscribe = bridge.subscribe('modelChanged', (data) => {});

  // 取消订阅
  unsubscribe();
}

扩展适配器

继承 BaseAdapter 并实现三个抽象方法

import { BaseAdapter } from '@glodon-ecs/web-bridge-sdk';
import type { LoggerType } from '@glodon-ecs/web-bridge-sdk';

class CADAdapter extends BaseAdapter {
  // 初始方法
  async init() {
    this.client = window.CADPlugin; // 假设第三方CAD插件
  }

  // 调用内部函数
  async call(method: string, args: unknown[]) {
    return this.client.execCommand(method, ...args);
  }

  // 注册事件监听
  onEvent(event: string, callback: (...args: unknown[]) => void) {
    this.client.on(event, callback);
    return () => this.client.off(event, callback);
  }
}

// 注入自定义适配器
await ECSHubBridge.initialize();
ECSHubBridge.setAdapter(new CADAdapter(), 'cad');

// 设置自定义适配器的 client 交互对象,如 ecsClient
await ECSHubBridge.initialize();
ECSHubBridge.setAdapterClient(client);

导出列表

| 导出 | 类型 | 说明 | | --------------- | --------------- | ---------------------------------------------------------- | | ECSHubBridge | class (default) | 桥接器主类 | | BridgeEnv | enum | 环境枚举:qt / web / sketchup / concetto / rhino | | BaseAdapter | abstract class | 适配器基类,扩展适配器时继承 | | BridgeOptions | interface | 初始化配置项类型 | | LoggerType | type | 日志对象类型 |