mirror of
https://github.com/Mestima/GodotHook.git
synced 2025-05-06 16:20:24 +00:00
README updated according lowercase naming convention
This commit is contained in:
parent
ed1903119a
commit
dd24f3fd45
26
README.md
26
README.md
@ -16,14 +16,14 @@ Example compilation `Windows` command: `scons p=windows tools=yes -j4`
|
|||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
```gdscript
|
```gdscript
|
||||||
hook.GetTable()
|
hook.getTable()
|
||||||
hook.Add(event: String, uid: String, function: Callable)
|
hook.add(event: String, uid: String, function: Callable)
|
||||||
hook.Call(event: String, args: Array = [], defer: bool = false)
|
hook.call(event: String, args: Array = [], defer: bool = false)
|
||||||
hook.Remove(event: String, uid: String)
|
hook.remove(event: String, uid: String)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
`hook.Add` creates a new listening event and `hook.Call` executes all listening events of the same type, for example:
|
`hook.add` creates a new listening event and `hook.call` executes all listening events of the same type, for example:
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
# autorun.gd
|
# autorun.gd
|
||||||
@ -36,31 +36,31 @@ func printHookOutput1(a: String, b: String):
|
|||||||
func printHookOutput2(a: String, b: String):
|
func printHookOutput2(a: String, b: String):
|
||||||
print(a, " ", b)
|
print(a, " ", b)
|
||||||
|
|
||||||
hook.Add("OnReady", "UniqueName1", Callable(self, "printHookOutput1"))
|
hook.add("OnReady", "UniqueName1", Callable(self, "printHookOutput1"))
|
||||||
hook.Add("OnReady", "UniqueName2", Callable(self, "printHookOutput2"))
|
hook.add("OnReady", "UniqueName2", Callable(self, "printHookOutput2"))
|
||||||
```
|
```
|
||||||
```gdscript
|
```gdscript
|
||||||
# any node script
|
# any node script
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
hook.Call("OnReady", ["Hey!", "It's OnReady hook!"])
|
hook.call("OnReady", ["Hey!", "It's OnReady hook!"])
|
||||||
hook.Call("OnReady", ["Hey!", "It's OnReady hook, but deferred!"], true)
|
hook.call("OnReady", ["Hey!", "It's OnReady hook, but deferred!"], true)
|
||||||
```
|
```
|
||||||
|
|
||||||
`hook.Remove` removes any listening event by its name and type:
|
`hook.remove` removes any listening event by its name and type:
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
# can be executed at any place
|
# can be executed at any place
|
||||||
|
|
||||||
hook.Remove("OnReady", "UniqueName")
|
hook.remove("OnReady", "UniqueName")
|
||||||
```
|
```
|
||||||
|
|
||||||
`hook.GetTable` returns a `Dictionary` with all added listening events
|
`hook.getTable` returns a `Dictionary` with all added listening events
|
||||||
|
|
||||||
```gdscript
|
```gdscript
|
||||||
# can be executed at any place
|
# can be executed at any place
|
||||||
|
|
||||||
var hookTable: Dictionary = hook.GetTable()
|
var hookTable: Dictionary = hook.getTable()
|
||||||
```
|
```
|
||||||
|
|
||||||
## Star History
|
## Star History
|
||||||
|
Loading…
x
Reference in New Issue
Block a user