mirror of
https://github.com/liabru/matter-js.git
synced 2025-02-07 19:06:26 -05:00
Updated Creating plugins (markdown)
parent
87e8623794
commit
4d047bf8ad
1 changed files with 2 additions and 0 deletions
|
@ -135,6 +135,7 @@ Tips for patching:
|
|||
- don't change the original function signature
|
||||
- don't return inside a `Matter.before` and `Matter.after` unless you intend to change the result
|
||||
- when returning, ensure the same type as the patched function
|
||||
- don't store references to `Matter.*` functions (as they may reference unpatched versions)
|
||||
|
||||
### Using other plugins as dependencies
|
||||
|
||||
|
@ -166,6 +167,7 @@ Some general guidelines for plugins:
|
|||
- version everything
|
||||
- document everything (code and readme)
|
||||
- build plugins with sharing and reuse in mind
|
||||
- don't store references to `Matter.*` functions (as they may reference unpatched versions)
|
||||
- don't _add_ new functions to modules or namespaces you don't maintain (only patch existing functions)
|
||||
- follow the same namespacing structure as the core (e.g. `MyPlugin.Body.init`, `MyPlugin.Engine.update`)
|
||||
- expose and implement your plugin's functions so that they can be called manually
|
||||
|
|
Loading…
Add table
Reference in a new issue