##// END OF EJS Templates
Working on dojo typings
cin -
r15:8ef85ad13241 default
parent child
Show More
@@ -32,7 +32,12 typescript {
32 32
33 33 configureTsMain {
34 34 compilerOptions {
35 types = ["requirejs", "dojo-typings"]
35 baseUrl = "$projectDir/src"
36 paths = [
37 "dojo/*" : [ "typings/dojo/*" ],
38 "dijit/*" : [ "typings/dijit/*" ]
39 ]
40 types = ["requirejs", "$projectDir/src/typings/dojo/index" /*, "dojo-typings"*/]
36 41 }
37 42 }
38 43
@@ -1145,9 +1145,9
1145 1145 "dev": true
1146 1146 },
1147 1147 "typescript": {
1148 "version": "3.7.5",
1149 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
1150 "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
1148 "version": "3.8.3",
1149 "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
1150 "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
1151 1151 "dev": true
1152 1152 },
1153 1153 "uri-js": {
@@ -21,7 +21,7
21 21 "devDependencies": {
22 22 "@types/requirejs": "2.1.31",
23 23 "dojo": "1.16.0",
24 "typescript": "~3.7.5",
24 "typescript": "~3.8.3",
25 25 "eslint": "6.8.0",
26 26 "tslint": "6.0.0",
27 27 "@implab/core-amd": "^1.3.2",
@@ -1,9 +1,10
1 1 import declare = require("dojo/_base/declare");
2 2 import { each } from "@implab/core-amd/safe";
3 3 import { Constructor } from "@implab/core-amd/interfaces";
4 // import { DeclareConstructor } from "dojo/_base/declare";
5 4
6 type DeclareConstructor<T> = dojo._base.DeclareConstructor<T>;
5 // declare const declare: any;
6
7 type DeclareConstructor<T> = declare.DeclareConstructor<T>;
7 8
8 9 export interface AbstractConstructor<T = {}> {
9 10 prototype: T;
@@ -3,8 +3,9 import _WidgetBase = require("dijit/_Wid
3 3 import _AttachMixin = require("dijit/_AttachMixin");
4 4 import { BuildContext, isNode } from "./traits";
5 5 import registry = require("dijit/registry");
6 // import { Handle } from "dojo/interfaces";
7 type Handle = dojo.Handle;
6 import { Handle } from "dojo/interfaces";
7
8 // type Handle = dojo.Handle;
8 9
9 10 @djclass
10 11 export abstract class DjxWidgetBase extends djbase(_WidgetBase, _AttachMixin) {
@@ -1,13 +1,18
1 1 {
2 2 "extends": "../tsconfig",
3 3 "compilerOptions": {
4 "baseUrl": "../",
4 5 "rootDir": "ts",
5 6 "rootDirs": [
6 7 "ts",
7 8 "typings"
8 9 ],
10 "paths" : {
11 "dojo/*" : [ "typings/dojo/*" ],
12 "dijit/*" : [ "typings/dijit/*" ]
13 },
9 14 "types": [
10 "requirejs", "dojo-typings", "./typings/index"
15 "requirejs", "./typings/index", "../typings/dojo/index"
11 16 ]
12 17 }
13 18 } No newline at end of file
@@ -11,7 +11,7 test("simple", (ok, fail, log) => {
11 11 }, 100);
12 12 });
13 13
14 test("simple", async log => {
14 test("simple", async (log, fail) => {
15 15 await delay(0);
16 16
17 17 assert.ok(true); // everything is fine
@@ -1,6 +1,6
1 import { DeclareConstructor } from "dojo/_base/declare";
2 1 import { Handle } from "dojo/interfaces";
3 2 import _WidgetBase = require("./_WidgetBase");
3 import declare = require("dojo/_base/declare");
4 4
5 5 declare module "./_WidgetBase" {
6 6 interface _WidgetBase {
@@ -81,7 +81,7 interface _AttachMixin {
81 81 destroyRendering(preserveDom?: boolean): void;
82 82 }
83 83
84 interface _AttachMixinConstructor extends DeclareConstructor<_AttachMixin> { }
84 interface _AttachMixinConstructor extends declare.DeclareConstructor<_AttachMixin> { }
85 85
86 86 declare const _AttachMixin: _AttachMixinConstructor;
87 87 export = _AttachMixin;
@@ -2,7 +2,6 import Stateful = require("dojo/Stateful
2 2 import Destroyable = require("./Destroyable");
3 3 import { ExtensionEvent } from "dojo/on";
4 4 import { NodeFragmentOrString, Handle, NodeOrString, WatchHandle } from "dojo/interfaces";
5 import { DeclareConstructor } from "dojo/_base/declare";
6 5
7 6 declare namespace _WidgetBase {
8 7 interface _WidgetBase extends Stateful, Destroyable {
@@ -231,7 +230,7 declare namespace _WidgetBase {
231 230 }
232 231
233 232 interface _WidgetBaseConstructor<W = _WidgetBase> extends DeclareConstructor<W> {
234 new(params: Object, srcNodeRef: NodeOrString): W;
233 new(params: Object, srcNodeRef?: NodeOrString): W;
235 234 }
236 235
237 236 }
@@ -1,6 +1,6
1 1 /* dojo/_base/Color */
2 2
3 declare namespace dojoColor {
3 declare namespace Color {
4 4 type ColorValue = [number, number, number];
5 5 type ColorValueAlpha = [number, number, number, number];
6 6
@@ -264,6 +264,6 declare namespace dojoColor {
264 264
265 265 }
266 266
267 type dojoColor = dojoColor.Color;
268 declare const dojoColor: dojoColor.ColorConstructor;
269 export = dojoColor;
267 type Color = Color.Color;
268 declare const Color: Color.ColorConstructor;
269 export = Color;
@@ -1,5 +1,6
1 1 import DojoPromise = require("../promise/Promise");
2 2 import { PromiseCallback, PromiseErrback, PromiseProgback } from "../promise/Promise";
3 import declare = require("./declare");
3 4
4 5 /* dojo/_base/Deferred */
5 6
@@ -1,55 +1,51
1 1 import { GenericConstructor } from "../interfaces";
2 2
3 3 /* dojo/_base/array */
4 interface DojoArray {
5 /**
6 * Determines whether or not every item in arr satisfies the condition implemented by callback.
7 * @param {T[] | string} arr the array to iterate on. If a string, operates on individual characters.
8 * @param {Function | string} callback a function is invoked with three arguments: item, index, and
9 * array and returns true if the condition is met.
10 * @param {object} thisObj may be used to scope the call to callback
11 */
12 every<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
4
5 /**
6 * Determines whether or not every item in arr satisfies the condition implemented by callback.
7 * @param {T[] | string} arr the array to iterate on. If a string, operates on individual characters.
8 * @param {Function | string} callback a function is invoked with three arguments: item, index, and
9 * array and returns true if the condition is met.
10 * @param {object} thisObj may be used to scope the call to callback
11 */
12 export function every<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
13 13
14 /**
15 * Determines whether or not any item in arr satisfies the condition implemented by callback.
16 */
17 some<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
14 /**
15 * Determines whether or not any item in arr satisfies the condition implemented by callback.
16 */
17 export function some<T>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): boolean;
18 18
19 /**
20 * locates the last index of the provided value in the passed array. If the value is not found, -1
21 * is returned.
22 * @param {boolean} findLast Makes indexOf() work like lastIndexOf(). Used internally; not meant
23 * for external usage.
24 */
25 indexOf<T>(arr: T[], value: T, fromIndex?: number, findLast?: boolean): number;
19 /**
20 * locates the last index of the provided value in the passed array. If the value is not found, -1
21 * is returned.
22 * @param {boolean} findLast Makes indexOf() work like lastIndexOf(). Used internally; not meant
23 * for external usage.
24 */
25 export function indexOf<T>(arr: T[], value: T, fromIndex?: number, findLast?: boolean): number;
26 26
27 /**
28 * locates the first index of the provided value in the passed array. If the value is not found,
29 * -1 is returned.
30 */
31 lastIndexOf<T>(arr: T[], value: T, fromIndex?: number): number;
27 /**
28 * locates the first index of the provided value in the passed array. If the value is not found,
29 * -1 is returned.
30 */
31 export function lastIndexOf<T>(arr: T[], value: T, fromIndex?: number): number;
32 32
33 /**
34 * locates the last index of the provided value in the passed array. If the value is not found,
35 * -1 is returned.
36 */
37 forEach<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => void), thisObj?: Object): void;
33 /**
34 * locates the last index of the provided value in the passed array. If the value is not found,
35 * -1 is returned.
36 */
37 export function forEach<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => void), thisObj?: Object): void;
38 38
39 /**
40 * for every item in arr, callback is invoked. Return values are ignored. If you want to break
41 * out of the loop, consider using array.every() or array.some().
42 */
43 map<T, U>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => U), thisObj?: Object, Ctr?: GenericConstructor<U[]>): U[];
39 /**
40 * for every item in arr, callback is invoked. Return values are ignored. If you want to break
41 * out of the loop, consider using array.every() or array.some().
42 */
43 export function map<T, U>(arr: T[] | string, callback: string | ((item: T, idx: number, arr: T[]) => U), thisObj?: Object, Ctr?: GenericConstructor<U[]>): U[];
44 44
45 /**
46 * Returns a new Array with those items from arr that match the condition implemented by
47 * callback.
48 */
49 filter<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): T[];
45 /**
46 * Returns a new Array with those items from arr that match the condition implemented by
47 * callback.
48 */
49 export function filter<T>(arr: T[], callback: string | ((item: T, idx: number, arr: T[]) => boolean), thisObj?: Object): T[];
50 50
51 clearCache(): void;
52 }
53
54 declare const dojoArray: DojoArray;
55 export = dojoArray;
51 export function clearCache(): void;
@@ -10,4 +10,4 import"../query";
10 10 import "./xhr";
11 11 import "./fx";
12 12
13 export = dojo; No newline at end of file
13 export = dojo;
@@ -1,151 +1,154
1 1 import { ColorValue, ColorValueAlpha } from "./Color";
2 2 import { HasCache } from "../has";
3 interface Config {
4 /** Defaults to `false`. If set to `true`, ensures that Dojo provides
5 * extended debugging feedback via Firebug. If Firebug is not available
6 * on your platform, setting `isDebug` to `true` will force Dojo to
7 * pull in (and display) the version of Firebug Lite which is
8 * integrated into the Dojo distribution, thereby always providing a
9 * debugging/logging console when `isDebug` is enabled. Note that
10 * Firebug's `console.*` methods are ALWAYS defined by Dojo. If
11 * `isDebug` is false and you are on a platform without Firebug, these
12 * methods will be defined as no-ops.
13 */
14 isDebug: boolean;
3
4 declare namespace config {
5 interface Config {
6 /** Defaults to `false`. If set to `true`, ensures that Dojo provides
7 * extended debugging feedback via Firebug. If Firebug is not available
8 * on your platform, setting `isDebug` to `true` will force Dojo to
9 * pull in (and display) the version of Firebug Lite which is
10 * integrated into the Dojo distribution, thereby always providing a
11 * debugging/logging console when `isDebug` is enabled. Note that
12 * Firebug's `console.*` methods are ALWAYS defined by Dojo. If
13 * `isDebug` is false and you are on a platform without Firebug, these
14 * methods will be defined as no-ops.
15 */
16 isDebug: boolean;
15 17
16 /**
17 * The locale to assume for loading localized resources in this page,
18 * specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
19 * Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
20 * See the documentation for `dojo.i18n` and `dojo.requireLocalization`
21 * for details on loading localized resources. If no locale is specified,
22 * Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
23 * or `navigator.language` properties.
24 */
25 locale: string;
18 /**
19 * The locale to assume for loading localized resources in this page,
20 * specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt).
21 * Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`.
22 * See the documentation for `dojo.i18n` and `dojo.requireLocalization`
23 * for details on loading localized resources. If no locale is specified,
24 * Dojo assumes the locale of the user agent, according to `navigator.userLanguage`
25 * or `navigator.language` properties.
26 */
27 locale: string;
26 28
27 /**
28 * No default value. Specifies additional locales whose
29 * resources should also be loaded alongside the default locale when
30 * calls to `dojo.requireLocalization()` are processed.
31 */
32 extraLocale: string[];
29 /**
30 * No default value. Specifies additional locales whose
31 * resources should also be loaded alongside the default locale when
32 * calls to `dojo.requireLocalization()` are processed.
33 */
34 extraLocale: string[];
33 35
34 /**
35 * The directory in which `dojo.js` is located. Under normal
36 * conditions, Dojo auto-detects the correct location from which it
37 * was loaded. You may need to manually configure `baseUrl` in cases
38 * where you have renamed `dojo.js` or in which `<base>` tags confuse
39 * some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
40 * either the value of `djConfig.baseUrl` if one is provided or the
41 * auto-detected root if not. Other modules are located relative to
42 * this path. The path should end in a slash.
43 */
44 baseUrl: string;
36 /**
37 * The directory in which `dojo.js` is located. Under normal
38 * conditions, Dojo auto-detects the correct location from which it
39 * was loaded. You may need to manually configure `baseUrl` in cases
40 * where you have renamed `dojo.js` or in which `<base>` tags confuse
41 * some browsers (e.g. IE 6). The variable `dojo.baseUrl` is assigned
42 * either the value of `djConfig.baseUrl` if one is provided or the
43 * auto-detected root if not. Other modules are located relative to
44 * this path. The path should end in a slash.
45 */
46 baseUrl: string;
45 47
46 /**
47 * A map of module names to paths relative to `dojo.baseUrl`. The
48 * key/value pairs correspond directly to the arguments which
49 * `dojo.registerModulePath` accepts. Specifying
50 * `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
51 * of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
52 * modules may be configured via `djConfig.modulePaths`.
53 */
54 modulePaths: { [mid: string]: string };
48 /**
49 * A map of module names to paths relative to `dojo.baseUrl`. The
50 * key/value pairs correspond directly to the arguments which
51 * `dojo.registerModulePath` accepts. Specifying
52 * `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent
53 * of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple
54 * modules may be configured via `djConfig.modulePaths`.
55 */
56 modulePaths: { [mid: string]: string };
55 57
56 /**
57 * Adds a callback via dojo/ready. Useful when Dojo is added after
58 * the page loads and djConfig.afterOnLoad is true. Supports the same
59 * arguments as dojo/ready. When using a function reference, use
60 * `djConfig.addOnLoad = function(){};`. For object with function name use
61 * `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
62 * function reference use
63 * `djConfig.addOnLoad = [myObject, function(){}];`
64 */
65 addOnLoad: () => void | [any, string];
58 /**
59 * Adds a callback via dojo/ready. Useful when Dojo is added after
60 * the page loads and djConfig.afterOnLoad is true. Supports the same
61 * arguments as dojo/ready. When using a function reference, use
62 * `djConfig.addOnLoad = function(){};`. For object with function name use
63 * `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
64 * function reference use
65 * `djConfig.addOnLoad = [myObject, function(){}];`
66 */
67 addOnLoad: () => void | [any, string];
66 68
67 /**
68 * Run the parser after the page is loaded
69 */
70 parseOnLoad: boolean;
69 /**
70 * Run the parser after the page is loaded
71 */
72 parseOnLoad: boolean;
71 73
72 /**
73 * An array of module names to be loaded immediately after dojo.js has been included
74 * in a page.
75 */
76 require: string[];
74 /**
75 * An array of module names to be loaded immediately after dojo.js has been included
76 * in a page.
77 */
78 require: string[];
77 79
78 /**
79 * Default duration, in milliseconds, for wipe and fade animations within dijits.
80 * Assigned to dijit.defaultDuration.
81 */
82 defaultDuration: number;
80 /**
81 * Default duration, in milliseconds, for wipe and fade animations within dijits.
82 * Assigned to dijit.defaultDuration.
83 */
84 defaultDuration: number;
83 85
84 /**
85 * Used by some modules to configure an empty iframe. Used by dojo/io/iframe and
86 * dojo/back, and dijit/popup support in IE where an iframe is needed to make sure native
87 * controls do not bleed through the popups. Normally this configuration variable
88 * does not need to be set, except when using cross-domain/CDN Dojo builds.
89 * Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
90 * to the path on your domain your copy of blank.html.
91 */
92 dojoBlankHtmlUrl: string;
86 /**
87 * Used by some modules to configure an empty iframe. Used by dojo/io/iframe and
88 * dojo/back, and dijit/popup support in IE where an iframe is needed to make sure native
89 * controls do not bleed through the popups. Normally this configuration variable
90 * does not need to be set, except when using cross-domain/CDN Dojo builds.
91 * Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
92 * to the path on your domain your copy of blank.html.
93 */
94 dojoBlankHtmlUrl: string;
93 95
94 /**
95 * Set this to true to enable publishing of topics for the different phases of
96 * IO operations. Publishing is done via dojo/topic.publish(). See dojo/main.__IoPublish for a list
97 * of topics that are published.
98 */
99 ioPublish: boolean;
96 /**
97 * Set this to true to enable publishing of topics for the different phases of
98 * IO operations. Publishing is done via dojo/topic.publish(). See dojo/main.__IoPublish for a list
99 * of topics that are published.
100 */
101 ioPublish: boolean;
100 102
101 /**
102 * If set to a value that evaluates to true such as a string or array and
103 * isDebug is true and Firebug is not available or running, then it bypasses
104 * the creation of Firebug Lite allowing you to define your own console object.
105 */
106 useCustomLogger: any;
103 /**
104 * If set to a value that evaluates to true such as a string or array and
105 * isDebug is true and Firebug is not available or running, then it bypasses
106 * the creation of Firebug Lite allowing you to define your own console object.
107 */
108 useCustomLogger: any;
107 109
108 /**
109 * Array containing the r, g, b components used as transparent color in dojo.Color;
110 * if undefined, ColorValue (white) will be used.
111 */
112 transparentColor: ColorValue | ColorValueAlpha;
110 /**
111 * Array containing the r, g, b components used as transparent color in dojo.Color;
112 * if undefined, ColorValue (white) will be used.
113 */
114 transparentColor: ColorValue | ColorValueAlpha;
113 115
114 /**
115 * Defines dependencies to be used before the loader has been loaded.
116 * When provided, they cause the loader to execute require(deps, callback)
117 * once it has finished loading. Should be used with callback.
118 */
119 deps: () => string[] | string[];
116 /**
117 * Defines dependencies to be used before the loader has been loaded.
118 * When provided, they cause the loader to execute require(deps, callback)
119 * once it has finished loading. Should be used with callback.
120 */
121 deps: () => string[] | string[];
120 122
121 /**
122 * Defines the cached has API variables
123 */
124 hasCache: HasCache;
123 /**
124 * Defines the cached has API variables
125 */
126 hasCache: HasCache;
125 127
126 /**
127 * Defines a callback to be used when dependencies are defined before
128 * the loader has been loaded. When provided, they cause the loader to
129 * execute require(deps, callback) once it has finished loading.
130 */
131 callback: (...args: any[]) => void;
128 /**
129 * Defines a callback to be used when dependencies are defined before
130 * the loader has been loaded. When provided, they cause the loader to
131 * execute require(deps, callback) once it has finished loading.
132 */
133 callback: (...args: any[]) => void;
132 134
133 /**
134 * Whether deferred instrumentation should be loaded or included
135 * in builds.
136 */
137 deferredInstrumentation: boolean;
135 /**
136 * Whether deferred instrumentation should be loaded or included
137 * in builds.
138 */
139 deferredInstrumentation: boolean;
138 140
139 /**
140 * Whether the deferred instrumentation should be used.
141 *
142 * * `"report-rejections"`: report each rejection as it occurs.
143 * * `true` or `1` or `"report-unhandled-rejections"`: wait 1 second
144 * in an attempt to detect unhandled rejections.
145 */
146 useDeferredInstrumentation: string | boolean | number;
141 /**
142 * Whether the deferred instrumentation should be used.
143 *
144 * * `"report-rejections"`: report each rejection as it occurs.
145 * * `true` or `1` or `"report-unhandled-rejections"`: wait 1 second
146 * in an attempt to detect unhandled rejections.
147 */
148 useDeferredInstrumentation: string | boolean | number;
149 }
150
147 151 }
148 152
149 type dojoConfig = Config;
150 declare const dojoConfig: Config;
151 export = dojoConfig; No newline at end of file
153 declare const config: config.Config;
154 export = config;
@@ -1,49 +1,47
1 1 import { Handle } from "../interfaces";
2 2
3 interface Connect {
4 /**
5 * TODO: Type this better
6 */
7 _keypress(object: any, listener: EventListener): Handle;
3 /**
4 * TODO: Type this better
5 */
6 export function _keypress(object: any, listener: EventListener): Handle;
8 7
9 /**
10 * `dojo.connect` is a deprecated event handling and delegation method in
11 * Dojo. It allows one function to "listen in" on the execution of
12 * any other, triggering the second whenever the first is called. Many
13 * listeners may be attached to a function, and source functions may
14 * be either regular function calls or DOM events.
15 */
16 connect(obj: any, event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
17 connect(event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
8 /**
9 * `dojo.connect` is a deprecated event handling and delegation method in
10 * Dojo. It allows one function to "listen in" on the execution of
11 * any other, triggering the second whenever the first is called. Many
12 * listeners may be attached to a function, and source functions may
13 * be either regular function calls or DOM events.
14 */
15 export function connect(obj: any, event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
16 export function connect(event: string, context: any, method: EventListener | string, dontFix?: boolean): Handle;
18 17
19 /**
20 * Remove a link created by dojo.connect.
21 */
22 disconnect(handle: Handle): void;
18 /**
19 * Remove a link created by dojo.connect.
20 */
21 export function disconnect(handle: Handle): void;
23 22
24 /**
25 * Attach a listener to a named topic. The listener function is invoked whenever the
26 * named topic is published (see: dojo.publish).
27 * Returns a handle which is needed to unsubscribe this listener.
28 */
29 subscribe(topic: string, context: any, method: EventListener): Handle;
23 /**
24 * Attach a listener to a named topic. The listener function is invoked whenever the
25 * named topic is published (see: dojo.publish).
26 * Returns a handle which is needed to unsubscribe this listener.
27 */
28 export function subscribe(topic: string, context: any, method: EventListener): Handle;
30 29
31 /**
32 * Invoke all listener method subscribed to topic.
33 */
34 publish(topic: string, args: any[]): boolean;
30 /**
31 * Invoke all listener method subscribed to topic.
32 */
33 export function publish(topic: string, args: any[]): boolean;
35 34
36 /**
37 * Ensure that every time obj.event() is called, a message is published
38 * on the topic. Returns a handle which can be passed to
39 * dojo.disconnect() to disable subsequent automatic publication on
40 * the topic.
41 */
42 connectPublisher(topic: string, obj: any, method: string): Handle;
43 connectPublisher(topic: string, method: EventListener): Handle;
35 /**
36 * Ensure that every time obj.event() is called, a message is published
37 * on the topic. Returns a handle which can be passed to
38 * dojo.disconnect() to disable subsequent automatic publication on
39 * the topic.
40 */
41 export function connectPublisher(topic: string, obj: any, method: string): Handle;
42 export function connectPublisher(topic: string, method: EventListener): Handle;
44 43
45 /**
46 * Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
47 */
48 isCopyKey(e: Event): boolean;
49 } No newline at end of file
44 /**
45 * Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
46 */
47 export function isCopyKey(e: Event): boolean;
@@ -1,10 +1,11
1 declare namespace declare {
2 /* dojo/_base/declare */
1 declare module "./kernel" {
2 interface Dojo {
3 declare: declare.Declare;
4 safeMixin: typeof declare.safeMixin;
5 }
6 }
3 7
4 /**
5 * dojo/_base/declare() returns a constructor `C`. `new C()` returns an Object with the following
6 * methods, in addition to the methods and properties specified via the arguments passed to declare().
7 */
8 declare namespace declare {
8 9 interface DeclareCreatedObject {
9 10 declaredClass: string;
10 11
@@ -99,9 +100,6 declare namespace declare {
99 100 createSubclass<U>(mixins: any, props: U): DeclareConstructor<T & U>;
100 101 }
101 102
102 /**
103 * Create a feature-rich constructor from compact notation.
104 */
105 103 interface Declare {
106 104 <A, B, C, D>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>, DeclareConstructor<D>]): DeclareConstructor<A & B & C & D>;
107 105 <A, B, C>(superClass: [DeclareConstructor<A>, DeclareConstructor<B>, DeclareConstructor<C>]): DeclareConstructor<A & B & C>;
@@ -1,22 +1,21
1 1 /* dojo/_base/event */
2 2
3 3 /**
4 * @module
4 5 * This module defines dojo DOM event API. Usually you should use dojo/on, and evt.stopPropagation() +
5 6 * evt.preventDefault(), rather than this module.
6 7 */
7 interface EventModule {
8 /**
9 * normalizes properties on the event object including event
10 * bubbling methods, keystroke normalization, and x/y positions
11 */
12 fix(evt: Event, sender: Element): Event;
8
13 9
14 /**
15 * prevents propagation and clobbers the default action of the
16 * passed event
17 */
18 stop(evt: Event): void;
19 }
10 /**
11 * normalizes properties on the event object including event
12 * bubbling methods, keystroke normalization, and x/y positions
13 */
14 export declare function fix(evt: Event, sender: Element): Event;
20 15
21 declare const dojoEvent: EventModule;
22 export = dojoEvent;
16 /**
17 * prevents propagation and clobbers the default action of the
18 * passed event
19 */
20 export declare function stop(evt: Event): void;
21
@@ -1,218 +1,215
1 1 import Evented = require("../Evented");
2 2
3 declare namespace fx {
4 /* dojo/_base/fx */
3 /* dojo/_base/fx */
4
5 export interface _Line {
6 /**
7 * Returns the point on the line
8 * @param {number} n a floating point number greater than 0 and less than 1
9 */
10 getValue(n: number): number;
11 }
12
13 /**
14 * Object used to generate values from a start value to an end value
15 */
16 export interface LineConstructor {
17 new(start: number, end: number): _Line;
18
19 prototype: _Line;
20 }
21
22 export interface EasingFunction {
23 (n?: number): number;
24 }
25
26 export interface Animation extends Evented {
27 /**
28 * The time in milliseconds the animation will take to run
29 */
30 duration: number;
31
32 /**
33 * A two element array of start and end values, or a `_Line` instance to be
34 * used in the Animation.
35 */
36 curve: _Line | [number, number];
37
38 /**
39 * A Function to adjust the acceleration (or deceleration) of the progress
40 * across a _Line
41 */
42 easing?: EasingFunction;
43
44 /**
45 * The number of times to loop the animation
46 */
47 repeat: number;
5 48
6 interface Line {
7 /**
8 * Returns the point on the line
9 * @param {number} n a floating point number greater than 0 and less than 1
10 */
11 getValue(n: number): number;
12 }
49 /**
50 * the time in milliseconds to wait before advancing to next frame
51 * (used as a fps timer: 1000/rate = fps)
52 */
53 rate: number;
54
55 /**
56 * The time in milliseconds to wait before starting animation after it
57 * has been .play()'ed
58 */
59 delay?: number;
60
61 /**
62 * Synthetic event fired before a Animation begins playing (synchronous)
63 */
64 beforeBegin?: Event;
65
66 /**
67 * Synthetic event fired as a Animation begins playing (useful?)
68 */
69 onBegin?: Event;
70
71 /**
72 * Synthetic event fired at each interval of the Animation
73 */
74 onAnimate?: Event;
75
76 /**
77 * Synthetic event fired after the final frame of the Animation
78 */
79 onEnd?: Event;
80
81 /**
82 * Synthetic event fired any time the Animation is play()'ed
83 */
84 onPlay?: Event;
85
86 /**
87 * Synthetic event fired when the Animation is paused
88 */
89 onPause?: Event;
90
91 /**
92 * Synthetic event fires when the Animation is stopped
93 */
94 onStop?: Event;
95
96 _percent: number;
97 _startRepeatCount: number;
98 _getStep(): number;
99
100 /**
101 * Convenience function. Fire event "evt" and pass it the
102 * arguments specified in "args".
103 */
104 _fire(evt: Event, args?: any[]): this;
13 105
14 106 /**
15 * Object used to generate values from a start value to an end value
107 * Start the animation.
16 108 */
17 interface LineConstructor {
18 new(start: number, end: number): Line;
19 }
20
21 interface EasingFunction {
22 (n?: number): number;
23 }
24
25 interface Animation extends Evented {
26 /**
27 * The time in milliseconds the animation will take to run
28 */
29 duration: number;
30
31 /**
32 * A two element array of start and end values, or a `_Line` instance to be
33 * used in the Animation.
34 */
35 curve: Line | [number, number];
36
37 /**
38 * A Function to adjust the acceleration (or deceleration) of the progress
39 * across a _Line
40 */
41 easing?: EasingFunction;
109 play(delay?: number, gotoStart?: boolean): this;
42 110
43 /**
44 * The number of times to loop the animation
45 */
46 repeat: number;
47
48 /**
49 * the time in milliseconds to wait before advancing to next frame
50 * (used as a fps timer: 1000/rate = fps)
51 */
52 rate: number;
111 _play(gotoStart?: boolean): this;
53 112
54 /**
55 * The time in milliseconds to wait before starting animation after it
56 * has been .play()'ed
57 */
58 delay?: number;
59
60 /**
61 * Synthetic event fired before a Animation begins playing (synchronous)
62 */
63 beforeBegin?: Event;
64
65 /**
66 * Synthetic event fired as a Animation begins playing (useful?)
67 */
68 onBegin?: Event;
69
70 /**
71 * Synthetic event fired at each interval of the Animation
72 */
73 onAnimate?: Event;
113 /**
114 * Pauses a running animation.
115 */
116 pause(): this;
74 117
75 /**
76 * Synthetic event fired after the final frame of the Animation
77 */
78 onEnd?: Event;
79
80 /**
81 * Synthetic event fired any time the Animation is play()'ed
82 */
83 onPlay?: Event;
84
85 /**
86 * Synthetic event fired when the Animation is paused
87 */
88 onPause?: Event;
89
90 /**
91 * Synthetic event fires when the Animation is stopped
92 */
93 onStop?: Event;
94
95 _precent: number;
96 _startRepeatCount: number;
97 _getStep(): number;
98
99 /**
100 * Convenience function. Fire event "evt" and pass it the
101 * arguments specified in "args".
102 */
103 _fire(evt: Event, args?: any[]): this;
118 /**
119 * Sets the progress of the animation.
120 */
121 gotoPercent(precent: number, andPlay?: boolean): this;
104 122
105 /**
106 * Start the animation.
107 */
108 play(delay?: number, gotoStart?: boolean): this;
109
110 _play(gotoStart?: boolean): this;
111
112 /**
113 * Pauses a running animation.
114 */
115 pause(): this;
116
117 /**
118 * Sets the progress of the animation.
119 */
120 gotoPercent(precent: number, andPlay?: boolean): this;
123 /**
124 * Stops a running animation.
125 */
126 stop(gotoEnd?: boolean): Animation;
121 127
122 /**
123 * Stops a running animation.
124 */
125 stop(gotoEnd?: boolean): Animation;
126
127 /**
128 * cleanup the animation
129 */
130 destroy(): void;
131
132 /**
133 * Returns a string token representation of the status of
134 * the animation, one of: "paused", "playing", "stopped"
135 */
136 status(): string;
137
138 _cycle(): Animation;
139 _clearTimer(): void;
140 _startTimer(): void;
141 _stopTimer(): void;
142 }
128 /**
129 * cleanup the animation
130 */
131 destroy(): void;
143 132
144 133 /**
145 * A generic animation class that fires callbacks into its handlers
146 * object at various states.
134 * Returns a string token representation of the status of
135 * the animation, one of: "paused", "playing", "stopped"
147 136 */
148 interface AnimationConstructor {
149 new(args: any): Animation;
150 prototype: Animation;
151 }
137 status(): string;
152 138
153 interface AnimationCallback {
154 (node: HTMLElement): void;
155 }
156
157 interface FadeArguments {
158 node: HTMLElement | string;
159 duration?: number;
160 easing?: EasingFunction;
139 _cycle(): Animation;
140 _clearTimer(): void;
141 _startTimer(): void;
142 _stopTimer(): void;
143 }
161 144
162 start?: Function;
163 end?: Function;
164 }
145 /**
146 * A generic animation class that fires callbacks into its handlers
147 * object at various states.
148 */
149 export interface AnimationConstructor {
150 new(args: any): Animation;
151 prototype: Animation;
152 }
165 153
166 interface AnimationArgumentsProperties {
167 [name: string]: any;
168 }
154 export interface AnimationCallback {
155 (node: HTMLElement): void;
156 }
169 157
170 interface AnimationArguments extends FadeArguments {
171 properties?: AnimationArgumentsProperties;
172 onEnd?: AnimationCallback;
173 }
158 export interface FadeArguments {
159 node: HTMLElement | string;
160 duration?: number;
161 easing?: EasingFunction;
174 162
175 interface Fx {
176 _Line: LineConstructor;
163 start?: Function;
164 end?: Function;
165 }
177 166
178 Animation: AnimationConstructor;
179
180 _fade(args: any): Animation;
167 export interface AnimationArgumentsProperties {
168 [name: string]: any;
169 }
181 170
182 /**
183 * Returns an animation that will fade node defined in 'args' from
184 * its current opacity to fully opaque.
185 */
186 fadeIn(args: FadeArguments): Animation;
171 export interface AnimationArguments extends FadeArguments {
172 properties?: AnimationArgumentsProperties;
173 onEnd?: AnimationCallback;
174 }
175
176
177 export const _Line: LineConstructor;
187 178
188 /**
189 * Returns an animation that will fade node defined in 'args'
190 * from its current opacity to fully transparent.
191 */
192 fadeOut(args: FadeArguments): Animation;
179 export const Animation: AnimationConstructor;
180
181 export function _fade(args: any): Animation;
193 182
194 _defaultEasing(n?: number): number;
183 /**
184 * Returns an animation that will fade node defined in 'args' from
185 * its current opacity to fully opaque.
186 */
187 export function fadeIn(args: FadeArguments): Animation;
195 188
196 /**
197 * Returns an animation that will transition the properties of
198 * node defined in `args` depending how they are defined in
199 * `args.properties`
200 */
201 animateProperty(args: AnimationArguments): Animation;
189 /**
190 * Returns an animation that will fade node defined in 'args'
191 * from its current opacity to fully transparent.
192 */
193 export function fadeOut(args: FadeArguments): Animation;
194
195 export function _defaultEasing(n?: number): number;
202 196
203 /**
204 * A simpler interface to `animateProperty()`, also returns
205 * an instance of `Animation` but begins the animation
206 * immediately, unlike nearly every other Dojo animation API.
207 */
208 anim(
209 node: HTMLElement | string,
210 properties: { [name: string]: any },
211 duration?: number,
212 easing?: Function,
213 onEnd?: AnimationCallback,
214 delay?: number): Animation;
215 }
216 }
217 declare const fx: fx.Fx;
218 export = fx;
197 /**
198 * Returns an animation that will transition the properties of
199 * node defined in `args` depending how they are defined in
200 * `args.properties`
201 */
202 export function animateProperty(args: AnimationArguments): Animation;
203
204 /**
205 * A simpler interface to `animateProperty()`, also returns
206 * an instance of `Animation` but begins the animation
207 * immediately, unlike nearly every other Dojo animation API.
208 */
209 export function anim(
210 node: HTMLElement | string,
211 properties: { [name: string]: any },
212 duration?: number,
213 easing?: Function,
214 onEnd?: AnimationCallback,
215 delay?: number): Animation;
@@ -1,5 +1,5
1 1 /* dojo/_base/kernel */
2 import Config = require('./config');
2 import { Config } from './config';
3 3
4 4 declare namespace dojo {
5 5 interface Dijit {
@@ -12,8 +12,7 declare namespace dojo {
12 12 interface Dojo {
13 13 config: Config;
14 14 global: any;
15
16 // TODO: dojot, dojox
15
17 16 dijit: Dijit;
18 17 dojox: Dojox;
19 18
General Comments 0
You need to be logged in to leave comments. Login now