API Reference
API Reference
These docs are for v1.1. Click to read the latest docs for v1.2.

By default EasyShip is initialized simply by including the javascript via a script tag. However, there are times that you may want to defer initialization in order to hook into the initialization process. In order to reliably configure these hooks you will need to set the data-defer-initialization data attribute on your script tag and manually initialize EasyShip at a later time.

Example

<script
  src="https://app.shippingeasy.com/easyship.js"
  data-partner-key="XXX"
  data-token="dc02eec82448924a6a8d0ad4a1174af41e342fc2d45962e702ac137bd"
  data-defer-initialization="true">
</script>

<script>
  EasyShip.beforeInit = function() {
    alert("Before initialization");
  }
  EasyShip.init();
</script>

beforeInit

Executes before the EasyShip library initializes and loads its assets.

EasyShip.beforeInit = function() {
    alert("Before initialization");
}

afterInit

Executes after the EasyShip library initializes and loads its assets.

EasyShip.afterInit = function() {
    alert("After initialization");
}