-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
155 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { optionalServices as WoodemiOptionalServices } from "./woodemi/WoodemiClient.js"; | ||
|
||
export const optionalServiceCollection = [ | ||
...WoodemiOptionalServices | ||
...WoodemiOptionalServices | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import { WOODEMI_PREFIX } from "./woodemi/Woodemi.js"; | ||
|
||
Uint8Array.prototype.startWith = function (prefix) { | ||
if (this.length < prefix.length) return false | ||
if (this.length < prefix.length) return false; | ||
|
||
for (let i in prefix) { | ||
if (this[i] != prefix[i]) return false | ||
} | ||
return true | ||
} | ||
for (let i in prefix) { | ||
if (this[i] != prefix[i]) return false; | ||
} | ||
return true; | ||
}; | ||
|
||
export default class NotepadClient { | ||
static support(scanResult) { | ||
if (scanResult.manufacturerData.startWith(WOODEMI_PREFIX)) { | ||
return true; | ||
} | ||
return false; | ||
static support(scanResult) { | ||
if (scanResult.manufacturerData.startWith(WOODEMI_PREFIX)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
export default class EventEmitter { | ||
constructor() { | ||
this.events = {}; | ||
} | ||
constructor() { | ||
this.events = {}; | ||
} | ||
|
||
addListener(event, listener) { | ||
if (typeof this.events[event] !== 'object') { | ||
this.events[event] = []; | ||
} | ||
this.events[event].push(listener); | ||
return () => this.removeListener(event, listener); | ||
addListener(event, listener) { | ||
if (typeof this.events[event] !== 'object') { | ||
this.events[event] = []; | ||
} | ||
this.events[event].push(listener); | ||
return () => this.removeListener(event, listener); | ||
} | ||
|
||
removeListener(event, listener) { | ||
if (typeof this.events[event] === 'object') { | ||
const idx = this.events[event].indexOf(listener); | ||
if (idx > -1) { | ||
this.events[event].splice(idx, 1); | ||
} | ||
} | ||
removeListener(event, listener) { | ||
if (typeof this.events[event] === 'object') { | ||
const idx = this.events[event].indexOf(listener); | ||
if (idx > -1) { | ||
this.events[event].splice(idx, 1); | ||
} | ||
} | ||
} | ||
|
||
emit(event, ...args) { | ||
if (typeof this.events[event] === 'object') { | ||
this.events[event].forEach((listener) => listener.apply(this, args)); | ||
} | ||
emit(event, ...args) { | ||
if (typeof this.events[event] === 'object') { | ||
this.events[event].forEach((listener) => listener.apply(this, args)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export const NotepadConnectionState = { | ||
disconnected: 0, | ||
connecting: 1, | ||
connected: 2 | ||
disconnected: 0, | ||
connecting: 1, | ||
connected: 2 | ||
}; | ||
|
||
export const NotepadMode = Object.freeze({ | ||
Sync: Symbol("Sync"), | ||
Common: Symbol("Common"), | ||
Sync: Symbol("Sync"), | ||
Common: Symbol("Common"), | ||
}); |
Oops, something went wrong.