# Get instance

|             |                                                                     |
| ----------- | ------------------------------------------------------------------- |
| id          | com.naviga.writer:getWriterInstance                                 |
| description | An action returns the instance of Writer plugin with Writer methods |

The instance object contains all the actions that's specified since before with the intention to get a single access point rather than retrieving multiple actions.

```javascript
{
    article: {
        create: () => void { /* creates a new article */ },
        open: (uuid) => void { /* open article with passed uuid */ },
        copy: (uuid) => void { /* opens a modal to make a copy of chosen article */ },
        preview: (uuid) => void { /* opens a preview of chosen article */ }
    },
    config: {
        get: () => Promise { /* get current writer configuration */ },
        core: () => Object { /* get current writer core configuration */ },
        additional: () => Object { /* get current writer configuration */ }
    },
    loadableComponents: {
        config: (name) => Object { /* get the configuration for that loadable component */},
        config: () => Array { /* get all loadable components config */}
    }
}
```

{% hint style="warning" %}
**Preview** also has a second optional parameter. This is a function supposed to handle custom images in the case where current configured ICP does not match the one where the images of the preview are supposed to be fetched from.
{% endhint %}

```javascript
import { Plugin, Utility } from '@root'

const MyComponent = async (props) => {
    const instance = Utility.useLazyRef(() => {
        return Plugin.getAction('my-bound-action-id')
    })
    
    const articleUuid = '07a99d1a-3387-4cd6-bc64-c07f0062bb78'
    
    // create
    instance.current().article.create()
    
    // open
    instance.current().article.open(artilceUuid)
    
    // copy
    instance.current().article.copy(articleUuid)
    
    // preview
    instance.current().article.preview(articleUuid)
    
    // preview with optional image generator
    instance.current().article.preview(articleUuid, data => {
         const {
            uuid,
            uri
        } = data
        
        return {
            url: functionToGenerateImageUrl(uuid, uri)
        }
    })
    
    // get writer config
    const config = await instance.current().config.get()

    // get all loadable component config
    const loadableComponentConfigs = instance.curent().loadableComponents.config()
    
    // get Article size loadable component config
    const articleSizeLoadableComponentConfig = instance.curent().loadableComponents.config('ArticleSize)
}
```


---

# Agent Instructions: 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:

```
GET https://docs.navigaglobal.com/dashboard-writer/4.2.1/developer/develop-with-writer/get-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
