1
0
mirror of https://github.com/flarum/core.git synced 2025-07-22 09:11:19 +02:00

Clean up discussion list retaining mechanism

This commit is contained in:
Toby Zerner
2015-05-07 10:27:29 +09:30
parent 09bef29bf5
commit 741ca5ab92
5 changed files with 14 additions and 18 deletions

View File

@@ -4,14 +4,14 @@
() => this.props.post.freshness,
() => this.showing
);
this.subtree.add(() => this.props.user.freshness);
this.subtree.check(() => this.props.user.freshness);
// view
this.subtree.retain() || 'expensive expression'
*/
export default class SubtreeRetainer {
constructor() {
this.clear();
this.invalidate();
this.callbacks = [].slice.call(arguments);
}
@@ -27,11 +27,11 @@ export default class SubtreeRetainer {
return needsRebuild ? false : {subtree: 'retain'};
}
add() {
check() {
this.callbacks = this.callbacks.concat([].slice.call(arguments));
}
clear() {
invalidate() {
this.old = [];
}
}