mirror of
https://github.com/thomasnordquist/MQTT-Explorer.git
synced 2026-09-11 09:03:33 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
679e319912 |
@@ -11,7 +11,7 @@ export class DataSourceStateMachine {
|
||||
private state: DataSourceState = {
|
||||
error: undefined,
|
||||
connected: false,
|
||||
connecting: false,
|
||||
connecting: false
|
||||
}
|
||||
|
||||
public setConnected(connected: boolean) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const { Base64 } = require('js-base64')
|
||||
|
||||
export class Base64Message {
|
||||
private base64Message: string
|
||||
private unicodeValue: string
|
||||
private base64Message: string;
|
||||
private unicodeValue: string;
|
||||
|
||||
public length: number
|
||||
|
||||
@@ -27,4 +27,8 @@ export class Base64Message {
|
||||
public static toDataUri(message: Base64Message, mimeType: string) {
|
||||
return `data:${mimeType};base64,${message.base64Message}`
|
||||
}
|
||||
|
||||
public static doStuff() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,17 @@ export class ChangeBuffer {
|
||||
return this.size / this.maxSize
|
||||
}
|
||||
|
||||
public updateSize() {
|
||||
let size
|
||||
if (this.isFull()) {
|
||||
size = this.maxSize
|
||||
} else {
|
||||
size = 0
|
||||
}
|
||||
|
||||
this.size = size
|
||||
}
|
||||
|
||||
public popAll(): Array<BufferedMessage> {
|
||||
const tmpBuffer = this.buffer
|
||||
this.buffer = []
|
||||
|
||||
@@ -4,13 +4,15 @@ const sha1 = require('sha1')
|
||||
|
||||
export class Edge<ViewModel extends Destroyable> implements Hashable {
|
||||
public name: string
|
||||
|
||||
public color?: Color
|
||||
public target!: TreeNode<ViewModel>
|
||||
public source?: TreeNode<ViewModel> | undefined
|
||||
private cachedHash?: string
|
||||
|
||||
constructor(name: string) {
|
||||
this.name = name
|
||||
const hash = this.updateCache()
|
||||
console.log(hash)
|
||||
}
|
||||
|
||||
public edges(): Array<Edge<ViewModel>> {
|
||||
@@ -40,4 +42,20 @@ export class Edge<ViewModel extends Destroyable> implements Hashable {
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
public updateCache(): void {
|
||||
if (this.cachedHash = "") {
|
||||
this.cachedHash = sha1(this.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Color implements Hashable {
|
||||
public red: number = 0
|
||||
public green: number = 0
|
||||
public blue: number = 0
|
||||
|
||||
hash(): string {
|
||||
return `${this.red}${this.green}${this.blue}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export class Tree<ViewModel extends Destroyable> extends TreeNode<ViewModel> {
|
||||
if (!this.paused && this.applyChangesHasCompleted) {
|
||||
this.applyChangesHasCompleted = false
|
||||
if ((window as any).requestIdleCallback) {
|
||||
;(window as any).requestIdleCallback(() => this.applyUnmergedChanges(), { timeout: 500 })
|
||||
; (window as any).requestIdleCallback(() => this.applyUnmergedChanges(), { timeout: 500 })
|
||||
} else {
|
||||
this.applyUnmergedChanges()
|
||||
}
|
||||
|
||||
+43
-10
@@ -1,21 +1,54 @@
|
||||
{
|
||||
"extends": ["tslint-config-airbnb", "tslint-react", "tslint-react-recommended"],
|
||||
"extends": [
|
||||
"tslint-config-airbnb",
|
||||
"tslint-react",
|
||||
"tslint-react-recommended"
|
||||
],
|
||||
"rules": {
|
||||
"semicolon": [true, "never"],
|
||||
"max-line-length": [true, 200],
|
||||
"semicolon": [
|
||||
true,
|
||||
"never"
|
||||
],
|
||||
"max-line-length": [
|
||||
true,
|
||||
200
|
||||
],
|
||||
"no-sparse-arrays": true,
|
||||
"member-access": true,
|
||||
"no-else-after-return": false,
|
||||
"member-ordering": false,
|
||||
"no-else-after-return": true,
|
||||
"no-void-expression": true,
|
||||
"align": false,
|
||||
"jsx-no-lambda": false,
|
||||
"indent": [true, "spaces", 2],
|
||||
"no-unused-variable": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces",
|
||||
2
|
||||
],
|
||||
"import-name": false,
|
||||
"no-submodule-imports": false,
|
||||
"array-type": [true, "generic"],
|
||||
"array-type": [
|
||||
true,
|
||||
"generic"
|
||||
],
|
||||
"prefer-array-literal": false,
|
||||
"function-name": false,
|
||||
"ter-arrow-parens": [true, "as-needed"],
|
||||
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"],
|
||||
"no-implicit-dependencies": [true, "dev", "optional"],
|
||||
"ter-arrow-parens": [
|
||||
true,
|
||||
"as-needed"
|
||||
],
|
||||
"variable-name": [
|
||||
true,
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-pascal-case"
|
||||
],
|
||||
"no-implicit-dependencies": [
|
||||
true,
|
||||
"dev",
|
||||
"optional"
|
||||
],
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
@@ -29,4 +62,4 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user