@thingjs/xplugin-bundle
v0.2.7
Published
xplugin-bundle ThingJS-X 插件描述文件
Downloads
4
Readme
@thingjs/xplugin-bundle
xplugin-bundle
xplugin-bundle is the Core Component for ThingJS-X Plug-in Development
Install
Using npm:
$ npm i -g npm
$ npm install --save @thingjs/xplugin-bundle
Usage
插件引用
//方式一,提供了目前所支持的插件类型
import BundlePluginCore
from "@thingjs/xplugin-bundle/dist/plugin/BundlePluginCore";
import BundlePluginExpand
from "@thingjs/xplugin-bundle/dist/plugin/BundlePluginExpand";
import BundlePluginPanel
from "@thingjs/xplugin-bundle/dist/plugin/BundlePluginPanel";
import BundlePluginLayer
from "@thingjs/xplugin-bundle/dist/plugin/BundlePluginLayer";
import BundlePluginControl
from "@thingjs/xplugin-bundle/dist/plugin/BundlePluginControl";
//或方式二有选择性方式引入
import {
BundlePluginCore,
BundlePluginExpand, BundlePluginPanel,
BundlePluginLayer, BundlePluginControl,
} from "@thingjs/xplugin-bundle";
插件使用
//以系统插件为例
//系统插件开发中必须生成插件描述文件
//该文件的配置需要引入 BundlePluginCore
import BundlePluginCore
from "@thingjs/xplugin-bundle/dist/plugin/BundlePluginCore";
export default class extends BundlePluginCore {
constructor() {
super();
//可调用相关API 进行描述文件扩展
//例如添加作者可以进行API调用
this.bundle.setAuthor("uino");
}
}
bundle.json 结构示例
{
"name": "楼层展开插件",
"type": "plugin",
"id": "hzksiucj98kauj",
"version": "1.0.0",
"author": "uino",
"description": "楼层展开场景控制插件,主要用于演示3D场景内建筑楼层展开,可进行结构观察",
"main": "frame.js",
"dependencies": {
"thingjs": "1.2.7.17",
"dpdVersion": ">1.0.2 <=2.3.4"
},
"external": {
"use-standard": "0",
"encrypt-files": ["frame.js"],
"standard": "Revision",
"preview": "./resources/preview.png",
"thingjs-x": {
"plugin-type": "layer",
"license": "北京优锘科技有限公司 版权所有",
"date": "2022/8/21 14:43:54",
"extend": {
"rTypeGroup": "",
"rType": ""
}
}
}
};
BundlePlugin api
// BundlePluginCore,
// BundlePluginExpand, BundlePluginPanel,
// BundlePluginLayer, BundlePluginControl,
以上实现都集成于 BundlePlugin
BundlePlugin
import BundlePlugin
from "@thingjs/xplugin-bundle/dist/bundle/BundlePlugin";
let bundlePluginInstance = new BundlePlugin("hxzhajkxjajasd", "楼层展开");
// bundlePluginInstance.toJSON();
// bundlePluginInstance.setAuthor("uino")
...
//@property readonly
- id:string -获取插件唯一标识
- name:string -获取插件名称
- type:string -获取插件类型,plugin
- version:string -version:string;
- external -获取 External 节点实例(External 实例)
- author - 获取插件作者: uino
- main - 获取插件入口文件,default-> frame.js
- description:string -获取插件描述
- dependencies:Map - 获取资源依赖信息
//@method
- toJSON() -获取bundle节点 JSON
- addDependencies(libraryName:string,version:string) -添加依赖信息
- setName(name:string) -设置插件插件名称
- setType(type:string) -设置插件插件类型,default:plugin
- setVersion(version:string) - 设置插件版本号,版本号: e.g. 1.0.3
- setDescription(description:string) -设置插件描述信息
External 实例
//@property readonly
- standard: string - 获取插件开发规范标准
- useStandard:string -获取购买状态
- encryptFiles:Array -获取资源加密文件数组
- thingjsX:ThingJSX -获取ThingJSX 节点实例
ThingJSX 实例
//@property readonly
- pluginType:string - 获取插件类型
- theme:string - 获取插件主题
- license:string - 获取插件版权信息
- themePath:string -获取插件主题路径
- date:string -获取插件创建时间
- extend -扩展信息节点
//@method
- setPluginType(pluginType: string) -设置插件类型 :core、expand、layer、panel、contorl
- setTheme(theme: string) -设置插件主题
- setLicense(license: string) -设置版权信息:北京优锘科技有限公司 版权所有