# @antv/g-base

> A common util collection for antv projects

Latest version **0.5.16** (published 2024-03-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install @antv/g-base
pnpm add @antv/g-base
yarn add @antv/g-base
bun add @antv/g-base
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.16 |
| Published | 2024-03-08 |
| First published | 2019-09-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 11 |
| Unpacked size | 816.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 72 |
| Author | https://github.com/orgs/antvis/people |
| Maintainers | lvisei, yisi.wang, basketduck, biupiubiupiu, flash1, dreammy23, laixingui.lxg, zhangjunjie-loki, rainy25ghz, zeyuwang, yanxiong, susiwen8, freestyle21, soundquiet, elaine.q.10, sturuby, sakuya223, serializedowen, xdzhao, yangzhanmei, wjgogogo, leungwensen, dori, iaaron, yard, simaq, dxq613, intchous, susan_ann, jinke.li, lzxue, army8735, atool, baizn, dengfuping, neoddish, jeffy2012, zqlu, afc163, pomelo-nwu, kopiluwaky, ccnuzindex, panyuqi, bubkoo, zengyue, kasmine, boyu.zlj, l1ud0ngq1, newbyvector, winniexing, chenluli, kn9117, xdddst, semious2020, esora, nadia_liu, bbsqq, mxz96102, openwayne, pearmini, pddpd, yiqianyao, zhanba, cxxxxxn |
| Keywords | util, antv, g |

## Links

- npm: https://www.npmjs.com/package/@antv/g-base
- Repository: https://github.com/antvis/util
- Homepage: https://github.com/antvis/util#readme
- Issues: https://github.com/antvis/util/issues
- npm.io page: https://npm.io/package/@antv/g-base

## Dependencies (11)

- [tslib](https://npm.io/package/tslib.md) ^2.0.3
- [d3-ease](https://npm.io/package/d3-ease.md) ^1.0.5
- [d3-timer](https://npm.io/package/d3-timer.md) ^1.0.9
- [@antv/util](https://npm.io/package/@antv/util.md) ~2.0.13
- [@antv/g-math](https://npm.io/package/@antv/g-math.md) ^0.1.9
- [d3-interpolate](https://npm.io/package/d3-interpolate.md) ^3.0.1
- [detect-browser](https://npm.io/package/detect-browser.md) ^5.1.0
- [@antv/path-util](https://npm.io/package/@antv/path-util.md) ~2.0.5
- [@types/d3-timer](https://npm.io/package/@types/d3-timer.md) ^2.0.0
- [@antv/matrix-util](https://npm.io/package/@antv/matrix-util.md) ^3.1.0-beta.1
- [@antv/event-emitter](https://npm.io/package/@antv/event-emitter.md) ^0.1.1

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.5.16 (latest) — 2024-03-08
- 0.5.6-beta.1 (beta) — 2021-03-17
- 0.5.15 — 2023-04-13
- 0.5.14 — 2023-02-08
- 0.5.13 — 2023-02-08
- 0.5.12 — 2022-12-09
- 0.5.11 — 2022-03-18
- 0.5.10 — 2022-02-21
- 0.5.9 — 2021-04-25
- 0.5.8 — 2021-04-15
- 0.5.7 — 2021-03-30
- 0.5.6 — 2021-03-22
- 0.5.5 — 2020-12-25
- 0.5.4 — 2020-12-21
- 0.5.3 — 2020-12-17
- … 56 more at https://npm.io/package/@antv/g-base/versions

## README

# G-Base

> 可视化的绘图引擎的接口定义和抽象实现

## 安装下载

> tnpm i --save @antv/g-base

```js
import { Base } from '@antv/g-base';

class MyClass extends Base {}
```

## API 文档

G-Base 中定义了绘图引擎的接口、抽象类和工具方法

### 接口定义

#### IBase

事件接口定义

```ts
  /**
   * 绑定事件
   * @param {string}   eventName 事件名
   * @param {Function} callback  回调函数
   */
  on(eventName: string, callback: Function);
  /**
   * 移除事件
   */
  off();
  /**
   * 移除事件
   * @param {string} eventName 事件名
   */
  off(eventName: string);
  /**
   * 移除事件
   * @param {string}   eventName 事件名
   * @param {Function} callback  回调函数
   */
  off(eventName: string, callback: Function);
  /**
   * 触发事件, trigger 的别名函数
   * @param {string} eventName 事件名称
   * @param {object} args 参数
   */
  emit(eventName: string, eventObject: object);
  /**
   * 触发事件
   * @param {string} eventName 事件名称
   * @param {object} args 参数
   */
  emit(eventName: string, eventObject: object);
```

属性接口定义

```ts
/**
   * 获取属性值
   * @param  {string} name 属性名
   * @return {any} 属性值
   */
  get(name: string): any;
  /**
   * 设置属性值
   * @param {string} name  属性名称
   * @param {any}    value 属性值
   */
  set(name: string, value: any);

  /**
   * 是否销毁
   * @type {boolean}
   */
  destroyed: boolean;

  /**
   * 销毁对象
   */
  destroy();
```

#### IElement

#### IGroup

#### IShape

#### ICanvas

### 抽象类定义

#### Base

#### AbstractShape

#### AbstractGroup

#### AbstractCanvas

### 其他公用类

#### GraphEvent

#### EventController

---
_Source: https://npm.io/package/@antv/g-base · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
