1
0
Fork 0

Improve Addons doc further

- Fix whitespaces
- Add details about __DIR__
- Add details about event listeners
This commit is contained in:
Hypolite Petovan 2018-09-24 19:27:35 -04:00
parent be348cf8c8
commit 2fff1f389d

View file

@ -85,6 +85,8 @@ function <addon>_head(App $a)
} }
``` ```
`__DIR__` is the folder path of your addon.
## JavaScript ## JavaScript
### Global scripts ### Global scripts
@ -105,6 +107,8 @@ function <addon>_footer(App $a)
} }
``` ```
`__DIR__` is the folder path of your addon.
### JavaScript hooks ### JavaScript hooks
The main Friendica script provides hooks via events dispatched on the `document` property. The main Friendica script provides hooks via events dispatched on the `document` property.
@ -115,7 +119,9 @@ document.addEventListener(name, callback);
``` ```
- *name* is the name of the hook and corresponds to a known Friendica JavaScript hook. - *name* is the name of the hook and corresponds to a known Friendica JavaScript hook.
- *callback* is a JavaScript function to execute. - *callback* is a JavaScript anonymous function to execute.
More info about Javascript event listeners: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
#### Current JavaScript hooks #### Current JavaScript hooks