0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-02-07 19:06:26 -05:00

Updated Creating plugins (markdown)

Liam 2017-01-23 20:45:05 +00:00
parent 87e8623794
commit 4d047bf8ad

@ -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