Skip to content
This repository was archived by the owner on Mar 6, 2020. It is now read-only.

Commit 05639f6

Browse files
author
René Kooi
committed
util: revert to wrapping instead of subclassing Sistyl
Sistyl's .set method is recursive, so we'd end up clearing and resetting timeouts a _lot_ by overriding it.
1 parent e76d60b commit 05639f6

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/util/Style.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ define(function (require, exports, module) {
77
const popoutView = require('plug/views/rooms/popout/PopoutView');
88

99
// hack to get plug.dj-like Class inheritance on a not-plug.dj-like Class
10-
const Style = Class.extend.call(Sistyl, {
10+
const Style = Class.extend({
1111
init(defaults) {
12-
Sistyl.call(this, defaults);
12+
this._sistyl = new Sistyl(defaults);
1313
this._timeout = null;
1414

1515
this.refresh = this.refresh.bind(this);
@@ -34,20 +34,33 @@ define(function (require, exports, module) {
3434
},
3535

3636
set(sel, props) {
37-
this._super(sel, props);
37+
this._sistyl.set(sel, props);
3838

3939
// throttle updates
4040
clearTimeout(this._timeout);
4141
this._timeout = setTimeout(this.refresh, 1);
4242
return this;
4343
},
4444

45+
unset(sel, prop) {
46+
this._sistyl.unset(sel, prop);
47+
return this;
48+
},
49+
50+
rulesets() {
51+
return this._sistyl.rulesets();
52+
},
53+
4554
refresh() {
4655
this.$().text(this.toString());
4756
},
4857

4958
remove() {
5059
this.$().remove();
60+
},
61+
62+
toString() {
63+
return this._sistyl.toString();
5164
}
5265

5366
});

0 commit comments

Comments
 (0)