Skip to content

Commit 8a525fa

Browse files
committed
fix: unified observer array of object
1 parent 7ef054f commit 8a525fa

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/index.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -952,24 +952,25 @@ function calculate(expression) {
952952
}
953953
}
954954

955-
observer.init({
956-
name: "CoCreateCalculateChangeValue",
957-
types: ["attributes"],
958-
attributeFilter: ["calculate"],
959-
callback(mutation) {
960-
setCalcationValue(mutation.target);
961-
}
962-
});
963-
964-
observer.init({
965-
name: "CoCreateCalculateInit",
966-
types: ["addedNodes"],
967-
selector: "[calculate]",
968-
callback(mutation) {
969-
initElement(mutation.target);
955+
observer.init([
956+
{
957+
name: "CoCreateCalculateChangeValue",
958+
types: ["attributes"],
959+
attributeFilter: ["calculate"],
960+
callback(mutation) {
961+
setCalcationValue(mutation.target);
962+
}
963+
},
964+
{
965+
name: "CoCreateCalculateInit",
966+
types: ["addedNodes"],
967+
selector: "[calculate]",
968+
callback(mutation) {
969+
initElement(mutation.target);
970+
}
970971
}
971-
});
972+
]);
972973

973-
init();
974+
init(); //
974975

975976
export default { initElements, initElement, calculate };

0 commit comments

Comments
 (0)