更新版本
This commit is contained in:
parent
2255232499
commit
02ac6e6deb
8
lib/app/JlGraphicApp.d.ts
vendored
8
lib/app/JlGraphicApp.d.ts
vendored
@ -355,6 +355,10 @@ export interface IGraphicScene extends EventEmitter<GraphicAppEvents> {
|
|||||||
* 取消websocket订阅
|
* 取消websocket订阅
|
||||||
*/
|
*/
|
||||||
unsubscribe(destination: string): void;
|
unsubscribe(destination: string): void;
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
}
|
}
|
||||||
declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> implements IGraphicScene {
|
declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> implements IGraphicScene {
|
||||||
private graphicStore;
|
private graphicStore;
|
||||||
@ -489,6 +493,10 @@ declare abstract class GraphicSceneBase extends EventEmitter<GraphicAppEvents> i
|
|||||||
* 取消websocket订阅
|
* 取消websocket订阅
|
||||||
*/
|
*/
|
||||||
unsubscribe(destination: string): void;
|
unsubscribe(destination: string): void;
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
/**
|
/**
|
||||||
* 处理图形状态
|
* 处理图形状态
|
||||||
* @param graphicStates
|
* @param graphicStates
|
||||||
|
2
lib/index.d.ts
vendored
2
lib/index.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
/// <reference path="../global.d.ts" />
|
/// <reference types="global" />
|
||||||
export * as GraphicsExtras from '@pixi/graphics-extras';
|
export * as GraphicsExtras from '@pixi/graphics-extras';
|
||||||
export * from './app';
|
export * from './app';
|
||||||
export * from './core';
|
export * from './core';
|
||||||
|
34
lib/index.js
34
lib/index.js
@ -5279,6 +5279,10 @@ class MessageClient extends EventEmitter {
|
|||||||
removeSubscription(destination, handle) {
|
removeSubscription(destination, handle) {
|
||||||
this.getOrNewSubClient(destination).removeHandler(handle);
|
this.getOrNewSubClient(destination).removeHandler(handle);
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
const cli = this.getOrNewSubClient(destination);
|
||||||
|
cli.publishMessage(destination, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
class SubscriptionClient {
|
class SubscriptionClient {
|
||||||
mc;
|
mc;
|
||||||
@ -5321,6 +5325,11 @@ class SubscriptionClient {
|
|||||||
unsubscribe() {
|
unsubscribe() {
|
||||||
this.mc.unsubscribe(this.destination);
|
this.mc.unsubscribe(this.destination);
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
if (this.mc.connected) {
|
||||||
|
this.mc.publishMessage(destination, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
handleMessage(data) {
|
handleMessage(data) {
|
||||||
if (this.protocol === 'json') {
|
if (this.protocol === 'json') {
|
||||||
console.debug('收到消息:', data);
|
console.debug('收到消息:', data);
|
||||||
@ -5403,6 +5412,9 @@ class StompMessagingClient extends MessageClient {
|
|||||||
unsubscribe0(destination) {
|
unsubscribe0(destination) {
|
||||||
this.cli.unsubscribe(destination);
|
this.cli.unsubscribe(destination);
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
console.debug('MQTT发布消息:未实现');
|
||||||
|
}
|
||||||
close() {
|
close() {
|
||||||
this.cli.deactivate();
|
this.cli.deactivate();
|
||||||
}
|
}
|
||||||
@ -5522,6 +5534,15 @@ class MqttMsgClient extends MessageClient {
|
|||||||
console.warn('MQTT 消息客户端关闭失败', error);
|
console.warn('MQTT 消息客户端关闭失败', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
console.debug('MQTT发布消息');
|
||||||
|
if (this.connected) {
|
||||||
|
this.cli.publish(destination, message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.warn('MQTT 未连接,消息发布失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ClientEngine;
|
var ClientEngine;
|
||||||
@ -5601,6 +5622,9 @@ class WsMsgCli {
|
|||||||
static registerAppMsgBroker(broker) {
|
static registerAppMsgBroker(broker) {
|
||||||
WsMsgCli.appMsgBroker.push(broker);
|
WsMsgCli.appMsgBroker.push(broker);
|
||||||
}
|
}
|
||||||
|
static publishMessage(destination, message) {
|
||||||
|
WsMsgCli.client.publishMessage(destination, message);
|
||||||
|
}
|
||||||
static removeAppMsgBroker(broker) {
|
static removeAppMsgBroker(broker) {
|
||||||
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
|
const index = WsMsgCli.appMsgBroker.findIndex((mb) => mb == broker);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
@ -5674,6 +5698,9 @@ class AppWsMsgBroker {
|
|||||||
WsMsgCli.registerSubscription(destination, handler);
|
WsMsgCli.registerSubscription(destination, handler);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
WsMsgCli.publishMessage(destination, message);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
||||||
*/
|
*/
|
||||||
@ -7130,6 +7157,13 @@ class GraphicSceneBase extends EventEmitter {
|
|||||||
this.checkWsMsgCli();
|
this.checkWsMsgCli();
|
||||||
this.wsMsgBroker.unsbuscribe(destination);
|
this.wsMsgBroker.unsbuscribe(destination);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 发布websocket消息
|
||||||
|
*/
|
||||||
|
publishMessage(destination, message) {
|
||||||
|
this.checkWsMsgCli();
|
||||||
|
this.wsMsgBroker.publishMessage(destination, message);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 处理图形状态
|
* 处理图形状态
|
||||||
* @param graphicStates
|
* @param graphicStates
|
||||||
|
2
lib/message/BasicMessageClient.d.ts
vendored
2
lib/message/BasicMessageClient.d.ts
vendored
@ -33,6 +33,7 @@ export declare abstract class MessageClient extends EventEmitter<MessageClientEv
|
|||||||
getOrNewSubClient(destination: string): SubscriptionClient;
|
getOrNewSubClient(destination: string): SubscriptionClient;
|
||||||
addSubscription(destination: string, handler: IMessageHandler): void;
|
addSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
removeSubscription(destination: string, handle: IMessageHandler): void;
|
removeSubscription(destination: string, handle: IMessageHandler): void;
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
abstract get connected(): boolean;
|
abstract get connected(): boolean;
|
||||||
abstract close(): void;
|
abstract close(): void;
|
||||||
}
|
}
|
||||||
@ -47,6 +48,7 @@ export declare class SubscriptionClient {
|
|||||||
removeHandler(handler: IMessageHandler): void;
|
removeHandler(handler: IMessageHandler): void;
|
||||||
trySubscribe(): void;
|
trySubscribe(): void;
|
||||||
unsubscribe(): void;
|
unsubscribe(): void;
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
handleMessage(data: any): void;
|
handleMessage(data: any): void;
|
||||||
onDisconnect(): void;
|
onDisconnect(): void;
|
||||||
}
|
}
|
||||||
|
8
lib/message/MessageBroker.d.ts
vendored
8
lib/message/MessageBroker.d.ts
vendored
@ -64,6 +64,12 @@ export interface IMessageClient extends EventEmitter<MessageClientEvents> {
|
|||||||
* @param handler
|
* @param handler
|
||||||
*/
|
*/
|
||||||
removeSubscription(destination: string, handler: IMessageHandler): void;
|
removeSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
|
/**
|
||||||
|
* 发布消息
|
||||||
|
* @param destination
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
/**
|
/**
|
||||||
* 是否已经连接
|
* 是否已经连接
|
||||||
*/
|
*/
|
||||||
@ -84,6 +90,7 @@ export declare class WsMsgCli {
|
|||||||
static registerSubscription(destination: string, handler: IMessageHandler): void;
|
static registerSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
static unregisterSubscription(destination: string, handler: IMessageHandler): void;
|
static unregisterSubscription(destination: string, handler: IMessageHandler): void;
|
||||||
static registerAppMsgBroker(broker: AppWsMsgBroker): void;
|
static registerAppMsgBroker(broker: AppWsMsgBroker): void;
|
||||||
|
static publishMessage(destination: string, message: string): void;
|
||||||
static removeAppMsgBroker(broker: AppWsMsgBroker): void;
|
static removeAppMsgBroker(broker: AppWsMsgBroker): void;
|
||||||
static hasAppMsgBroker(): boolean;
|
static hasAppMsgBroker(): boolean;
|
||||||
/**
|
/**
|
||||||
@ -138,6 +145,7 @@ export declare class AppWsMsgBroker {
|
|||||||
unsbuscribe(destination: string): void;
|
unsbuscribe(destination: string): void;
|
||||||
unsubscribeAll(): void;
|
unsubscribeAll(): void;
|
||||||
resubscribeAll(): void;
|
resubscribeAll(): void;
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
/**
|
/**
|
||||||
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
* 取消所有订阅,从通用Stomp客户端移除此消息代理
|
||||||
*/
|
*/
|
||||||
|
2
lib/message/MqttBroker.d.ts
vendored
2
lib/message/MqttBroker.d.ts
vendored
@ -8,7 +8,7 @@ export declare class MqttMsgClient extends MessageClient {
|
|||||||
constructor(options: CompleteMessageCliOption);
|
constructor(options: CompleteMessageCliOption);
|
||||||
subscribe(destination: string, handle: HandleMessage): boolean;
|
subscribe(destination: string, handle: HandleMessage): boolean;
|
||||||
unsubscribe0(destination: string): void;
|
unsubscribe0(destination: string): void;
|
||||||
publishMessage(destination: string, message: string): void;
|
|
||||||
get connected(): boolean;
|
get connected(): boolean;
|
||||||
close(): void;
|
close(): void;
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
}
|
}
|
||||||
|
1
lib/message/WsMsgBroker.d.ts
vendored
1
lib/message/WsMsgBroker.d.ts
vendored
@ -7,5 +7,6 @@ export declare class StompMessagingClient extends MessageClient {
|
|||||||
get connected(): boolean;
|
get connected(): boolean;
|
||||||
subscribe(destination: string, handle: HandleMessage): boolean;
|
subscribe(destination: string, handle: HandleMessage): boolean;
|
||||||
unsubscribe0(destination: string): void;
|
unsubscribe0(destination: string): void;
|
||||||
|
publishMessage(destination: string, message: string): void;
|
||||||
close(): void;
|
close(): void;
|
||||||
}
|
}
|
||||||
|
3482
package-lock.json
generated
Normal file
3482
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "graphic-pixi",
|
"name": "graphic-pixi",
|
||||||
"version": "0.1.14",
|
"version": "0.1.15",
|
||||||
"description": "基于pixijs的图形应用、绘制应用框架",
|
"description": "基于pixijs的图形应用、绘制应用框架",
|
||||||
"productName": "Graphic-pixi",
|
"productName": "Graphic-pixi",
|
||||||
"author": "walker <shengxuqiang@joylink.club>",
|
"author": "walker <shengxuqiang@joylink.club>",
|
||||||
|
Loading…
Reference in New Issue
Block a user