mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-17 02:16:54 +00:00
4.59.0
* Fixed: Appearance of the page when viewing a Watch Party. * Fixed: During the initial load, some CSS blocks could be incorrectly injected into the page due to a race condition. * Fixed: The sample embed in Chat > Appearance >> Rich Content not appearing correctly. * API Added: New event class `FFZWaitableEvent`, a subclass of `FFZEvent` providing a framework for asynchronous event handlers. * API Added: `site.channel:update-bar` event, fired whenever the channel info bar is updated. * API Fixed: `chat.removeTokenizer()`, `chat.removeLinkProvider()`, and `chat.removeRichProvider()` failing to fully remove their respective items. * API Removed: The `emitAsync` method has been removed from modules. Nothing was using it, and it was problematic due to the concurrent access protection on events. Instead, `FFZWaitableEvent` should be used if asynchronous waiting is necessary.
This commit is contained in:
parent
675512e811
commit
a7e131070e
13 changed files with 156 additions and 112 deletions
|
@ -72,6 +72,8 @@ export default class CSSTweaks extends Module {
|
|||
this.chunks = {};
|
||||
this.chunks_loaded = false;
|
||||
|
||||
this._state = {};
|
||||
|
||||
// Layout
|
||||
|
||||
this.settings.add('metadata.modview.hide-info', {
|
||||
|
@ -574,17 +576,33 @@ export default class CSSTweaks extends Module {
|
|||
}
|
||||
|
||||
|
||||
async toggle(key, val) {
|
||||
toggle(key, val) {
|
||||
val = !! val;
|
||||
if ( (this._state[key] ?? false) === val )
|
||||
return;
|
||||
|
||||
this._state[key] = val;
|
||||
this._apply(key);
|
||||
}
|
||||
|
||||
_apply(key) {
|
||||
const val = this._state[key];
|
||||
if ( ! val ) {
|
||||
this.style.delete(key);
|
||||
if ( this.style )
|
||||
this.style.delete(key);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! this.chunks_loaded )
|
||||
await this.populate();
|
||||
if ( this.style.has(key) )
|
||||
return;
|
||||
|
||||
if ( ! has(this.chunks, key) )
|
||||
throw new Error(`cannot find chunk "${key}"`);
|
||||
if ( ! this.chunks_loaded )
|
||||
return this.populate().then(() => this._apply(key));
|
||||
|
||||
if ( ! has(this.chunks, key) ) {
|
||||
this.log.warn(`Unknown chunk name "${key}" for toggle()`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.style.set(key, this.chunks[key]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue