# aiv367-baseclass **Repository Path**: aiv367/aiv367-baseclass ## Basic Information - **Project Name**: aiv367-baseclass - **Description**: 一个基础类,用于其它类继承,提供 on, one, off, trigger, data, setOpts等方法 - **Primary Language**: TypeScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-06-30 - **Last Updated**: 2023-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: Library ## README # aiv367-baseclass #### 介绍 一个基础类,用于其它类继承使用。提供 user, on, one, off, trigger, data, option, 等方法。具体方法属性看源码吧 #### Gitee [https://gitee.com/aiv367/aiv367-baseclass](https://gitee.com/aiv367/aiv367-baseclass) #### 安装 ``` npm i aiv367-baseclass --save ``` #### 使用 ES6 Module: ```js import Base from 'aiv367-baseclass'; class MyClass extends Base { constructor(opts) { super(); } option(opts) { if (opts.id !== undefined) { console.log('set id'); } if (opts.data !== undefined) { console.log('set data'); } this.trigger('option', opts); super.option(opts); } } let myclass = new MyClass(); myclass.on('option', (evt, data) => { console.log('option'); }); myclass.option({ id: 123, data: [1, 2, 3], }); ```