From 67186eb37d040f1d1b335acd608a797f3fcd3d5b Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Mon, 10 Jan 2022 05:51:22 +0100 Subject: [PATCH] :memo: Add even more comments --- src/FireEffect.js | 14 +++++++++++++- src/MatrixEffect.js | 14 +++++++++++++- src/TRexEffect.js | 13 ++++++++++++- src/TVEffect.js | 14 +++++++++++++- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/FireEffect.js b/src/FireEffect.js index 669fbe6..d81dedc 100644 --- a/src/FireEffect.js +++ b/src/FireEffect.js @@ -30,15 +30,21 @@ const utils = Me.imports.src.utils; // The shader class for this effect is registered further down in this file. let FireShader = null; +// The effect class is completely static. It can be used to get some metadata (like the +// effect's name or supported GNOME Shell versions), to initialize the respective page of +// the settings dialog, as well as to create the actual shader for the effect. var FireEffect = class FireEffect { - // ---------------------------------------------------------------------- static methods + // ---------------------------------------------------------------------------- metadata // The effect is available on all GNOME Shell versions supported by this extension. static getMinShellVersion() { return [3, 36]; } + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. the '*-close-effect'). static getNick() { return 'fire'; } @@ -49,6 +55,9 @@ var FireEffect = class FireEffect { return 'Fire'; } + // -------------------------------------------------------------------- API for prefs.js + + // This is called by the preferences dialog. static initPreferences(dialog) { // Add the settings page to the builder. @@ -85,6 +94,9 @@ var FireEffect = class FireEffect { FireEffect.getLabel()); } + // ---------------------------------------------------------------- API for extension.js + + static createShader(settings) { return new FireShader(settings); } diff --git a/src/MatrixEffect.js b/src/MatrixEffect.js index 4aa34bb..0584fa8 100644 --- a/src/MatrixEffect.js +++ b/src/MatrixEffect.js @@ -30,15 +30,21 @@ const utils = Me.imports.src.utils; // The shader class for this effect is registered further down in this file. let MatrixShader = null; +// The effect class is completely static. It can be used to get some metadata (like the +// effect's name or supported GNOME Shell versions), to initialize the respective page of +// the settings dialog, as well as to create the actual shader for the effect. var MatrixEffect = class MatrixEffect { - // ---------------------------------------------------------------------- static methods + // ---------------------------------------------------------------------------- metadata // This effect is only available on GNOME Shell 40+. static getMinShellVersion() { return [40, 0]; } + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. the '*-close-effect'). static getNick() { return 'matrix'; } @@ -49,6 +55,9 @@ var MatrixEffect = class MatrixEffect { return 'Matrix'; } + // -------------------------------------------------------------------- API for prefs.js + + static initPreferences(dialog) { // Add the settings page to the builder. @@ -68,6 +77,9 @@ var MatrixEffect = class MatrixEffect { MatrixEffect.getLabel()); } + // ---------------------------------------------------------------- API for extension.js + + static createShader(settings) { return new MatrixShader(settings); } diff --git a/src/TRexEffect.js b/src/TRexEffect.js index cdefe7e..1c62368 100644 --- a/src/TRexEffect.js +++ b/src/TRexEffect.js @@ -28,15 +28,21 @@ const utils = Me.imports.src.utils; // The shader class for this effect is registered further down in this file. let TRexShader = null; +// The effect class is completely static. It can be used to get some metadata (like the +// effect's name or supported GNOME Shell versions), to initialize the respective page of +// the settings dialog, as well as to create the actual shader for the effect. var TRexEffect = class TRexEffect { - // ---------------------------------------------------------------------- static methods + // ---------------------------------------------------------------------------- metadata // This effect is only available on GNOME Shell 40+. static getMinShellVersion() { return [40, 0]; } + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. the '*-close-effect'). static getNick() { return 'trex'; } @@ -47,6 +53,8 @@ var TRexEffect = class TRexEffect { return 'T-Rex Attack'; } + // -------------------------------------------------------------------- API for prefs.js + static initPreferences(dialog) { // Add the settings page to the builder. @@ -66,6 +74,9 @@ var TRexEffect = class TRexEffect { TRexEffect.getLabel()); } + // ---------------------------------------------------------------- API for extension.js + + static createShader(settings) { return new TRexShader(settings); } diff --git a/src/TVEffect.js b/src/TVEffect.js index 6650546..4d84319 100644 --- a/src/TVEffect.js +++ b/src/TVEffect.js @@ -28,15 +28,21 @@ const utils = Me.imports.src.utils; // The shader class for this effect is registered further down in this file. let TVShader = null; +// The effect class is completely static. It can be used to get some metadata (like the +// effect's name or supported GNOME Shell versions), to initialize the respective page of +// the settings dialog, as well as to create the actual shader for the effect. var TVEffect = class TVEffect { - // ---------------------------------------------------------------------- static methods + // ---------------------------------------------------------------------------- metadata // The effect is available on all GNOME Shell versions supported by this extension. static getMinShellVersion() { return [3, 36]; } + // This will be called in various places where a unique identifier for this effect is + // required. It should match the prefix of the settings keys which store whether the + // effect is enabled currently (e.g. the '*-close-effect'). static getNick() { return 'tv'; } @@ -47,6 +53,9 @@ var TVEffect = class TVEffect { return 'TV Effect'; } + // -------------------------------------------------------------------- API for prefs.js + + static initPreferences(dialog) { // Add the settings page to the builder. @@ -64,6 +73,9 @@ var TVEffect = class TVEffect { TVEffect.getLabel()); } + // ---------------------------------------------------------------- API for extension.js + + static createShader(settings) { return new TVShader(settings); }