You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pat/inject/documentation.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -373,3 +373,22 @@ You can customise the behaviour of injection through options in the `data-pat-in
373
373
|`loading-class`| 'injecting' || A class which will be added to the injection target while content is still being loaded. Multiple classes can be specified (separated with spaces), or leave empty if no class should be added. | String |
374
374
|`history`||`none``record`| If set to `record` then injection will update the URL history and the title tag of the HTML page. | String or null. |
375
375
|`hooks`|`[]`|`["raptor"]`| Once injection has completed successfully, pat-inject will trigger an event for each hook: pat-inject-hook-\$(hook). Useful for other patterns which need to know whether injection relevant to them has finished, for example `pat-raptor`. | String. |
376
+
377
+
378
+
## Developer documentation
379
+
380
+
pat-inject fires several JavaScript events which bubble up the DOM tree:
381
+
382
+
| Event name | Type | Triggered on | Bubbles | Description |
383
+
| --- | --- | --- | --- | --- |
384
+
|`patterns-inject-triggered`| jQuery | pat-inject-element | true | Triggered, right after injection has been triggered. This can be on click, on submit, automatically and so on. |
385
+
|`pat-ajax-success`| jQuery | pat-inject element | true | Triggered after successful ajax call but before the response is injected into the document |
386
+
|`patterns-injected`| jQuery | parent of injected content | true | Triggered after successful injection |
387
+
|`pat-inject-success`| JavaScript | pat-inject element | true | Triggered after successful injection, right after `patterns-injected` but on the pat-inject element and not on the injected content itself. |
388
+
|`patterns-injected-scanned`| jQuery | injected content | true | Triggered after injected content was scanned by Pattern registry for new patterns. |
|`pat-inject-content-loaded`| jQuery | images within injected content | true | Triggered on images within the injected content when those images are loaded. |
391
+
|`pat-inject-missingSource`| jQuery | trigger which caused the injection | true | Triggered when no to-be-injected source could be found. |
392
+
|`pat-inject-missingTarget`| jQuery | trigger which caused the injection | true | Triggered when no target could be found. |
393
+
394
+
Please note: `jQuery.trigger` events can be catched with jQuery only while JavaScript `dispatchEvent` events can be catched with bare JavaScript `addEventListener` and `jQuery.on`.
0 commit comments