# silver-base

> 功能性组件基类

Latest version **0.0.12** (published 2018-08-22) · 0 weekly downloads

## Install

```sh
npm install silver-base
pnpm add silver-base
yarn add silver-base
bun add silver-base
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2018-08-22 |
| First published | 2016-08-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 默吉 |
| Maintainers | c4895008, liudan92221 |
| Keywords | SilverBase |

## Links

- npm: https://www.npmjs.com/package/silver-base
- npm.io page: https://npm.io/package/silver-base

## Recent versions

- 0.0.12 (latest) — 2018-08-22
- 0.0.11 — 2017-01-05
- 0.0.10 — 2016-12-30
- 0.0.9 — 2016-12-30
- 0.0.8 — 2016-12-30
- 0.0.7 — 2016-12-30
- 0.0.6 — 2016-12-07
- 0.0.5 — 2016-11-08
- 0.0.4 — 2016-11-08
- 0.0.3 — 2016-08-31
- 0.0.2 — 2016-08-26
- 0.0.1 — 2016-08-25

## README

## [silver-base](https://www.npmjs.com/package/silver-base)

>  silver-base是TV端功能型组件的基础类，如果你开发的组件是一种类似于util,debug，server等功能性的组件，请继承该类。
>  该类提供了一些共有的方法，主要解决事件的监听，派发，销毁，同时该类为每个组件生成了一个唯一的id，保持了页面中每一个实例的唯一性。
#### Installation

- npm install silver-base

#### Usage

- script 标签引入  
	- `<script src="https://g.alicdn.com/silvermine/silver-base/{version}/index.min.js"></script>`
- import or require
	- 首先 `npm install silver-base`
	-  `import SilverBase from 'silver-base` 或者  
	   `const Base = require('silver-base')`  

#### jsdoc 接口页面

- [https://g.alicdn.com/silvermine/silver-bitmap/0.0.9/doc/SilverBase.html](https://g.alicdn.com/silvermine/silver-bitmap/0.0.9/doc/SilverBase.html)



- **getName()返回组件名称**
>		返回组件名称
>		需要用户重写该方法
  
- **getId()返回组件唯一id**
>		返回组件ID
>		一个页面中所有组件实例的id是唯一性的



- **on(type,cb)绑定事件**
>		type：自定义事件类型
>		cb：绑定的回调函数
>		return this
		
- **off(type,cb)解除事件**
>		type：自定义事件类型
>		cb：绑定的回调函数
>		return this
		


- **hasEvent(type)是否含有指定事件**
>		type：自定义事件类型
>		return true/false


	
	
- **fire(type)触发指定事件**
>		type：自定义事件类型
>		return this
		
- **destroyEvent()销毁事件（return this）**
>		return this		

- **destroy()销毁全部(事件+id)（return this）**




- **getEventList()得到所有事件列表**
>		return 实例绑定的事件列表

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