---
updatedAt: 2025-07-15T21:27:27.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# Ace Editor

Ace code editor overview

# Ace Code Editor

The Appery.io **[App Builder](https://docs.appery.io/docs/apperyio-visual-builder)** uses [Ace editor](https://ace.c9.io/) for its code editor. Ace is a powerful code editor and provides the following benefits and features:

* Full-screen mode;
* Fast performance, fast validation, and fast code assist;
* More editor features:
  * Multiple cursors;
  * Block selection;
  * Highlight all occurrences of a selected word allows for easy renaming variables at once in the whole block of code;
  * *Find* and *Replace*;
  * *Expand* and *collapse* blocks of code;
  * *Undo* and *redo* actions;
  * *Autocomplete* (`CTRL + Space`) option:
    <image align="center" border="{true}" classname="border" src="https://files.readme.io/7eb5925-Screenshot_4.png"/>

\> 📘 Note!
\>
\> A large collection of useful hotkeys can be [found here](https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts).

# Adding Custom Code to Appery.io Events

The ***[Run TypeScript](https://docs.appery.io/docs/5-event-handling#run-typescript)*** action allows the execution of custom TypeScript code inserted into the code editor.

Appery.io offers many different snippets that can be added to your project to call different properties and/or methods. The full list of available properties and functions can be accessed from the **[EVENTS](https://docs.appery.io/docs/apperyio-visual-builder#events-tab)** tab where the ***[Run TypeScript](https://docs.appery.io/docs/5-event-handling#run-typescript)*** action is added to the corresponding [event](https://docs.appery.io/docs/5-event-handling#event-types).

For example, clicking `CTRL + Space` after entering the Appery.io global object, `this.Apperyio.`, will invoke the list of properties and methods that are available for adding to the code editor: <image align="center" border="{true}" classname="border" src="https://files.readme.io/2a2ad40-2023-02-28_13-14-37.png"/>
Also, adding predefined [variables](https://docs.appery.io/docs/5-event-handling#action-arguments) is possible: <image align="center" border="{true}" classname="border" src="https://files.readme.io/1890aeb-2023-02-28_13-18-52.png"/>

## Example: `isBrowser()` and `isMobile()` Functions

Let's consider the example of how to add the functions that check what device the app is currently running on. Such methods can be useful when there is a need to send messages or some configuration file to particular devices.

For example, the methods `isBrowser()` and `isMobile()` will inform whether the app is started from the browser or run on the mobile device.

1. First, add two **[Button](https://docs.appery.io/docs/button)** components to the screen and name them ***Browser*** and ***Mobile***.
2. Select the first button, ***Browser*** and unfold the **[EVENTS](https://docs.appery.io/docs/apperyio-visual-builder#events-tab)** tab from bottom. There, select the **[Click](https://docs.appery.io/docs/5-event-handling#common-events)** event for it and add the ***[Run TypeScript](https://docs.appery.io/docs/5-event-handling#run-typescript)*** action for the event. The editor will open where you can enter the `this.Apperyio.isBrowser();` method.

\> 👍 Tip!
\>
\> It's a good practice to use the *Autocomplete* feature to speed up the process: <image align="center" border="{true}" classname="border" src="https://files.readme.io/f9294d7-2023-02-28_10-40-24.png"/>
3\. Let's also make this notification appear in the alert and save the event: <image align="center" border="{true}" classname="border" src="https://files.readme.io/0016e0a-2023-02-28_10-39-32.png"/>
4\. The second button should be defined with the `this.Apperyio.isMobile();` method: <image align="center" border="{true}" classname="border" src="https://files.readme.io/2d50bdf-2023-02-28_10-41-37.png"/>
Ready! Let's test. Run the app in the browser and experiment by clicking the buttons: <image align="center" border="{true}" classname="border" src="https://files.readme.io/91165e9-Animation3.gif"/>
However, if you run the same app on a mobile, you will get:

* click on the first button will return ***false***;
* click on the second button will return ***true***:
  <image align="center" border="{true}" classname="border" src="https://files.readme.io/1d8a49e-Screen_Recording_20230228_105656_Apperyio_Tester.gif" width="28%"/>

\> 👍 `is Ios()` and `isAndroid()`
\>
\> Similarly, you can add the `is Ios()` and `isAndroid()` functions that will check what device the app is currently running on.

## Example: `projectInfo` Property

Now, let's see how to add the property, `projectInfo`, to the code that will be called on the app start.

1. First, select the ***[Run TypeScript](https://docs.appery.io/docs/5-event-handling#run-typescript)*** action for the **Page create** event, start typing `this.Apperyio.p` to filter properties starting with "p" and then click `CTRL + Space` and select the `projectInfo` property from the list:
   <image align="center" border="{true}" classname="border" src="https://files.readme.io/81442e6-2023-02-28_11-35-12.png"/>
2. Next step is selecting what type of data you would like to get on the page creation.\
   Also, the notification will be shown as an alert:
   <image align="center" border="{true}" classname="border" src="https://files.readme.io/df26e3a-2023-02-28_11-36-59.png"/>
3. With the needed snippets added, the event should look like this:
   <image align="center" border="{true}" classname="border" src="https://files.readme.io/662597d-2023-02-28_13-34-44.png"/>
4. Now, after you save and click the **TEST** button in the **[App Builder Toolbar](https://docs.appery.io/docs/apperyio-app-builder-overview#toolbar)** to run the app in the preview, the custom code you added will run and the app name will be shown:

<image align="center" border="{true}" classname="border" src="https://files.readme.io/5ee7a2c-2023-02-28_13-07-33.png"/>