Misc performance improvements for thread list

This commit is contained in:
Ben Gotow 2017-09-09 16:50:09 -07:00
parent 3ac2848174
commit 30885be8e4
2 changed files with 7 additions and 6 deletions

View file

@ -93,7 +93,7 @@ class Scrollbar extends React.Component
position:'relative'
height: handleHeight || 0
top: handleTop || 0
transform: 'translate3d(0, ' + Math.floor(handleTop) + 'px, 0)'
_scrollbarWrapStyles: =>
position:'absolute'

View file

@ -8,12 +8,13 @@ export class Registry {
constructor(name) {
this.name = name;
this._registry = new Map();
this.clear();
}
register(extension, {priority = 0} = {}) {
this.validateExtension(extension, 'register');
this._registry.set(extension.name, {extension, priority});
this._registry.push({name: extension.name, extension, priority});
this._registry.sort((a, b) => a.priority < b.priority);
this.triggerDebounced();
return this;
}
@ -25,14 +26,14 @@ export class Registry {
}
extensions() {
return _.pluck(_.sortBy(Array.from(this._registry.values()), "priority"), "extension").reverse()
return this._registry.map(e => e.extension);
}
clear() {
this._registry = new Map();
this._registry = [];
}
triggerDebounced = _.debounce(::this.trigger, 1);
triggerDebounced = _.debounce(() => this.trigger(), 1);
validateExtension(extension, method) {
if (!extension || Array.isArray(extension) || !_.isObject(extension)) {