Commit 8c53dfaf authored by Jérome Perrin's avatar Jérome Perrin

monaco_editor: fix some renderjs.d.ts definitions

parent d247a8cf
......@@ -4,12 +4,14 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped (not yet)
// TypeScript Version: 2.4
// erp5_monaco_editor_include portal_skins/erp5_monaco_editor/monaco-rsvp.d.ts rsvp
// XXX needs nexedi RSVP patch loaded.
/**
* A gadget state dict.
*/
interface GadgetState {
interface GadgetState extends Object {
[key: string]: any;
}
......@@ -53,6 +55,11 @@ declare class Gadget {
* To mutate the state, use `changeState`.
*/
public state: GadgetState;
/**
* The element where this gadget is attached in the DOM, if gadget is already in the DOM.
*/
public element?: HTMLElement;
/**
* Because declared methods will be added to the gadget class, the type declaration is loose.
......@@ -88,15 +95,6 @@ declare class Gadget {
*/
getDeclaredGadget(gadgetScope: string): RSVP.Queue<Gadget>;
/**
* `setState`: Set Initial State
*
* The gadget's state should be set once when initialising the gadget. The state should contain key/value pairs, but the state is just an ordinary JavaScript object with no hard restrictions.
*
* @param initialState the initial state.
*/
setState(initialState: GadgetState): RSVP.Queue<void>;
/**
* `changeState`: Change State
*
......@@ -112,6 +110,11 @@ declare class Gadget {
* RenderJs gadget class.
*/
interface GadgetKlass {
/**
* The HTML element where this gadget class is declared.
*/
__template_element: HTMLDocument;
/**
* `setState`: Set Initial State
*
......@@ -228,7 +231,7 @@ interface GadgetKlass {
* @param argument_list The arguments which the method is called.
* @param scope The caller gadget scope.
*/
(this: Gadget, argument_list: any[], scope: string) => any
(this: Gadget, argument_list: any[], scope: string) => RSVP.Promise<any>
): GadgetKlass;
/**
......
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