Skip to content

Commit

Permalink
golf: use Object.assign for defaults;
Browse files Browse the repository at this point in the history
- 883 gz / 726 br
  • Loading branch information
lukeed committed Dec 10, 2018
1 parent 5def7dd commit 11c4369
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,12 @@ const observer = new IntersectionObserver(entries => {
* @param {function} options.timeoutFn - Custom timeout function
*/
export default function (options) {
options = {
...{
priority: 'low',
timeout: 2000,
timeoutFn: requestIdleCallback,
el: document,
},
...options,
};
options = Object.assign({
priority: 'low',
timeout: 2e3,
timeoutFn: requestIdleCallback,
el: document,
}, options);

options.timeoutFn(() => {
// If URLs are given, prefetch them.
Expand Down

0 comments on commit 11c4369

Please sign in to comment.