🚧 Start port to ESM

This commit is contained in:
Simon Schneegans
2023-07-12 09:59:53 +02:00
parent 3a03c86fbc
commit 8a0c29a52f
30 changed files with 266 additions and 356 deletions
+4 -6
View File
@@ -14,10 +14,9 @@
'use strict';
const GObject = imports.gi.GObject;
import GObject from 'gi://GObject';
const ExtensionUtils = imports.misc.extensionUtils;
const Me = imports.misc.extensionUtils.getCurrentExtension();
import {Shader} from './Shader.js';
//////////////////////////////////////////////////////////////////////////////////////////
// Each effect of Burn-My-Windows owns an instance of this class. It is used to created //
@@ -25,7 +24,7 @@ const Me = imports.misc.extensionUtils.getCurrentExtension();
// possible in order to avoid memory leaks. //
//////////////////////////////////////////////////////////////////////////////////////////
var ShaderFactory = class {
export class ShaderFactory {
// Creates a new ShaderFactory. Requires the nick of the effect and a callback function
// which will be called whenever a new shader is created.
@@ -62,8 +61,7 @@ var ShaderFactory = class {
// Only try to register the new type once.
if (GObject.type_from_name(typeName) == null) {
const outerThis = this;
GObject.registerClass({GTypeName: typeName},
class Shader extends Me.imports.src.Shader.Shader {
GObject.registerClass({GTypeName: typeName}, class ShaderImp extends Shader {
// This will actually load the GLSL source code from the resources.
_init() {
super._init(outerThis._nick);