Releases: 1natsu172/wait-element
v4.1.2
What's Changed
- chore(deps): update pnpm to v9.14.2 by @renovate in #49
- chore(deps): update dependency typescript to v5.7.2 by @renovate in #50
- chore(deps): update pnpm to v9.14.4 by @renovate in #51
- chore(deps): update vitest monorepo to v2.1.6 by @renovate in #52
- fix: an error when a library is referenced outside of a window context by @1natsu172 in #53
- chore(deps): update vitest monorepo to v2.1.8 by @renovate in #54
- chore(deps): update node.js to v22.12.0 by @renovate in #55
Full Changelog: v4.1.1...v4.1.2
v4.1.1
v4.1.0
What's changed
feature
other
- Bump devDependencies
Change logs
- [feat] Add customMatcher option (#43) f0b2f60
- chore(deps): lock file maintenance (#27) f233a29
- chore(deps): update actions/setup-node digest to 39370e3 (#38) 012fe43
- chore(deps): update actions/checkout digest to 11bd719 (#31) cd16c0f
- chore(deps): update dependency node to v22.11.0 3af5960
- chore(deps): update vitest monorepo to v2.1.4 6675ceb
- chore(deps): update pnpm to v9.12.3 87cc37e
- chore(deps): update dependency node to v22.10.0 476f972
- chore(deps): update vitest monorepo to v2.1.3 3871b61
- chore(deps): update pnpm to v9.12.2 e09ae7a
- chore(deps): update dependency @biomejs/biome to v1.9.4 6403266
- chore(deps): update pnpm to v9.12.1 388d4fd
- chore(deps): update dependency typescript to v5.6.3 cee01ee
- chore(deps): update pnpm to v9.12.0 ef594ae
- chore(deps): update vitest monorepo to v2.1.2 d2c61bb
- chore(deps): update dependency @biomejs/biome to v1.9.3 3214a3f
- chore(deps): update actions/setup-node digest to 0a44ba7 (#22) 5741e70
- chore(deps): update dependency jsdom to v25.0.1 8d1ee90
- chore(deps): update pnpm to v9.11.0 dad0a6c
- chore(deps): update dependency node to v22.9.0 e3a9e26
- chore(deps): update dependency @biomejs/biome to v1.9.2 86fc132
- Merge pull request #17 from 1natsu172/renovate/lock-file-maintenance 1b392f2
- chore(deps): lock file maintenance 9b959b3
- chore(deps): update vitest monorepo to v2.1.1 8073df5
- chore(deps): update pnpm to v9.10.0 c1a6e8e
- chore(deps): update dependency typescript to v5.6.2 a0fd2d6
- chore(deps): update dependency @biomejs/biome to v1.9.0 454b424
- chore(deps): update dependency node to v22.8.0 cc051b0
- chore(deps): update pnpm to v9.9.0 ade8a38
- chore(deps): pin dependencies 4eb523e
- docs: fix detector api in readme 70bc7f1
v4.0.0
Major update 🚀
New Features
detector option for customized element detector
The option name is detector
.optional
This is useful for use cases like wanting to fulfill after checking the state of an element. The return value type is explicitly defined, and when the condition is not fulfilled
, it must return { isDetected: false }
. Also, the resolved value of waitElement
will be the returned result
.
const waitPenguin = await waitElement("#animal", {
detector: (element) => {
return element?.textContent === "Penguin"
? { isDetected: true, result: element }
: { isDetected: false };
},
});
AbortController
is supported
The option name is signal
.optional
You can now abort operations in the same way as the native fetch
API.
const ac = new AbortController();
const checkElement = waitElement("#find", { signal: ac.signal });
await delay(300); // In fact, there will be some kind of process...
ac.abort("I feel like interrupting");
Performance optimization for concurrent processing
The option name is unifyProcess
.optional
This option is enabled(true
) by default.
// all waitElement internal process unified
await Promise.all([
waitElement(".unify", {
unifyProcess: true,
}),
waitElement(".unify", {
unifyProcess: true,
}),
waitElement(".unify", {
unifyProcess: true,
}),
]);
About the all options
Note
See TS definition for detailed options information.
BREAKING CHANGE
Warning
There are some breaking changes!
waitDisappearElement
has been removed
To replicate waitDisappearElement
in v4, use the following approach.
BEFORE
import { waitDisappearElement } from "@1natsu/wait-element";
await waitDisappearElement('.will-disappear');
AFTER
import { isNotExist } from "@1natsu/wait-element/detectors";
await waitElement(".will-disappear", { detector: isNotExist });
Timeout API has changed
The timeout
option has been removed. Please use AbortSignal.timeout()
instead.
BEFORE
await waitElement('.late-comming', { timeout: 5000 });
AFTER
await waitElement('.late-comming', { signal: AbortSignal.timeout(5000) });
Cancel API has changed
The cancelable API has been removed. Please use AbortController
instead.
BEFORE
let el;
try {
el = waitElement('.cancelable');
if (!isCondition) el.cancel();
} catch {
// some handling...
}
AFTER
const ac = new AbortController();
let el;
try {
el = waitElement(".aborted", {
signal: ac.signal,
});
if (!isCondition) ac.abort("abort!");
} catch (error) {
// some handling...
}
Concurrent processing is now enabled by default
If you want to use concurrent processing as in v3, set unifyProcess
to false
.
await waitElement(".please-no-unify", {
unifyProcess: false,
});
Changed logs
- version4 by @1natsu172 in #9
- add ci by @1natsu172 in #10
- Configure Renovate by @renovate in #3
- feat: beta.2 generics and resolve Result types by @1natsu172 in #12
- v4 ready by @1natsu172 in #13
Full Changelog: v3.0.0...v4.0.0
v4.0.0-beta.2
- Merge pull request #12 from 1natsu172/v4-beta2 1a67dd3
- feat: beta.2 generics and resolve Result types f8107c0
- chore(fixme): Setup interrupted by blocker 264648a
- docs: tweak 9788617
- Merge pull request #3 from 1natsu172/renovate/configure 94d8cfd
- chore: configure renovate json cf45a23
- Add renovate.json 09cf661
- Merge pull request #10 from 1natsu172/1natsu172-patch-1 3ba78f0
- fix: generate lockfile a9768e7
- add ci 9fe2afa
- chore: bye travis 234c6df
v4.0.0-beta.1
- Merge pull request #9 from 1natsu172/v4 1be0a7d
- chore: release command c1433a4
- chore: release command 3d1087b
- fix: build settings f1814e0
- docs: rewrite readme 8d77940
- chore: tweak type and doc 118fa4c
- chore: tweak commentout 5d80752
- test: add already aborted signal 713f423
- chore: sort package.json 886d454
- fix: move defu to deps e7af54e
- testl add coverage 170dedc
- test: always execute shuffle tests 8ba7c96
- test: fix timeout tests and dom conflict at each tests problem bf751de
- chore: tweak commentout 2f69d92
- test: fix detector testing 2a431a6
- test: complete unifyProcess af5f25c
- chore: setting testTimeout to 50sec ba9b6ed
- chore: bump node c597708
- feat: daitai implement e33ca63
- test: add abortable tests bd01cb2
- test: add unifyProcess option tests aca857b
- chore: under test b740036
- test: prepare detector tests 7591ef7
- chore: coverage 19a715d
- chore: prepare test description 60a7cd1
- test: add mergeOptions test 4c529f0
- chore: revert dom mock to jsdom for AbortController 319d518
- chore: change browserslist 4d64b57
- chore!: change to use vitest 6455e8d
- chore: scaff 2ee734d
- docs: add about observeConfigs 6173625
Release v3 major updated
- fix: publish files 661122e
- Merge pull request #8 from 1natsu172/develop-v3 8c0c8f5
- docs: write v3 docs 80d1a32
- lint: format 249cc29
- feat: implement waitDisappearElement e25c40a
- tweak: setting f44260f
- break: remove v2 files 1fc6902
- travis: node 15 b2ae11b
- chore: remove module field od package.json 415dfac
- chore: npm scripts 138ac73
- format: prefer-const & more 6d69b8f
- format: xo prettier c7dceb7
- chore: remove unnecessary 1719c12
- fix: typings path d6d7db1
- feat: rewrite by typescript fdbb945
- chore: xo prettier style a6c3c16
- feat: ts config & type declaration 1feacc7
- wip: pre-impl waitelement 0fca906
- init build kit a260e5c
- change package.json fb3531b
- add tool-versions 3dd2568
- feat: inject observeoptions b095a68
New API waitDisappearElement
.
Following the suggestion of #6, implemented an API for waiting for an element to disappear.
It is provided by a separate API called waitDisappearElement
. The arguments are the same as for waitElement
.
Re-wrote all use TypeScript
Re-wrote all in TS. This means that it provides stable types that match the source code.
Changed to named-export
Users can now only use named-import.
Only ES Module is provided.
Starting from v3, only ES Module is provided. The previous CommonJS format is no longer provided.
Change default observe options.
It is now possible to waitElement
for mutated attributes such as class.
Extend options for more flexibility
It is now possible to pass options for mutationObserver.
User can pass options to the options object from observeConfigs
.
Fix d.ts and upgrade build tools for dev
- chore: apply xo fix ecf6146
- Merge pull request #5 from 1natsu172/fix/test-and-build-for-publish d0ee0b9
- upgrade(build): upgrade rollup v1 latest and plugins a86e824
- fix(test): upgrade to ava v3 and babel7's and xo 3217bc1
- Merge pull request #4 from sectsect/fix-ts-error 8abb3b7
- Fix TypeScript error 96fc354
- 📝 chore: add some badges 3f45c4d
Support TypeScript definition
Add new index.d.ts
- Support TypeScript completely