Life Cycle

Last updated on August 02, 2024.

There are two ways to handle Insites component lifecycle by Event or by Property.

Event

Code Snippet

<ins-button id="myBtn"
  label="Event Lifecycle" solid>
</ins-button>

<script>
  myBtn.addEventListener('didLoad', function(e){
    console.log('myBtn did load', e);
  })
</script>
Property

Code Snippet

<ins-button has-load="doSomething"
  label="Event Lifecycle" solid>
</ins-button>

<script src="https://components.insites.io/insites-config.min.js"></script>
<script>
  Insites.addMethods({
    doSomething: function(e) {
      console.log('ins-button has loaded', e);
    }
  });
</script>
Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.