Skip to content

Commit c4f0c7d

Browse files
committed
Clean-up naming conventions
1 parent 67cafed commit c4f0c7d

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/core/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Shader } from './shader'
2-
import { domHandler, MethodName } from './domHandler'
2+
import { MethodName } from './domHandler'
33

44

5-
export { Shader, domHandler, MethodName }
5+
export { Shader, MethodName }

src/core/shader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { shaderArgs, UniformValue, ShaderHook } from "../types";
1+
import { ShaderArgs, UniformValue, ShaderHook } from "../types";
22
import { domHandler, MethodName } from "./domHandler";
33

44

@@ -15,7 +15,7 @@ export class Shader extends domHandler {
1515
private vertexBuffer: WebGLBuffer;
1616
private uniforms: Array<UniformValue> | undefined
1717

18-
constructor(container: HTMLCanvasElement, args: shaderArgs) {
18+
constructor(container: HTMLCanvasElement, args: ShaderArgs) {
1919
super(container);
2020
this.gl = container.getContext('webgl') as WebGLRenderingContext;
2121
this.shaderProgram = this.initializeShader(args.vertShader, args.fragShader);

src/react/index.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
'use client'
22

3-
import React, { useRef, useEffect, useState } from "react";
4-
import { Shader as SimpleShaderCore } from "../core";
5-
import { shaderArgs } from "../types";
3+
import { useRef, useEffect } from "react";
4+
import { Shader } from "../core";
5+
import { ShaderArgs } from "../types";
66

77
export const SimpleShaderCanvas = ({
88
args,
99
className,
1010
loadedClass = 'loaded'
1111
}: {
12-
args: shaderArgs,
12+
args: ShaderArgs,
1313
className?: string,
1414
loadedClass?: string
1515
}) => {
1616

1717
const ref = useRef<HTMLCanvasElement>(null);
1818

19-
2019
useEffect(() => {
21-
2220
if (!ref.current) return
2321

24-
const ShaderInstance = new SimpleShaderCore(ref.current, args);
22+
const ShaderInstance = new Shader(ref.current, args);
2523
ShaderInstance.init()
2624

27-
2825
// return () => ShaderInstance. // TODO: ShaderInstance should be destroyed on return
2926
}, [args]);
3027

src/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ declare namespace simpleShaderComponent {
88
/**
99
* @param logic Logic should be functions passed as strings that take the form (shader: Shader) => void
1010
* */
11-
type shaderArgs = {
11+
type ShaderArgs = {
1212
vertShader?: string,
1313
fragShader?: string,
1414
uniforms?: Array<UniformValue>,

0 commit comments

Comments
 (0)