mirror of
https://github.com/hanzoai/forum.git
synced 2026-09-30 21:51:19 +00:00
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);
|
|
}
|
|
}
|
|
}
|