Widget JavaScript API

Notaku exposes a Widget JavaScript API to control your widget behaviour

Open the widget sidebar

typescript
Notaku.show()

Close the widget sidebar

typescript
Notaku.hide()

Change the widget current url

This method will change the website shown in the widget sidebar.
It works even if the widget has not been opened yet.
typescript
Notaku.goTo('https://notaku.so/docs')

Change the widget full page url link

The widget sidebar will show a link to visit your full page website.
You can use this method to change the link url, very useful in case you are hosting the website on a /docs subdirectory
typescript
Notaku.setFullPageUrl('https://notaku.so/docs')

Multiple widgets on a website

If you have many Notaku widgets on a page you can target one with the getWidget(widgetId)
function
typescript
Notaku.getWidget('{{widgetId}}').show()