1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-24 19:48:30 +00:00
Fixed: Issue with Recommended Channels query.
Changed: Add information on loaded add-ons to generated logs.
API Changed: Add the missing utility modules to `FrankerFaceZ.utilities` exports, for use in add-ons.
API Changed: Make the Dialog class a bit more flexible.
This commit is contained in:
SirStendec 2019-06-05 00:30:45 -04:00
parent a0bb84deef
commit 8582626269
5 changed files with 55 additions and 24 deletions

View file

@ -82,6 +82,21 @@ export default class AddonManager extends Module {
this.emit(':ready');
}
generateLog() {
const out = ['Known'];
for(const [id, addon] of Object.entries(this.addons))
out.push(`${id} | ${this.isAddonEnabled(id) ? 'enabled' : 'disabled'} | ${addon.dev ? 'dev | ' : ''}${this.isAddonExternal(id) ? 'external | ' : ''}${addon.short_name} v${addon.version}`);
out.push('');
out.push('Modules');
for(const [key, module] of Object.entries(this.__modules)) {
if ( module )
out.push(`${module.loaded ? 'loaded ' : module.loading ? 'loading ' : 'unloaded'} | ${module.enabled ? 'enabled ' : module.enabling ? 'enabling' : 'disabled'} | ${key}`)
}
return out.join('\n');
}
onProviderChange(key, value) {
if ( key != 'addons.enabled' )
return;

View file

@ -151,7 +151,7 @@ ${typeof x[1] === 'string' ? x[1] : JSON.stringify(x[1], null, 4)}`
FrankerFaceZ.Logger = Logger;
const VER = FrankerFaceZ.version_info = {
major: 4, minor: 2, revision: 3,
major: 4, minor: 2, revision: 4,
commit: __git_commit__,
build: __webpack_hash__,
toString: () =>
@ -161,12 +161,15 @@ const VER = FrankerFaceZ.version_info = {
FrankerFaceZ.utilities = {
addon: require('utilities/addon'),
dom: require('utilities/dom'),
color: require('utilities/color'),
events: require('utilities/events'),
module: require('utilities/module'),
constants: require('utilities/constants'),
dialog: require('utilities/dialog'),
dom: require('utilities/dom'),
events: require('utilities/events'),
fontAwesome: require('utilities/font-awesome'),
graphql: require('utilities/graphql'),
logging: require('utilities/logging'),
module: require('utilities/module'),
object: require('utilities/object'),
time: require('utilities/time'),
tooltip: require('utilities/tooltip'),

View file

@ -1,12 +1,10 @@
query RecommendedChannels {
currentUser {
recommendations {
liveRecommendations {
nodes {
recommendedStreams {
edges {
node {
createdAt
type
}
}
}
}
}

View file

@ -8,21 +8,29 @@ import {EventEmitter} from 'utilities/events';
import Site from 'site';
export default class Dialog extends EventEmitter {
constructor(element) {
export class Dialog extends EventEmitter {
constructor(element, options = {}) {
super();
this.selectors = {
exclusive: Dialog.EXCLUSIVE,
maximized: Dialog.MAXIMIZED,
normal: Dialog.SELECTOR
};
if ( options.selectors )
this.selectors = Object.assign(this.selectors, options.selectors);
this._maximized = options.maximized || false;
this._exclusive = options.exclusive || false;
this._element = null;
this._visible = false;
if ( typeof element === 'function' )
this.factory = element;
else
this.element = element;
this._visible = false;
this._maximized = false;
this._exclusive = false;
}
// ========================================================================
@ -40,6 +48,8 @@ export default class Dialog extends EventEmitter {
if ( this._visible )
this.toggleSize();
else
this._maximized = val;
}
get visible() {
@ -102,9 +112,9 @@ export default class Dialog extends EventEmitter {
getContainer() {
return document.querySelector(
this._exclusive ? Dialog.EXCLUSIVE :
this._maximized ? Dialog.MAXIMIZED :
Dialog.SELECTOR
this._exclusive ? this.selectors.exclusive :
this._maximized ? this.selectors.maximized :
this.selectors.normal
);
}
@ -189,3 +199,6 @@ Dialog.lastZ = 99999999;
Dialog.EXCLUSIVE = Site.DIALOG_EXCLUSIVE;
Dialog.MAXIMIZED = Site.DIALOG_MAXIMIZED;
Dialog.SELECTOR = Site.DIALOG_SELECTOR;
export default Dialog;

View file

@ -8,7 +8,7 @@ const RAVEN_LEVELS = {
};
export default class Logger {
export class Logger {
constructor(parent, name, level, raven) {
this.root = parent ? parent.root : this;
this.parent = parent;
@ -117,3 +117,5 @@ Logger.INFO = 2;
Logger.WARN = 4;
Logger.ERROR = 8;
Logger.OFF = 99;
export default Logger;