Commit 542b7280 authored by Jérome Perrin's avatar Jérome Perrin

monaco_editor: Add incomplete typescript declarations for Renderjs & RSVP

So that javascript editor provides hints for code using these libraries.

See this doc to complete:
https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
parent 30a1f015
......@@ -30,6 +30,21 @@
autoIndent: true
}
);
// XXX put these fetch in the queue ?
fetch('./monaco-renderjs.ts')
.then(function (resp) { return resp.text(); })
.then(function (body) {
monaco.languages.typescript.javascriptDefaults.addExtraLib(
body,
'renderjs.js');
});
fetch('./monaco-rsvp.ts')
.then(function (resp) { return resp.text(); })
.then(function (body) {
monaco.languages.typescript.javascriptDefaults.addExtraLib(
body,
'rsvp.js');
});
editor.model.onDidChangeContent(deferNotifyChange)
})
......
// Type definitions for RenderJS
// XXX this is work in progress.
declare class Gadget {
/**
* RenderJs gadget class.
*/
constructor();
/**
* `ready`: define a function to be called when gadget is ready
* XXX (gadget: Gadget) ? isn't it a gadget *instance* ?
*
* @params f function to call when gadget is ready. XXX this function returns a queue and gadget is ready once the queue is "empty" / "resolved" ?
*/
ready(f: (gadget: Gadget) => RSVP.Queue): Gadget;
/**
* `declareService`: declare a service.
*
* @params serviceName name of the service
* @params service function implementing the service logic.
*/
declareService(serviceName: String, service: (gadget: Gadget) => RSVP.Queue): Gadget;
declareJob(serviceName: String, service: (gadget: Gadget) => RSVP.Queue): Gadget;
declareMethod(methodName: String, method: (gadget: Gadget) => RSVP.Queue): Gadget;
declareAcquiredMethod(localMethodName: String, parentMethodName: String): Gadget;
}
/**
* Initialize this gadget.
*/
declare function rJS(window: Window): Gadget;
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>monaco-renderjs.ts</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/typescript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>monaco-rsvp.ts</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/typescript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment