-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save scroll positions in service and not in local storage
- Loading branch information
1 parent
dc88334
commit 3f9a79c
Showing
4 changed files
with
61 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { ScrollPositionService } from './scroll-position.service'; | ||
|
||
describe('ScrollPositionService', () => { | ||
let service: ScrollPositionService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(ScrollPositionService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class ScrollPositionService { | ||
|
||
private eventsScrollPosition = 0; | ||
private noticeBoardScrollPosition = 0; | ||
|
||
constructor() { | ||
} | ||
|
||
getEventsScrollPosition(): number { | ||
return this.eventsScrollPosition; | ||
} | ||
|
||
setEventsScrollPosition(value: number) { | ||
this.eventsScrollPosition = value; | ||
} | ||
|
||
getNoticeBoardScrollPosition(): number { | ||
return this.noticeBoardScrollPosition; | ||
} | ||
|
||
setNoticeBoardScrollPosition(value: number) { | ||
this.noticeBoardScrollPosition = value; | ||
} | ||
} |