Skip to content

Commit 5141248

Browse files
authored
fix: problem when watchUntil is run for the first time (#62)
Co-authored-by: huang yao <5945154+kirakiray@users.noreply.github.com>
1 parent 2b4b84b commit 5141248

File tree

11 files changed

+68
-35
lines changed

11 files changed

+68
-35
lines changed

dist/stanz.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! stanz - v8.1.26 https://github.com/kirakiray/stanz (c) 2018-2024 YAO
1+
//! stanz - v8.1.27 https://github.com/kirakiray/stanz (c) 2018-2024 YAO
22
(function (global, factory) {
33
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
44
typeof define === 'function' && define.amd ? define(factory) :
@@ -320,13 +320,18 @@
320320
},
321321
watchUntil(func) {
322322
return new Promise((resolve) => {
323-
const tid = this.watch(() => {
324-
const bool = func();
325-
if (bool) {
326-
this.unwatch(tid);
327-
resolve(this);
328-
}
329-
});
323+
let f;
324+
const tid = this.watch(
325+
(f = () => {
326+
const bool = func();
327+
if (bool) {
328+
this.unwatch(tid);
329+
resolve(this);
330+
}
331+
})
332+
);
333+
334+
f();
330335
});
331336
},
332337
};

dist/stanz.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/stanz.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)