Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 687fb5b

Browse files
committed
feat(*): Add phantom args
Add phantom args
2 parents 65b91c4 + 3a08079 commit 687fb5b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ const pool = createPhantomPool({
6666
// specifies how long a resource can stay idle in pool before being removed
6767
idleTimeoutMillis: 30000, // default.
6868
// For all opts, see opts at https://github.com/coopernurse/node-pool#createpool
69+
phantomArgs: [['--ignore-ssl-errors=true', '--disk-cache=true'], {
70+
logLevel: 'debug',
71+
}], // arguments passed to phantomjs-node directly, default is `[]`. For all opts, see https://github.com/amir20/phantomjs-node#phantom-object-api
6972
})
7073

7174
// Automatically acquires a phantom instance and releases it back to the
@@ -95,4 +98,4 @@ you are getting might not be in a completely clean state. It could have
9598
browser history, cookies or other persistent data from a previous use.
9699

97100
If that is an issue for you, make sure you clean up any sensitive data
98-
on the phantom instance before returning it to the pool.
101+
on the phantom instance before returning it to the pool.

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ export default ({
1010
min = 2,
1111
// specifies how long a resource can stay idle in pool before being removed
1212
idleTimeoutMillis = 30000,
13+
phantomArgs = [],
1314
...otherConfig
1415
} = {}) => {
1516
// TODO: randomly destroy old instances to avoid resource leak?
1617
const factory = {
17-
create: () => phantom.create(),
18+
create: () => phantom.create(...phantomArgs),
1819
destroy: (instance) => instance.exit(),
1920
}
2021
const config = {

0 commit comments

Comments
 (0)