CHNAGE: added size comparism
This commit is contained in:
@@ -56,6 +56,12 @@ export class MQTTEntity implements iMQTTEntityBase {
|
|||||||
}
|
}
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get size(): number {
|
||||||
|
this._size = JSON.stringify(this.toJSON()).length;
|
||||||
|
return this._size;
|
||||||
|
}
|
||||||
|
|
||||||
getProperty(name: string): any {
|
getProperty(name: string): any {
|
||||||
if (!this.attrs.has(name)) return;
|
if (!this.attrs.has(name)) return;
|
||||||
return this[name as keyof this];
|
return this[name as keyof this];
|
||||||
|
|||||||
19
src/app/_services/output.service.ts
Normal file
19
src/app/_services/output.service.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
get device_entity(): MQTTEntity {
|
||||||
|
if (
|
||||||
|
this._device_entity_cached.listlen ===
|
||||||
|
this.generatorService.created_entity_num
|
||||||
|
)
|
||||||
|
return this._device_entity_cached.entity;
|
||||||
|
let entites = Array.from(this.generatorService.created_enteties).sort(
|
||||||
|
(a, b) => {
|
||||||
|
return a.size - b.size;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this._device_entity_cached = {
|
||||||
|
entity: entites[0],
|
||||||
|
listlen: this.generatorService.created_entity_num,
|
||||||
|
};
|
||||||
|
console.log('sizing');
|
||||||
|
console.log(this._device_entity_cached);
|
||||||
|
return entites[0];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user