File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,21 @@ import { SimpleShaderCanvas } from 'simple-shader-component/react'
29
29
```
30
30
*** Note** : Right now only the React wrapper is included. If there's interest, or if my workflow requires it, I will add additional wrappers.*
31
31
32
+ ### Hooks
33
+ Hooks can be added to any of the class methods, to add a hook you can pass it on construction or using the exposed add hook method.
34
+
35
+ ``` tsx
36
+ import { Shader , MethodName } from ' simple-shader-component' // import types from base package
37
+
38
+ const hook = {
39
+ methodName: MethodName .RENDER ,
40
+ hook : (shader : Shader ) => void
41
+ }
42
+
43
+ Shader .addHook (hook ) // use addHook method
44
+ <SimpleShaderCanvas args = { { hooks:[hook ] }} /> // or pass on init
45
+ ```
46
+
32
47
### Basic Usage
33
48
'use client' directive is required to set hooks. If you're not using hooks it can be done in a server component.
34
49
You can’t perform that action at this time.
0 commit comments