# JavaScript API

> Compare the TXTextControl object of the Document Editor with the TXDocumentViewer object of the Document Viewer: callbacks or promises, and load events.

- **Product:** TX Text Control .NET Server
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET Server > API Reference > JavaScript API
- **959 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-api/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-api/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-api/llms-full.txt

---

Code that runs in the browser controls the Document Editor and the Document Viewer through two JavaScript objects: `TXTextControl` for the editor and `TXDocumentViewer` for the viewer. Their references list every object, property, method and event with its syntax and parameters. Both APIs are the same in every frontend, whether the component comes from the ASP.NET Core HTML helper, a plain JavaScript page or the Angular or React packages, and the Blazor component of the Document Editor works with the same `TXTextControl` object.

The two objects are independent APIs with different conventions. Knowing which one you are working with, and how it returns results, makes the reference pages easier to read.

### The Two APIs

|  | Document Editor | Document Viewer |
|---|---|---|
| Object | [TXTextControl](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/llms-full.txt) | [TXDocumentViewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/txdocumentviewer/llms-full.txt) |
| What it controls | The document in the editor: text, formatting, tables, images, fields, sections, tracked changes, comments, the selection and the ribbon | The displayed document: loading and saving, search, printing, zoom, annotations, form fields, tracked changes, signatures and the toolbar |
| Ready for your code | After the editor has raised `textControlLoaded` | After the viewer has raised `documentViewerLoaded` on `window` |
| How methods return results | Asynchronous methods pass their results to callback functions | Loading and saving return promises; most other members return their result directly |
| Events | [addEventListener](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/txtextcontrol/addeventlistener-method/llms-full.txt) of `TXTextControl` | [addEventListener](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/documentviewercontroller/addeventlistener-method/llms-full.txt) of `TXDocumentViewer` |
| Guide | [JavaScript API](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-editor/javascript-api/llms-full.txt) in Document Editor | [JavaScript API](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/javascript-api/llms-full.txt) in Document Viewer |

Enumerations of the editor are properties of its object, such as `TXTextControl.StreamType`, and the viewer has its own, such as `TXDocumentViewer.StreamType`.

### How the Reference Is Organized

Each API has a page per object. The main objects, `TXTextControl` and `TXDocumentViewer`, lead to the objects your code reaches through their properties, such as the tables of a document or the annotations in the viewer. The page of an object lists its properties, methods and events. The page of a member shows its syntax, its parameters, the value or callback it returns and the version it was introduced in.

The Document Editor's reference also documents the callback types and the objects that event handlers receive, such as `DocumentLoadedEventArgs`. The objects of the Document Viewer's reference are fewer: the viewer, its toolbar, annotations, forms, tracked changes, signatures and the settings objects for loading, saving and signing documents.

### Find the Right Page

| If you want to | Read |
|---|---|
| Understand callbacks, the object model and when the editor's object exists | [JavaScript API](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-editor/javascript-api/llms-full.txt) in Document Editor |
| Find the events of the editor and their order during initialization | [Events](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-editor/events/llms-full.txt) |
| Understand promises and the objects of the viewer | [JavaScript API](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/javascript-api/llms-full.txt) in Document Viewer |
| Handle the events of the viewer | [Events](https://docs.textcontrol.com/tx-text-control-dotnet-server/document-viewer/events/llms-full.txt) |
| Look up a member of the editor | [Document Editor](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/llms-full.txt) |
| Look up a member of the viewer | [Document Viewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/llms-full.txt) |
| Configure the Angular or React components that create the editor and the viewer | [Angular API](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/angular-api/llms-full.txt) or [React API](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/react-api/llms-full.txt) |

### Pages in This Section

- [Document Editor](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/llms-full.txt): the reference of the `TXTextControl` object and the objects below it.
- [Document Viewer](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript-document-viewer/llms-full.txt): the reference of the `TXDocumentViewer` object and the objects below it.

---

## Nearby

- **Previous:** [TXTextControl.AI.AspNetCore](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/dotnet-api/txtextcontrol-ai/aspnetcore/llms-full.txt)
- **Next:** [JavaScript API](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/llms-full.txt)
