fix(tracker): version check fix; few comments
This commit is contained in:
parent
e2cc2e8be1
commit
7e5e1ec8a8
3 changed files with 16 additions and 4 deletions
|
|
@ -10,7 +10,11 @@ export function isTextNode(node: Node): node is Text {
|
|||
return node.nodeType === Node.TEXT_NODE
|
||||
}
|
||||
|
||||
export function isRootNode(node: Node): boolean {
|
||||
export function isDocument(node: Node): node is Document {
|
||||
return node.nodeType === Node.DOCUMENT_NODE
|
||||
}
|
||||
|
||||
export function isRootNode(node: Node): node is Document | DocumentFragment {
|
||||
return node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export default class App {
|
|||
readonly localStorage: Storage
|
||||
readonly sessionStorage: Storage
|
||||
private readonly messages: Array<Message> = []
|
||||
private readonly observer: Observer
|
||||
/* private */ readonly observer: Observer // non-privat for attachContextCallback
|
||||
private readonly startCallbacks: Array<StartCallback> = []
|
||||
private readonly stopCallbacks: Array<() => any> = []
|
||||
private readonly commitCallbacks: Array<CommitCallback> = []
|
||||
|
|
@ -256,7 +256,13 @@ export default class App {
|
|||
const reqVer = version.split(/[.-]/)
|
||||
const ver = this.version.split(/[.-]/)
|
||||
for (let i = 0; i < 3; i++) {
|
||||
if (Number(ver[i]) < Number(reqVer[i]) || isNaN(Number(ver[i])) || isNaN(Number(reqVer[i]))) {
|
||||
if (isNaN(Number(ver[i])) || isNaN(Number(reqVer[i]))) {
|
||||
return false
|
||||
}
|
||||
if (Number(ver[i]) > Number(reqVer[i])) {
|
||||
return true
|
||||
}
|
||||
if (Number(ver[i]) < Number(reqVer[i])) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
@ -298,7 +304,7 @@ export default class App {
|
|||
if (typeof this.options.resourceBaseHref === 'string') {
|
||||
return this.options.resourceBaseHref
|
||||
} else if (typeof this.options.resourceBaseHref === 'object') {
|
||||
//switch between types
|
||||
//TODO: switch between types
|
||||
}
|
||||
if (document.baseURI) {
|
||||
return document.baseURI
|
||||
|
|
|
|||
|
|
@ -8,9 +8,11 @@ export default class Nodes {
|
|||
|
||||
constructor(private readonly node_id: string) {}
|
||||
|
||||
// Attached once per Tracker instance
|
||||
attachNodeCallback(nodeCallback: NodeCallback): void {
|
||||
this.nodeCallbacks.push(nodeCallback)
|
||||
}
|
||||
// TODO: what is the difference with app.attachEventListener. can we use only one of those?
|
||||
attachElementListener(type: string, node: Element, elementListener: EventListener): void {
|
||||
const id = this.getID(node)
|
||||
if (id === undefined) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue