Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Chocolat scripting API
JavaScript Objective-C Python
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
deps
js
objc
.gitignore
README.md
UNLICENSE.txt
api.js
chocolat.js Support loading via package.json and it's `main` key
compile.py
ideas.js

README.md

Chocolat scripting API

This is the API for the Chocolat text editor. It's open source so that others can add any functionality that is missing.

Contributing

The API is separated into JavaScript and Objective-C parts.

JavaScript

The js folder contains the JavaScript side of the API. These files are all concatenated to form one big file. Files are concatenated in alphabetical order, with the exception of prelude.js which goes first.

The deps folder contains all JS dependencies. Currently this is underscore.js, underscore.string.js, sugar.js and buckets.js. While I have no particular objection to including extra libraries with Chocolat, size matters. Bigger libraries increase how long Chocolat takes to download, which means less money and fewer yachts for us :)

To call Objective-C methods, use the three objc_msgSend functions. These mimic their C counterparts and have the form

objc_msgSend(<receiver>, <selector>, <arguments>...)

The two others are objc_msgSendSync() which blocks and returns a value, and objc_msgSendThread() which executes the function on the JS thread instead of the main thread (do not use objc_msgSendThread() unless you know what you're doing).

Objective-C

The objc folder contains a bunch of Objective-C categories.

Note that Chocolat currently uses GC and will probably switch to ARC in the future, so please try to write code that works with both.

License

The Chocolat API is public domain and released under the terms of Unlicense. Basically this means you can do whatever the hell you want with it.

If you submit a pull request or patch, you must agree to license your changes similarly.

Something went wrong with that request. Please try again.