Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/catouse/xext
A helper module writen in typescript for build xuanxuan extension.
https://github.com/catouse/xext
Last synced: about 6 hours ago
JSON representation
A helper module writen in typescript for build xuanxuan extension.
- Host: GitHub
- URL: https://github.com/catouse/xext
- Owner: catouse
- License: mit
- Created: 2019-01-20T07:00:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-25T01:31:04.000Z (over 5 years ago)
- Last Synced: 2024-10-31T17:16:17.701Z (16 days ago)
- Language: TypeScript
- Homepage:
- Size: 120 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xext
喧喧扩展开发辅助模块,包含 TypeScript 定义。
## 使用方法
### 1. 安装模块
```shell
npm install xext --save
```### 2. 导入 `xext` 模块
```ts
import xext, {
DEBUG,
lang,
nodeModules,
views,
components,
utils,
platform,
app
} from 'xext';
```### 3. 使用示例
编写应用扩展 React 组件模块 `app.ts`:
```ts
import {React, ReactDOM} from 'xext';export default (props: any) => {
const {app} = props;
returnHello: {app.name}
};
```编写扩展模块:
```ts
import xext, {DEBUG} from 'xext';
import AppView from './app';const extension: ExtensionModule = {
onAttach(ext: Xuanxuan.Extension) {
if (DEBUG) {
console.log(`Extension '${ext.displayName}' loaded from ${ext.mainFile}.`);
}
},
MainView: AppView
};export default extension;
```