Skip to content

Commit cee3014

Browse files
committed
fix(0.0.8): circular references
1 parent cbf426a commit cee3014

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@
7070
},
7171
"type": "module",
7272
"types": "./dist/main.d.ts",
73-
"version": "0.0.7"
73+
"version": "0.0.8"
7474
}

src/core/odometer.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,28 +1019,20 @@ class LightOdometer {
10191019
}
10201020

10211021
/**
1022-
* Returns the entire current odometer object along with the global options.
1023-
* @returns {string} A string representation of the current odometer state.
1022+
* Returns the current odometer object along with the global options.
1023+
* @returns {string} A JSON-parseable string representation of the current odometer state.
10241024
*/
10251025
toString(): string {
1026-
// Avoid serializing the HTMLElement directly (circular / large). Use an HTML snapshot instead.
1027-
const elSnapshot = (this.el && typeof (this.el).outerHTML === "string")
1028-
? (this.el).outerHTML
1029-
: (() => {
1030-
try {
1031-
return JSON.stringify(this.el)
1032-
} catch {
1033-
// oxlint-disable-next-line no-base-to-string
1034-
return String(this.el)
1035-
}
1036-
})()
1037-
10381026
const snapshot = {
1039-
el: elSnapshot,
10401027
id: this.options.id,
10411028
value: this.value,
10421029
options: this.getOptions(),
10431030
globalOptions: LightOdometer.getGlobalOptions(),
1031+
watchMutations: this.watchMutations,
1032+
transitionEndBound: this.transitionEndBound,
1033+
destroyed: this.destroyed,
1034+
format: this.format,
1035+
isAnimating: this.isAnimating,
10441036
}
10451037

10461038
return JSON.stringify(snapshot)

0 commit comments

Comments
 (0)