> For the complete documentation index, see [llms.txt](https://learn.squirrel365.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.squirrel365.io/squirrel-addon-documentation/squirrel-helper-library/javascript/methods/initwithsquirrel.md).

# initWithSquirrel

## initWithSquirrel()

No parameters and no return.

This method should be called once the addon has finished it’s own configuration and initialization. This will send a message to Squirrel to inform it that the addon is setup and ready to start sending and receiving messages.

This method will store a copy of state and bindingDimensions.

### state

{% tabs %}
{% tab title="Description" %}
Squirrel will respond to the [initWithSquirrel()](#initwithsquirrel) method call with a handshake response. The handshake will include a complete copy of state.

State matches the [defaultState ](https://learn.squirrel365.io/squirrel-addon-documentation/squirrel-helper-library/javascript/methods/pages/t9VAveCwtB3eQR9XIBKT#defaultstate.json)structure provided in the [defaultState.json](https://learn.squirrel365.io/squirrel-addon-documentation/squirrel-helper-library/javascript/methods/pages/t9VAveCwtB3eQR9XIBKT#defaultstate.json) file. The state object passed from Squirrel will contain all the current values for any bound cells or hard-coded values in the property panel.

State is a private variable which you cannot access directly, however you can request a copy of state by using the [getCopyOfState()](/squirrel-addon-documentation/squirrel-helper-library/javascript/methods/getcopyofstate.md) method. And a copy of state is passed into the [onInitState](/squirrel-addon-documentation/squirrel-helper-library/javascript/events/oninitstate.md) method.
{% endtab %}

{% tab title="JSON" %}

```json
{
  "buttonText": "Load File",
  "buttonDisabled": "false",
  "buttonColor": {
    "type": "solid",
    "color": [
      {
        "color": "#22ee33",
        "alpha": 1,
        "ratio": 0
      }
    ],
    "rotation": 0,
    "enabled": true
  },
  "dataDestination": ""
}
```

{% endtab %}
{% endtabs %}

### bindingDimensions

{% tabs %}
{% tab title="Description" %}
Squirrel will respond to the [initWithSquirrel()](#initwithsquirrel) method call with a handshake response. The handshake will include a complete copy of all the known bindings.

The bindingDimensions object will contain a property name matching your default state, following [dot notation](/squirrel-addon-documentation/squirrel-helper-library/dot-notation.md), with the value being the size of the binding.

This variable is private and not directly accessibly, however you can get the dimension for a specific property by calling the [getBindingDimension](/squirrel-addon-documentation/squirrel-helper-library/javascript/methods/getbindingdimension.md) method

<br>
{% endtab %}

{% tab title="JSON" %}

```json
{
  "buttonColor.color.0.color":{
    "width":1,
    "height":1
  },
  "buttonText":{
    "width":1,
    "height":1
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.squirrel365.io/squirrel-addon-documentation/squirrel-helper-library/javascript/methods/initwithsquirrel.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
