fix(structure): format TypeScript
This commit is contained in:
parent
785acfaba4
commit
eae46e6461
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartuniverse",
|
"name": "@pushrocks/smartuniverse",
|
||||||
"version": "1.0.16",
|
"version": "1.0.16",
|
||||||
|
"private": true,
|
||||||
"description": "messaging service for your micro services",
|
"description": "messaging service for your micro services",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
@ -29,4 +30,4 @@
|
|||||||
"smartsocket": "^1.1.19",
|
"smartsocket": "^1.1.19",
|
||||||
"smarttime": "^2.0.0"
|
"smarttime": "^2.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -66,11 +66,7 @@ export class Universe {
|
|||||||
// adds messages
|
// adds messages
|
||||||
const addMessageHandler = new Handler('PUT', request => {
|
const addMessageHandler = new Handler('PUT', request => {
|
||||||
const requestBody: IServerPutMessageRequestBody = request.body;
|
const requestBody: IServerPutMessageRequestBody = request.body;
|
||||||
const message = new UniverseMessage(
|
const message = new UniverseMessage(requestBody.message, requestBody.payload);
|
||||||
requestBody.message,
|
|
||||||
requestBody.payload,
|
|
||||||
|
|
||||||
)
|
|
||||||
this.universeStore.addMessage(message);
|
this.universeStore.addMessage(message);
|
||||||
console.log(requestBody);
|
console.log(requestBody);
|
||||||
return true;
|
return true;
|
||||||
|
@ -10,7 +10,7 @@ export class UniverseChannel {
|
|||||||
* stores the channels that are available within the universe
|
* stores the channels that are available within the universe
|
||||||
*/
|
*/
|
||||||
public static channelStore = new Objectmap();
|
public static channelStore = new Objectmap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creates new channels
|
* creates new channels
|
||||||
* @param channelArg the name of the topic
|
* @param channelArg the name of the topic
|
||||||
@ -19,8 +19,8 @@ export class UniverseChannel {
|
|||||||
public static createChannel = (channelNameArg: string, passphraseArg: string) => {
|
public static createChannel = (channelNameArg: string, passphraseArg: string) => {
|
||||||
const newChannel = new UniverseChannel(channelNameArg, passphraseArg);
|
const newChannel = new UniverseChannel(channelNameArg, passphraseArg);
|
||||||
return newChannel;
|
return newChannel;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the name of the channel
|
* the name of the channel
|
||||||
*/
|
*/
|
||||||
|
@ -45,21 +45,18 @@ export class UniverseMessage {
|
|||||||
* @param messageArg
|
* @param messageArg
|
||||||
* @param attachedPayloadArg
|
* @param attachedPayloadArg
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(messageArg: string, attachedPayloadArg: any) {
|
||||||
messageArg: string,
|
|
||||||
attachedPayloadArg: any
|
|
||||||
) {
|
|
||||||
this.timestamp = new TimeStamp();
|
this.timestamp = new TimeStamp();
|
||||||
this.message = messageArg;
|
this.message = messageArg;
|
||||||
this.attachedPayload = attachedPayloadArg;
|
this.attachedPayload = attachedPayloadArg;
|
||||||
this.fallBackDestruction();
|
this.fallBackDestruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setUniverseStore (universeStoreArg: UniverseStore) {
|
public setUniverseStore(universeStoreArg: UniverseStore) {
|
||||||
this.universeStore = universeStoreArg;
|
this.universeStore = universeStoreArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setDestructionTimer (selfdestructAfterArg: number) {
|
public setDestructionTimer(selfdestructAfterArg: number) {
|
||||||
if (selfdestructAfterArg) {
|
if (selfdestructAfterArg) {
|
||||||
this.destructionTimer = new Timer(selfdestructAfterArg);
|
this.destructionTimer = new Timer(selfdestructAfterArg);
|
||||||
this.destructionTimer.start();
|
this.destructionTimer.start();
|
||||||
@ -71,13 +68,12 @@ export class UniverseMessage {
|
|||||||
} else {
|
} else {
|
||||||
this.fallBackDestruction();
|
this.fallBackDestruction();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prevents memory leaks if channels have no default
|
* prevents memory leaks if channels have no default
|
||||||
*/
|
*/
|
||||||
private fallBackDestruction () {
|
private fallBackDestruction() {
|
||||||
plugins.smartdelay.delayFor(1000).then(() => {
|
plugins.smartdelay.delayFor(1000).then(() => {
|
||||||
if (!this.destructionTimer) {
|
if (!this.destructionTimer) {
|
||||||
this.setDestructionTimer(6000);
|
this.setDestructionTimer(6000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user