mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
JSONEditorOnline type definitions and tests
Initial commit of JSONEditorOnline type definitions and tests.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// Tests for JSONEditorOnline type definitions
|
||||
///<reference path="jsoneditoronline.d.ts" />
|
||||
|
||||
var options:JSONEditorOptions = {
|
||||
"search": true
|
||||
};
|
||||
var editor:JSONEditor = new JSONEditor(container, options);
|
||||
var json:JSON = {
|
||||
"Array": [1, 2, 3],
|
||||
"Boolean": true,
|
||||
"Null": null,
|
||||
"Number": 123,
|
||||
"Object": {"a": "b", "c": "d"},
|
||||
"String": "Hello World"
|
||||
};
|
||||
editor.set(json);
|
||||
editor.expandAll();
|
||||
|
||||
var json2:JSON = editor.get(json);
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for JSONEditorOnline
|
||||
// JSON Editor Online is a tool to easily edit and format JSON online. JSON is displayed in a clear, editable treeview and in formatted plain text.
|
||||
// Project: https://github.com/josdejong/jsoneditoronline
|
||||
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface JSONEditorOptions {
|
||||
change?: () => void;
|
||||
history?: bool;
|
||||
mode?: string;
|
||||
name?: string;
|
||||
search?: bool;
|
||||
}
|
||||
|
||||
interface JSONEditor {
|
||||
(container:HTMLElement, options?: JSONEditorOptions, json?: JSON): JSONEditor;
|
||||
set(json: JSON, name?: string): void;
|
||||
setName(name?: string): void;
|
||||
get(): JSON;
|
||||
getName(): string;
|
||||
expandAll(): void;
|
||||
collapseAll(): void;
|
||||
}
|
||||
|
||||
interface JSONFormatterOptions {
|
||||
change?: () => void;
|
||||
indentation?: number;
|
||||
}
|
||||
|
||||
interface JSONFormatter {
|
||||
(container:HTMLElement, options?: JSONFormatterOptions, json?: JSON): JSONEditor;
|
||||
}
|
||||
Reference in New Issue
Block a user