mirror of
https://github.com/discourse/discourse.git
synced 2025-02-15 06:35:09 +08:00
![Joffrey JAFFEUX](/assets/img/avatar_default.png)
Due to an incorrect test the previous service was incorrectly implementing the map, and was most importantly not deleting the state when reaching bottom.
22 lines
465 B
JavaScript
22 lines
465 B
JavaScript
import { tracked } from "@glimmer/tracking";
|
|
import Service from "@ember/service";
|
|
import { TrackedMap } from "@ember-compat/tracked-built-ins";
|
|
|
|
export default class ChatChannelScrollPositions extends Service {
|
|
@tracked positions = new TrackedMap();
|
|
|
|
get(id) {
|
|
return this.positions.get(id);
|
|
}
|
|
|
|
set(id, position) {
|
|
this.positions.set(id, position);
|
|
}
|
|
|
|
delete(id) {
|
|
if (this.positions.has(id)) {
|
|
this.positions.delete(id);
|
|
}
|
|
}
|
|
}
|