Spanish Total.js
English
Documentation For AI agents
Contents

Add extensions

An extension is an HTML file that adds something of yours to LessCode: styles or buttons for the designer, or code that runs with the flow.

.md GitHub
On this page

Add one

  1. Choose Flows → Show the folder of the flows.
  2. Go to the folder above it. It has index.js and extensions.js.
  3. Make a folder called extensions there.
  4. Put your file in it. Its name must end in .html.
  5. Choose Flows → Restart LessCode.

LessCode reads the folder when it starts. After you change, add or remove an extension, restart it again.

What goes in the file

The part inside <script total> runs once, when the flow starts. The rest goes to the page of the designer.

This one adds an address that says the name of the flow:

<script total>
    ROUTE('GET /api/status/', $ => $.json({ name: exports.name, flow: exports.flow.id }));
</script>

Save it as status.html, restart LessCode and open http://127.0.0.1:7230/api/status/ in your browser. Call your flow from other apps says how to see the port, if yours is another.

Extensions has a longer example and what the code can use.

With the updates

Updating the app leaves your extensions folder as it is. Do not change the other files of LessCode in that folder: an update puts its own in their place.

An extension can do on your computer all that you can do. Use only those that you have written, or that you have read.
Made in Europe