@convergence/convergence

中文文档
1.0.0-rc.12发布于 2021/07/24LGPL-3.0-onlyTypeScriptESM + CJS近 30 天下载 2310

Convergence JavaScript Client

原始使用文档

Overview

This package provides a npm distribution of the Convergence JavaScript API, for use with the Convergence Collaboration Framework.

Convergence is an engine for rapidly developing real-time collaborative applications. At the heart of Convergence is its collaborative real time data store. Where other frameworks stop at attempting to provide real time data, Convergence goes further by providing all the features a developer needs to build an effective and intuitive collaborative application. Some of the feature highlights include:

  • Realtime Data: Allows users to edit the same data at the same time, keeping everyone's view of the data in sync.
  • Users and Identity: Allows developers to create and manage users and their identity within the system so users know who they are collaborating with.
  • Presence: Allows users to know "who is here?" and "who is available" so they can more effectively collaborate with the other users they need to.
  • Collaboration Awareness: The best way to resolve editing conflicts is to avoid them in the first place. Convergence provides robust collaboration awareness capabilities that help users work together without conflicts.
  • Chat & Messaging: Allow users to communicate through chat embedded directly in the application.

Convergence provides all of this and more in a single API reducing the time and complexity of gluing multiple frameworks together. With Convergence you can get up and running in hours, instead of months.

Installation

npm install --save @convergence/convergence

Example Usage

const Convergence = require("@convergence/convergence").Convergence;

const url = "https://convergence-server.myhost.com/mynamespace/mydomain";
const credentials = { username: "myuser", password: "mypassword" };

Convergence.connectWithPassword(url, credentials).then(domain => {
  // open an employee data model.
  return domain.models().open("employees", "doe.john");
}).then(model => {
  // Get the root elemenet in the model.
  const data = model.root();
  
  // Set some data
  data.set("fisrtName", "John");
  data.set("lastName", "Doe");
  
  // Get the firstName property directly
  const firstName = data.elementAt("firstName");
  
  // Rest the first name's value
  firstName.value("Dan");
  
  // Listen for course grained changes
  firstName.on("value", () => {
    console.log(firstName.value)
  });
  
  // Insert 'ny' into the string at index 3.
  firstName.insert(3, "ny");
  
  // Listen for course grained changes
  firstName.on("insert", (evt) => {
    console.log(`characters '${evt.value}' added at position (${evt.index})`)
  });
});

Documentation

The full complement of Convergence documentation can be found here:

https://convergence.io/learn/

Hot-Linking in the Browser

Convergence requires RxJS 6.x. This dependency is taken care of when using the npm module. If including via a script tag, you must also include rxjs.

<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.6.3/rxjs.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@convergence/convergence/convergence.global.js"></script>

This will add a Convergence variable to the global namespace.

There is also an AMD version:

<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/6.6.3/rxjs.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@convergence/convergence/convergence.amd.js"></script>

License

The Convergence JavaScript client is licensed under the Lesser GNU Public License v3 (LGPLv3). This allows developers to use the client without having to release their code under the LGPLv3, assuming they only use the client as a library and do not modify it. Refer to the COPYING and COPYING.LESSER for the specific terms and conditions of the license.

The Convergence Client is also available under a Commercial License. If you are interested in a non-open source license please contact us at Convergence Labs.

版本与发布记录

@convergence/convergence 共发布 57 个版本,首次发布于 2017/01/09;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0-rc.12latest2021/07/245 年前
1.0.0-rc.112021/07/145 年前
1.0.0-rc.102021/07/135 年前
1.0.0-rc.92021/07/015 年前
1.0.0-rc.82021/05/235 年前
1.0.0-rc.72020/07/076 年前

关于 @convergence/convergence 的常见问题

@convergence/convergence 是什么?

Convergence JavaScript Client

如何安装 @convergence/convergence?

在项目目录运行 npm install @convergence/convergence,或使用 pnpm add / yarn add / bun add。

@convergence/convergence 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@convergence/convergence 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@convergence/convergence 可以商用吗?

@convergence/convergence 使用 LGPL-3.0-only 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@convergence/convergence 的下载量有多少?

根据 npm 官方下载统计,@convergence/convergence 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,310 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@convergence/convergence 还在维护吗?

最新版本 1.0.0-rc.12 发布于 2021/07/24(5 年前);至今共发布 57 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/01/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。