> For the complete documentation index, see [llms.txt](https://docs.storylane.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.storylane.io/repx/javascript-functions.md).

# Javascript functions

RepX exposes some JavaScript functions you can call from your own site to control the widget. These are useful when you want the RepX widget to be hidden on some pages, and have it open up only when users click on a button. **Please note that these functions are case-sensitive**.

| **Function**        | **What it does**                                                                                                                                  |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| window\.Repx.show() | Shows the widget on the page. This is the default: the widget always shows unless you tell it not to, so you rarely need to call this explicitly. |
| window\.Repx.hide() | Hides the widget launcher from the page.                                                                                                          |
| window\.Repx.open() | Opens the full chat panel.                                                                                                                        |

#### When to use these functions

If you want the RepX widget to open only when users click on a button, you would first hide the widget on load by going to [Settings in Storylane dashboard](https://app.storylane.io/repx-dashboard/settings/). Then, when a button is clicked, using the [onclick event](https://www.w3schools.com/jsref/event_onclick.asp), you'd call the function window\.Repx.open() function to open the chat panel.

You'd rarely use the function window\.Repx.show(). It's only to be used when you've embedded the widget on your website in such a way that it's hidden by default across several pages. On certain pages where you'd like to show the widget launcher, you'd invoke window\.Repx.show() when the page loads, so that it shows up in those pages.

<br>


---

# 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://docs.storylane.io/repx/javascript-functions.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.
