Skip to content

Commit

Permalink
Use a setter to assign the managed Scroller.
Browse files Browse the repository at this point in the history
Issue #240.

␄
  • Loading branch information
Mike Castle committed Feb 25, 2024
1 parent d95865f commit 160417a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions linkedin-tool.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1920,9 +1920,9 @@
*/
constructor(name, scroller) {
super(name);
this.#scroller = scroller;
this.on('activate', this.#onActivate)
.on('deactivate', this.#onDeactivate);
.on('deactivate', this.#onDeactivate)
.setScroller(scroller);
}

/**
Expand All @@ -1934,6 +1934,19 @@
return this;
}

/**
* Sets the {@link Scroller} to manage with this service.
*
* If not value is passed, any existing instance will be removed.
*
* @param {Scroller} [scroller] - The instance to manage.
* @returns {LinkedInScrollerService} - This instance, for chaining.
*/
setScroller(scroller = null) {
this.#scroller = scroller;
return this;
}

#details
#scroller

Expand Down

0 comments on commit 160417a

Please sign in to comment.