Skip to content

Commit

Permalink
feat: null to undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
hexxone committed Nov 29, 2023
1 parent 93d210b commit 62e05b6
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 999 deletions.
941 changes: 0 additions & 941 deletions src/@types/gles.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/CComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class CComponent {
* main Settings, need to be overwritten with Specific settings
* @public
*/
public settings: CSettings = null;
public settings: CSettings = undefined;

/**
* will recursively try to set a setting with type and return success
Expand Down
4 changes: 2 additions & 2 deletions src/FPSta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class FPStats extends CComponent {
private gpuMS = 1;

// audio
private auProvider: WEAS = null;
private auProvider: WEAS = undefined;
private audHolder: HTMLElement;
private audioMS = 1;
private bpmHolder: HTMLDivElement;
Expand Down Expand Up @@ -270,7 +270,7 @@ export class FPStats extends CComponent {
}

const getDetail = (type: string) =>
result.breakdown.find(bd => !!bd && !!bd.types && !!bd.types.includes && bd.types.includes(type)) ?? null
result.breakdown.find(bd => !!bd && !!bd.types && !!bd.types.includes && bd.types.includes(type)) ?? undefined

const addDetail = (gotDetail: any, text: string, gotElement: HTMLElement, insertAfter: HTMLElement) => {
if (!!gotDetail && !isNaN(gotDetail.bytes)) {
Expand Down
18 changes: 9 additions & 9 deletions src/WEICUE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* See LICENSE file in the project root for full license information.
*/

import { ICUE } from "./@types/we-icue";
import { CComponent } from "./CComponent";
import { CSettings } from "./CSettings";
import { ICUE } from "./ICUE";
import { Smallog } from "./Smallog";
import { getRealWindowSize, rgbToObj, waitReady } from "./Util";
import { WEAS } from "./weas/WEAS";
Expand Down Expand Up @@ -54,17 +54,17 @@ export class WEICUE extends CComponent {
private cue: ICUE;
private weas: WEAS;

private holder: HTMLDivElement = null;
private texter: HTMLDivElement = null;
private preview: HTMLDivElement = null;
private helperCanvas: HTMLCanvasElement = null;
private helperContext: CanvasRenderingContext2D = null;
private holder?: HTMLDivElement = undefined;
private texter?: HTMLDivElement = undefined;
private preview?: HTMLDivElement = undefined;
private helperCanvas?: HTMLCanvasElement = undefined;
private helperContext?: CanvasRenderingContext2D = undefined;

private icueDevices = [];
private icueInterval = null;
private icueInterval = undefined;

// preview time out
private prevTimeout = null;
private prevTimeout?: NodeJS.Timeout = undefined;

// runtime values
public settings: CUESettings = new CUESettings();
Expand Down Expand Up @@ -319,7 +319,7 @@ export class WEICUE extends CComponent {
// reset timeout?
if (this.prevTimeout) {
clearTimeout(this.prevTimeout);
this.prevTimeout = null;
this.prevTimeout = undefined;
}
// update / show preview
if (this.isAvailable && this.preview && this.settings.icue_mode == 1) {
Expand Down
51 changes: 27 additions & 24 deletions src/WEWA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ const LogHead = "[WEWWA] ";
const DefLang = "en-us";

/**
* WEWWA
* WEWA
*
* Wallpaper Engine Web Wallpaper Adapter
* Wallpaper Engine Web Adapter
*
* This is an aditional TS class to be included in your Typescript/Webpack Wallpaper Engine
* This is an aditional class to be included in your Typescript/Webpack Wallpaper Engine
* Web-Wallpaper project - so you can test, run & configure it from a normal web browser.
*
* REQUIREMENTS:
Expand Down Expand Up @@ -56,25 +56,26 @@ const DefLang = "en-us";
*
* @public
*/
export class WEWWA {
private audListener: string;
export class WEWA {
private audioListener: string;
private propListener: string;

private projectFile: string;
private defLang: string;

private projectData: any = null;
private projectData?: any = undefined; // TODO type WE project.json

private htmlMenu: Element = null;
private htmlIcon: Element = null;
private htmlMenu?: Element = undefined;
private htmlIcon?: Element = undefined;

private audio: HTMLAudioElement = null;
private ctx: AudioContext = null;
private source: any = null;
private analyser: any = null;
private audio?: HTMLAudioElement = undefined;
private ctx?: AudioContext = undefined;

private audioInterval: any = null;
private audioCallback: any = null;
private source?: MediaStreamAudioSourceNode | MediaElementAudioSourceNode = undefined;
private analyser?: AnalyserNode = undefined;

private audioInterval?: NodeJS.Timeout = undefined;
private audioCallback?: (data: number[]) => void = undefined;

private pauseOnUnfocus = true;
private isPaused = false;
Expand All @@ -83,24 +84,24 @@ export class WEWWA {
* Check if we are running in Web-Mode
* if yes => iniitialize, else => do nothing
* @param {Function} finished Callback for initializing the wallpaper
* @param {string} audListener to register
* @param {string} audioListener to register
* @param {string} propListener to register
* @param {string} projFile to register
* @param {string} defLang default languague from project file
*/
constructor(
finished: () => void = undefined,
audListener = "wallpaperRegisterAudioListener",
audioListener = "wallpaperRegisterAudioListener",
propListener = "wallpaperPropertyListener",
projFile = "project.json",
defLang = DefLang
) {
this.audListener = audListener;
this.audioListener = audioListener;
this.propListener = propListener;
this.projectFile = projFile;
this.defLang = defLang;

if (window[audListener]) {
if (window[audioListener]) {
Smallog.info("detected wallpaper engine => Standby.", LogHead);
if (finished !== undefined) finished();
return;
Expand All @@ -109,7 +110,7 @@ export class WEWWA {
Smallog.info("wallpaper engine not detected => Init!", LogHead);

// define audio listener first, so we dont miss when it gets registered.
window[audListener] = (callback) => {
window[audioListener] = (callback) => {
// set callback to be called later with analysed audio data
this.audioCallback = callback;
Smallog.info("Registered wallpaper AudioListener.", LogHead);
Expand Down Expand Up @@ -318,15 +319,15 @@ export class WEWWA {
if (this.htmlMenu) {
document.body.removeChild(this.htmlMenu);
document.body.removeChild(this.htmlIcon);
this.htmlMenu = null;
this.htmlMenu = undefined;
}

// quick wrapper, we need this a lot
const ce = (e) => document.createElement(e);

// local vars faster
const proj = this.projectData;
const props = proj.general.properties;
const props = proj.general.properties; // TODO Type

// create root menu
this.htmlMenu = ce("div");
Expand Down Expand Up @@ -739,8 +740,10 @@ export class WEWWA {
// Input
const column2 = ce("td");
column2.classList.add("right");
// optional NumericUpDown Column

// optional NumericUpDown Column for sliders
let column3 = null;

// div or label text element
let txt = null;
// main input element
Expand Down Expand Up @@ -1196,7 +1199,7 @@ export class WEWWA {
private startAudioInterval() {
const data = new Uint8Array(128);
// 33ms ~~ 30fps
this.audioInterval = window.setInterval(() => {
this.audioInterval = setInterval(() => {
if (this.audioCallback == null) {
this.stopAudioInterval();
Smallog.error("no AudioCallback!", LogHead);
Expand All @@ -1219,7 +1222,7 @@ export class WEWWA {
* @param {Uint8Array} data input
* @returns {number[]} result
*/
private convertAudio(data: Uint8Array) {
private convertAudio(data: Uint8Array): number[] {
const stereo = [];
let sIdx = 0;
for (let i = 0; i < 64; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/three.ts
4 changes: 2 additions & 2 deletions src/three/EffectComposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ export class EffectComposer {
if (this.renderer.autoClear) this.renderer.clear();

// do spilt rendering
if (this.renderer.xr.isPresenting && frame !== null) {
if (this.renderer.xr.isPresenting && frame !== undefined) {
this.scene.updateMatrixWorld();
if (this.camera.parent === null) this.camera.updateMatrixWorld();
if (this.camera.parent === undefined) this.camera.updateMatrixWorld();

// update cameras
const pose = frame.getViewerPose(this.renderer.xr.getReferenceSpace());
Expand Down
8 changes: 4 additions & 4 deletions src/three/pass/FullScreenHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import { WebGLRenderer } from "three.ts/src/renderers/WebGLRenderer";
* @public
*/
export class FullScreenHelper {
private _mat = null;
private readonly _mat: Material;

public camera: Camera = null;
public geometry: BufferGeometry = null;
public mesh: Mesh = null;
public readonly camera: Camera;
public readonly geometry: BufferGeometry;
public readonly mesh: Mesh;

/**
* instantiate
Expand Down
28 changes: 13 additions & 15 deletions src/three/pass/RenderPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,37 @@ import { BasePass } from "./BasePass";
* Shader Render Helper
*/
export class RenderPass implements BasePass {
name = "RenderPass";
enabled = true;
needsSwap = true;
private readonly scene: Scene;
private readonly camera: Camera;
private readonly overMat?: Material;

clear = true;
public clearColor: Color = undefined;
public clearAlpha: number = undefined;

clearColor: Color = null;
public name = "RenderPass";
public enabled = true;
public needsSwap = true;

clearAlpha: number = null;
clearDepth = false;

scene: Scene = null;
camera: Camera = null;
overMat: Material = null;
public clear = true;
public clearDepth = false;

/**
* Construct helper
* @param {Scene} scene Scene
* @param {Camera} camera Camera
* @param {Material} overMat Override material
* @param {Material} overMat optional Override material
* @param {Color} clearColor Clear color
* @param {number} clearAlpha Clear alpha
*/
constructor(
scene: Scene,
camera: Camera,
overMat: Material,
clearColor?,
overMat?: Material,
clearColor?: Color,
clearAlpha?: number
) {
this.scene = scene;
this.camera = camera;

this.overMat = overMat;

this.clearColor = clearColor;
Expand Down

0 comments on commit 62e05b6

Please sign in to comment.