# JavaScript Hook for Composer

**URL:** <https://meta.discourse.org/t/javascript-hook-for-composer/137967>\
**Category:** Development\
**Created:** [January 7, 2020, 1:31pm UTC](https://meta.discourse.org/t/javascript-hook-for-composer/137967 "2020-01-07T13:31:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [January 7, 2020, 2:49pm UTC](https://meta.discourse.org/t/javascript-hook-for-composer/137967/4 "2020-01-07T14:49:51Z")

</div>

This is a Component, handilly, so you would want to override this method `didInsertElement()` in your initializer.

Example:

```plaintext
withPluginApi('0.8.12', (api) => {

      api.modifyClass('component:load-more'

```

from here [https://github.com/paviliondev/discourse-topic-previews/blob/master/assets/javascripts/discourse/initializers/preview-edits.js.es6](https://github.com/paviliondev/discourse-topic-previews/blob/master/assets/javascripts/discourse/initializers/preview-edits.js.es6)

If you are lucky you can just call `this._super();` and append your additional logic at the end.

---

_[View the full topic](https://meta.discourse.org/t/javascript-hook-for-composer/137967)._
