From f78ba138f0eebaa4da067c883afb42f97380e99a Mon Sep 17 00:00:00 2001 From: armorik83 Date: Tue, 16 Dec 2014 12:32:06 +0900 Subject: [PATCH 1/7] add log4js-node --- log4js-node/log4js-node-tests.ts | 27 +++++++++++++++ log4js-node/log4js-node.d.ts | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 log4js-node/log4js-node-tests.ts create mode 100644 log4js-node/log4js-node.d.ts diff --git a/log4js-node/log4js-node-tests.ts b/log4js-node/log4js-node-tests.ts new file mode 100644 index 000000000..44bebeb1f --- /dev/null +++ b/log4js-node/log4js-node-tests.ts @@ -0,0 +1,27 @@ +/// +import log4js = require('log4js'); + +log4js.addAppender(log4js.appenders.file('logs/cheese.log'), 'cheese'); + +var logger = log4js.getLogger('cheese'); +logger.setLevel('ERROR'); + +logger.trace('Entering cheese testing'); +logger.debug('Got cheese.'); +logger.info('Cheese is Gouda.'); +logger.warn('Cheese is quite smelly.'); +logger.error('Cheese is too ripe!'); +logger.fatal('Cheese was breeding ground for listeria.'); + +var cb = () => {}; +log4js.shutdown(cb); + +log4js.configure({ + appenders: [ + { type: 'console' }, + { type: 'file', filename: 'logs/cheese.log', category: 'cheese' } + ] +}); + +var defaultLogger = log4js.getDefaultLogger(); +defaultLogger.debug('Got cheese.'); \ No newline at end of file diff --git a/log4js-node/log4js-node.d.ts b/log4js-node/log4js-node.d.ts new file mode 100644 index 000000000..cdfc120b4 --- /dev/null +++ b/log4js-node/log4js-node.d.ts @@ -0,0 +1,57 @@ +// Type definitions for log4js-node +// Project: https://github.com/nomiddlename/log4js-node +// Definitions by: Kentaro Okuno +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "log4js" { + /** + * Get a logger instance. Instance is cached on categoryName level. + * + * @param {String} [categoryName] name of category to log to. + * @returns {Logger} instance of logger for the category + * @static + */ + export function getLogger(categoryName?: string): Logger; + + /** + * Get the default logger instance. + * @returns {Logger} instance of default logger + * @static + */ + export function getDefaultLogger(): Logger; + + /** + * args are appender, then zero or more categories + * + * @param {*[]} appenders + * @returns {void} + * @static + */ + export function addAppender(...appenders: any[]): void; + + /** + * Shutdown all log appenders. This will first disable all writing to appenders + * and then call the shutdown function each appender. + * + * @params {Function} cb - The callback to be invoked once all appenders have + * shutdown. If an error occurs, the callback will be given the error object + * as the first argument. + * @returns {void} + */ + export function shutdown(cb: Function): void; + + export function configure(config: any, options?: any): void; + + export var appenders: any; + + export interface Logger { + setLevel(level: string): void; + + trace(message: string): void; + debug(message: string): void; + info(message: string): void; + warn(message: string): void; + error(message: string): void; + fatal(message: string): void; + } +} From 3890863040cf46671a9def2107bfd06b09492aad Mon Sep 17 00:00:00 2001 From: Bryan Nicholls Date: Fri, 19 Dec 2014 14:36:23 -0500 Subject: [PATCH 2/7] updated joyride typings to have optional setting parameters --- jquery.joyride/jquery.joyride.d.ts | 72 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/jquery.joyride/jquery.joyride.d.ts b/jquery.joyride/jquery.joyride.d.ts index 8afc2455a..202fad376 100644 --- a/jquery.joyride/jquery.joyride.d.ts +++ b/jquery.joyride/jquery.joyride.d.ts @@ -13,43 +13,43 @@ interface JoyrideTemplate { * Link template * @member {string} */ - link: string; + link?: string; /** * Timer template * @member {string} */ - timer: string; + timer?: string; /** * Tip template * @member {string} */ - tip: string; + tip?: string; /** * Wrapper template * @member {string} */ - wrapper: string; + wrapper?: string; /** * Button template * @member {string} */ - button: string; + button?: string; /** * Modal template * @member {string} */ - modal: string; + modal?: string; /** * Exposed Cover template * @member {string} */ - exposeCover: string; + exposeCover?: string; } interface JoyrideOptions { @@ -57,133 +57,133 @@ interface JoyrideOptions { * Version * @member {string} */ - version: string; + version?: string; /** * 'top' or 'bottom' in relation to parent * @member {string} */ - tipLocation: string; + tipLocation?: string; /** * override on a per tooltip bases * @member {any} */ - nubPosition: any; + nubPosition?: any; /** * whether to scroll to tips * @member {boolean} */ - scroll: boolean; + scroll?: boolean; /** * Page scrolling speed in ms * @member {number} */ - scrollSpeed: number; + scrollSpeed?: number; /** * 0 = off, all other numbers = time(ms) * @member {number} */ - timer: number; + timer?: number; /** * true or false - false tour starts when restart called * @member {boolean} */ - autoStart: boolean; + autoStart?: boolean; /** * true/false to start timer on first click * @member {boolean} */ - startTimerOnClick: boolean; + startTimerOnClick?: boolean; /** * the index of the tooltip you want to start on (index of the li) * @member {number} */ - startOffset: number; + startOffset?: number; /** * true/false for next button visibility * @member {boolean} */ - nextButton: boolean; + nextButton?: boolean; /** * 'pop' or 'fade' in each tip * @member {string} */ - tipAnimation: string; + tipAnimation?: string; /** * array of indexes where to pause the tour after * @member {any[]} */ - pauseAfter: any[]; + pauseAfter?: any[]; /** * if 'fade'- speed in ms of transition * @member {number} */ - tipAnimationFadeSpeed: number; + tipAnimationFadeSpeed?: number; /** * true/false for whether cookies are used * @member {boolean} */ - cookieMonster: boolean; + cookieMonster?: boolean; /** * choose your own cookie name * member {string} */ - cookieName: string; + cookieName?: string; /** * Will this cookie be attached to a domain, ie. '.notableapp.com' * @member {any} */ - cookieDomain: any; + cookieDomain?: any; /** * Set to '/' if you want the cookie for the whole website * @member {any} */ - cookiePath: any; + cookiePath?: any; /** * true or false to control whether localstorage is used * @member {boolean} */ - localStorage: boolean; + localStorage?: boolean; /** * Keyname in localstorage @member {string} */ - localStorageKey: string; + localStorageKey?: string; /** * Where the tip be attached if not inline * @member {HTMLElement} */ - tipContainer: HTMLElement; + tipContainer?: HTMLElement; /** * Whether to cover page with modal during the tour * @member {boolean} */ - modal: boolean; + modal?: boolean; /** - * Whether to expose the elements at each step in the tour (requires modal:true) + * Whether to expose the elements at each step in the tour (requires modal?:true) * @member {boolean} */ - expose: boolean; + expose?: boolean; /** * A method to call after an element has been exposed @@ -192,7 +192,7 @@ interface JoyrideOptions { * @param {JQuery} nextTip Tip object * @param {JQuery} el Element */ - postExposeCallback: (index: number, nextTip: JQuery, el?: JQuery) => void; + postExposeCallback?: (index?: number, nextTip?: JQuery, el?: JQuery) => void; /** * A method to call before the tour starts (passed index, tip, and cloned exposed element) @@ -201,7 +201,7 @@ interface JoyrideOptions { * @param {JQuery} currentTip Current Tip object * @param {JQuery} el Element */ - preRideCallback: (index: number, currentTip: JQuery, el?: JQuery) => void; + preRideCallback?: (index?: number, currentTip?: JQuery, el?: JQuery) => void; /** * a method to call once the tour closes @@ -210,7 +210,7 @@ interface JoyrideOptions { * @param {JQuery} currentTip Current Tip object * @param {boolean} isAborted Is Aborted? */ - postRideCallback: (index: number, currentTip: JQuery, isAborted?: boolean) => void; + postRideCallback?: (index?: number, currentTip?: JQuery, isAborted?: boolean) => void; /** * A method to call after each step @@ -219,7 +219,7 @@ interface JoyrideOptions { * @param {JQuery} currentTip Current Tip object * @param {boolean} isAborted Is Aborted? */ - postStepCallback: (index: number, currentTip: JQuery, isAborted?: boolean) => void; + postStepCallback?: (index?: number, currentTip?: JQuery, isAborted?: boolean) => void; /** * A method to call before each step @@ -228,13 +228,13 @@ interface JoyrideOptions { * @param {JQuery} nextTip Tip object * @param {JQuery} el Element */ - preStepCallback: (index: number, nextTip: JQuery, el?: JQuery) => void; + preStepCallback?: (index?: number, nextTip?: JQuery, el?: JQuery) => void; /** * HTML segments for tip layout * @member {JoyrideTemplate} */ - template: JoyrideTemplate; + template?: JoyrideTemplate; } interface Joyride From c22650edabda628afb4286882fe283354bba2454 Mon Sep 17 00:00:00 2001 From: Derek Cicerone Date: Sat, 20 Dec 2014 13:07:29 -0500 Subject: [PATCH 3/7] Fix types for promises in selenium-webdriver The webdriver promises were recently made generic (that whole commit is actually pretty impressive!) but I think the definitions for the then methods are slightly incorrect. Looking at the original jsdoc (which I assume was imported from the original closure annotations) some edits appear to be necessary: 1. The return type of the success callback should match the returned promise's generic type. 2. The success callback can return a promise that will automatically be unwrapped. I also made some other housekeeping edits: * removed @param type information and @template since TypeScript puts type annotations directly in the code * my editor removes trailing whitespace and adds a newline at the EOF Once TypeScript 1.4 is out, these definitions can likely be simplified by using union types. --- selenium-webdriver/selenium-webdriver.d.ts | 110 +++++++++++++++------ 1 file changed, 82 insertions(+), 28 deletions(-) diff --git a/selenium-webdriver/selenium-webdriver.d.ts b/selenium-webdriver/selenium-webdriver.d.ts index a1b777d59..c4af933c9 100644 --- a/selenium-webdriver/selenium-webdriver.d.ts +++ b/selenium-webdriver/selenium-webdriver.d.ts @@ -505,10 +505,10 @@ declare module firefox { } declare module executors { - /** - * Creates a command executor that uses WebDriver's JSON wire protocol. - * @param url The server's URL, or a promise that will resolve to that URL. - * @returns {!webdriver.CommandExecutor} The new command executor. + /** + * Creates a command executor that uses WebDriver's JSON wire protocol. + * @param url The server's URL, or a promise that will resolve to that URL. + * @returns {!webdriver.CommandExecutor} The new command executor. */ function createExecutor(url: string): webdriver.CommandExecutor; function createExecutor(url: webdriver.promise.Promise): webdriver.CommandExecutor; @@ -1055,17 +1055,30 @@ declare module webdriver { /** * Registers listeners for when this instance is resolved. * - * @param {?(function(T): (R|webdriver.promise.Promise.))=} opt_callback The + * @param opt_callback The * function to call if this promise is successfully resolved. The function * should expect a single argument: the promise's resolved value. - * @param {?(function(*): (R|webdriver.promise.Promise.))=} opt_errback The + * @param opt_errback The * function to call if this promise is rejected. The function should expect * a single argument: the rejection reason. - * @return {!webdriver.promise.Promise.} A new promise which will be + * @return A new promise which will be * resolved with the result of the invoked callback. - * @template R */ - then(opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): Promise; + then(opt_callback?: (value: T) => Promise, opt_errback?: (error: any) => any): Promise; + + /** + * Registers listeners for when this instance is resolved. + * + * @param opt_callback The + * function to call if this promise is successfully resolved. The function + * should expect a single argument: the promise's resolved value. + * @param opt_errback The + * function to call if this promise is rejected. The function should expect + * a single argument: the rejection reason. + * @return A new promise which will be + * resolved with the result of the invoked callback. + */ + then(opt_callback?: (value: T) => R, opt_errback?: (error: any) => any): Promise; /** @@ -1161,17 +1174,30 @@ declare module webdriver { /** * Registers listeners for when this instance is resolved. * - * @param {?(function(T): (R|webdriver.promise.Promise.))=} opt_callback The + * @param opt_callback The * function to call if this promise is successfully resolved. The function * should expect a single argument: the promise's resolved value. - * @param {?(function(*): (R|webdriver.promise.Promise.))=} opt_errback The + * @param opt_errback The * function to call if this promise is rejected. The function should expect * a single argument: the rejection reason. - * @return {!webdriver.promise.Promise.} A new promise which will be + * @return A new promise which will be * resolved with the result of the invoked callback. - * @template R */ - then(opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): Promise; + then(opt_callback?: (value: T) => Promise, opt_errback?: (error: any) => any): Promise; + + /** + * Registers listeners for when this instance is resolved. + * + * @param opt_callback The + * function to call if this promise is successfully resolved. The function + * should expect a single argument: the promise's resolved value. + * @param opt_errback The + * function to call if this promise is rejected. The function should expect + * a single argument: the rejection reason. + * @return A new promise which will be + * resolved with the result of the invoked callback. + */ + then(opt_callback?: (value: T) => R, opt_errback?: (error: any) => any): Promise; /** @@ -1304,16 +1330,31 @@ declare module webdriver { * Registers listeners for when this instance is resolved. This function most * overridden by subtypes. * - * @param {Function=} opt_callback The function to call if this promise is + * @param opt_callback The function to call if this promise is * successfully resolved. The function should expect a single argument: the * promise's resolved value. - * @param {Function=} opt_errback The function to call if this promise is + * @param opt_errback The function to call if this promise is * rejected. The function should expect a single argument: the rejection * reason. - * @return {!webdriver.promise.Promise} A new promise which will be resolved + * @return A new promise which will be resolved * with the result of the invoked callback. */ - then(opt_callback?: (value: T) => any, opt_errback?: (error: any) => any): Promise; + then(opt_callback?: (value: T) => Promise, opt_errback?: (error: any) => any): Promise; + + /** + * Registers listeners for when this instance is resolved. This function most + * overridden by subtypes. + * + * @param opt_callback The function to call if this promise is + * successfully resolved. The function should expect a single argument: the + * promise's resolved value. + * @param opt_errback The function to call if this promise is + * rejected. The function should expect a single argument: the rejection + * reason. + * @return A new promise which will be resolved + * with the result of the invoked callback. + */ + then(opt_callback?: (value: T) => R, opt_errback?: (error: any) => any): Promise; /** @@ -1762,7 +1803,7 @@ declare module webdriver { module until { /** - * Defines a condition to + * Defines a condition to */ class Condition { /** @@ -3536,7 +3577,7 @@ declare module webdriver { * capabilities for the new session. * @param {webdriver.promise.ControlFlow=} opt_flow The control flow all driver * commands should execute under, including the initial session creation. - * Defaults to the {@link webdriver.promise.controlFlow() currently active} + * Defaults to the {@link webdriver.promise.controlFlow() currently active} * control flow. * @return {!webdriver.WebDriver} The driver for the newly created session. */ @@ -4554,17 +4595,30 @@ declare module webdriver { /** * Registers listeners for when this instance is resolved. * - * @param {?(function(T): (R|webdriver.promise.Promise.))=} opt_callback The + * @param opt_callback The * function to call if this promise is successfully resolved. The function * should expect a single argument: the promise's resolved value. - * @param {?(function(*): (R|webdriver.promise.Promise.))=} opt_errback The + * @param opt_errback The * function to call if this promise is rejected. The function should expect * a single argument: the rejection reason. - * @return {!webdriver.promise.Promise.} A new promise which will be + * @return A new promise which will be * resolved with the result of the invoked callback. - * @template R */ - then(opt_callback?: (value: WebElement) => any, opt_errback?: (error: any) => any): webdriver.promise.Promise; + then(opt_callback?: (value: WebElement) => webdriver.promise.Promise, opt_errback?: (error: any) => any): webdriver.promise.Promise; + + /** + * Registers listeners for when this instance is resolved. + * + * @param opt_callback The + * function to call if this promise is successfully resolved. The function + * should expect a single argument: the promise's resolved value. + * @param opt_errback The + * function to call if this promise is rejected. The function should expect + * a single argument: the rejection reason. + * @return A new promise which will be + * resolved with the result of the invoked callback. + */ + then(opt_callback?: (value: WebElement) => R, opt_errback?: (error: any) => any): webdriver.promise.Promise; /** @@ -4795,11 +4849,11 @@ declare module 'selenium-webdriver/chrome' { declare module 'selenium-webdriver/firefox' { export = firefox; -} +} declare module 'selenium-webdriver/executors' { export = executors; -} +} declare module 'selenium-webdriver' { export = webdriver; @@ -4807,4 +4861,4 @@ declare module 'selenium-webdriver' { declare module 'selenium-webdriver/testing' { export = testing; -} \ No newline at end of file +} From bb811116eb463705748fb0fac3ff3b7414693e48 Mon Sep 17 00:00:00 2001 From: Derek Cicerone Date: Sat, 20 Dec 2014 13:38:32 -0500 Subject: [PATCH 4/7] Fix unit tests --- selenium-webdriver/selenium-webdriver-tests.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/selenium-webdriver/selenium-webdriver-tests.ts b/selenium-webdriver/selenium-webdriver-tests.ts index 467a01d3b..73ea8561e 100644 --- a/selenium-webdriver/selenium-webdriver-tests.ts +++ b/selenium-webdriver/selenium-webdriver-tests.ts @@ -777,7 +777,7 @@ function TestWebElementPromise() { elementPromise.then(); elementPromise.then(function (element: webdriver.WebElement) { }); elementPromise.then(function (element: webdriver.WebElement) { }, function (error: any) { }); - elementPromise.then(function (element: webdriver.WebElement) { }, function (error: any) { }).then(function (result: string) { }); + elementPromise.then(function (element: webdriver.WebElement) { return "foo"; }, function (error: any) { }).then(function (result: string) { }); elementPromise.thenCatch(function (error: any) { }).then(function (value: any) { }); @@ -1029,10 +1029,9 @@ function TestPromiseClass() { var isPending: boolean = promise.isPending(); promise = promise.then(); - promise = promise.then(function( a: string ) { }); promise = promise.then(function( a: string ) { return 'cde'; }); - promise = promise.then(function( a: string ) {}, function( e: any) {}); - promise = promise.then(function (a: string) { }, function (e: any) { return 123; }); + promise = promise.then(function( a: string ) { return 'cde'; }, function( e: any) {}); + promise = promise.then(function( a: string ) { return 'cde'; }, function (e: any) { return 123; }); promise = promise.thenCatch(function (error: any) { }); @@ -1047,10 +1046,9 @@ function TestThenableClass() { var isPending: boolean = thenable.isPending(); thenable = thenable.then(); - thenable = thenable.then(function (a: string) { }); thenable = thenable.then(function (a: string) { return 'cde'; }); - thenable = thenable.then(function (a: string) { }, function (e: any) { }); - thenable = thenable.then(function (a: string) { }, function (e: any) { return 123; }); + thenable = thenable.then(function (a: string) { return 'cde'; }, function (e: any) { }); + thenable = thenable.then(function (a: string) { return 'cde'; }, function (e: any) { return 123; }); thenable = thenable.thenCatch(function (error: any) { }); @@ -1158,4 +1156,4 @@ function TestTestingModule() { testing.afterEach(function () { }); -} \ No newline at end of file +} From b82c2571a91d901646e923d520c74d39d70fee15 Mon Sep 17 00:00:00 2001 From: bolkhovsky Date: Sat, 20 Dec 2014 23:49:26 +0300 Subject: [PATCH 5/7] fix Image layer; fix XYZ layer --- openlayers/openlayers.d.ts | 475 ++++++++++++++++++++++++------------- 1 file changed, 305 insertions(+), 170 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 6be401f71..69a8e92e5 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -97,180 +97,180 @@ declare module OpenLayers { export class Events { /** - * Method: attachToElement - * - * Parameters: - * element - {HTMLDOMElement} a DOM element to attach browser events to - */ - attachToElement(element: HTMLElement) : void; + * Method: attachToElement + * + * Parameters: + * element - {HTMLDOMElement} a DOM element to attach browser events to + */ + attachToElement(element: HTMLElement): void; - /** - * APIMethod: on - * Convenience method for registering listeners with a common scope. - * Internally, this method calls as shown in the examples - * below. - * - * Example use: - * (code) - * // register a single listener for the "loadstart" event - * events.on({"loadstart": loadStartListener}); - * - * // this is equivalent to the following - * events.register("loadstart", undefined, loadStartListener); - * - * // register multiple listeners to be called with the same `this` object - * events.on({ - * "loadstart": loadStartListener, - * "loadend": loadEndListener, - * scope: object - * }); - * - * // this is equivalent to the following - * events.register("loadstart", object, loadStartListener); - * events.register("loadend", object, loadEndListener); - * (end) - * - * Parameters: - * object - {Object} - */ - on(object: any) : void; + /** + * APIMethod: on + * Convenience method for registering listeners with a common scope. + * Internally, this method calls as shown in the examples + * below. + * + * Example use: + * (code) + * // register a single listener for the "loadstart" event + * events.on({"loadstart": loadStartListener}); + * + * // this is equivalent to the following + * events.register("loadstart", undefined, loadStartListener); + * + * // register multiple listeners to be called with the same `this` object + * events.on({ + * "loadstart": loadStartListener, + * "loadend": loadEndListener, + * scope: object + * }); + * + * // this is equivalent to the following + * events.register("loadstart", object, loadStartListener); + * events.register("loadend", object, loadEndListener); + * (end) + * + * Parameters: + * object - {Object} + */ + on(object: any): void; - /** - * APIMethod: register - * Register an event on the events object. - * - * When the event is triggered, the 'func' function will be called, in the - * context of 'obj'. Imagine we were to register an event, specifying an - * OpenLayers.Bounds Object as 'obj'. When the event is triggered, the - * context in the callback function will be our Bounds object. This means - * that within our callback function, we can access the properties and - * methods of the Bounds object through the "this" variable. So our - * callback could execute something like: - * : leftStr = "Left: " + this.left; - * - * or - * - * : centerStr = "Center: " + this.getCenterLonLat(); - * - * Parameters: - * type - {String} Name of the event to register - * obj - {Object} The object to bind the context to for the callback#. - * If no object is specified, default is the Events's 'object' property. - * func - {Function} The callback function. If no callback is - * specified, this function does nothing. - * priority - {Boolean|Object} If true, adds the new listener to the - * *front* of the events queue instead of to the end. - * - * Valid options for priority: - * extension - {Boolean} If true, then the event will be registered as - * extension event. Extension events are handled before all other - * events. - */ - register(type: string, obj: any, func: () => void, priority: boolean) : void; + /** + * APIMethod: register + * Register an event on the events object. + * + * When the event is triggered, the 'func' function will be called, in the + * context of 'obj'. Imagine we were to register an event, specifying an + * OpenLayers.Bounds Object as 'obj'. When the event is triggered, the + * context in the callback function will be our Bounds object. This means + * that within our callback function, we can access the properties and + * methods of the Bounds object through the "this" variable. So our + * callback could execute something like: + * : leftStr = "Left: " + this.left; + * + * or + * + * : centerStr = "Center: " + this.getCenterLonLat(); + * + * Parameters: + * type - {String} Name of the event to register + * obj - {Object} The object to bind the context to for the callback#. + * If no object is specified, default is the Events's 'object' property. + * func - {Function} The callback function. If no callback is + * specified, this function does nothing. + * priority - {Boolean|Object} If true, adds the new listener to the + * *front* of the events queue instead of to the end. + * + * Valid options for priority: + * extension - {Boolean} If true, then the event will be registered as + * extension event. Extension events are handled before all other + * events. + */ + register(type: string, obj: any, func: () => void, priority: boolean): void; - /** - * APIMethod: registerPriority - * Same as register() but adds the new listener to the *front* of the - * events queue instead of to the end. - * - * TODO: get rid of this in 3.0 - Decide whether listeners should be - * called in the order they were registered or in reverse order. - * - * - * Parameters: - * type - {String} Name of the event to register - * obj - {Object} The object to bind the context to for the callback#. - * If no object is specified, default is the Events's - * 'object' property. - * func - {Function} The callback function. If no callback is - * specified, this function does nothing. - */ - registerPriority(type: string, obj: any, func: () => void) : void; + /** + * APIMethod: registerPriority + * Same as register() but adds the new listener to the *front* of the + * events queue instead of to the end. + * + * TODO: get rid of this in 3.0 - Decide whether listeners should be + * called in the order they were registered or in reverse order. + * + * + * Parameters: + * type - {String} Name of the event to register + * obj - {Object} The object to bind the context to for the callback#. + * If no object is specified, default is the Events's + * 'object' property. + * func - {Function} The callback function. If no callback is + * specified, this function does nothing. + */ + registerPriority(type: string, obj: any, func: () => void): void; - /** - * APIMethod: un - * Convenience method for unregistering listeners with a common scope. - * Internally, this method calls as shown in the examples - * below. - * - * Example use: - * (code) - * // unregister a single listener for the "loadstart" event - * events.un({"loadstart": loadStartListener}); - * - * // this is equivalent to the following - * events.unregister("loadstart", undefined, loadStartListener); - * - * // unregister multiple listeners with the same `this` object - * events.un({ - * "loadstart": loadStartListener, - * "loadend": loadEndListener, - * scope: object - * }); - * - * // this is equivalent to the following - * events.unregister("loadstart", object, loadStartListener); - * events.unregister("loadend", object, loadEndListener); - * (end) - */ - un(object: any) : void; + /** + * APIMethod: un + * Convenience method for unregistering listeners with a common scope. + * Internally, this method calls as shown in the examples + * below. + * + * Example use: + * (code) + * // unregister a single listener for the "loadstart" event + * events.un({"loadstart": loadStartListener}); + * + * // this is equivalent to the following + * events.unregister("loadstart", undefined, loadStartListener); + * + * // unregister multiple listeners with the same `this` object + * events.un({ + * "loadstart": loadStartListener, + * "loadend": loadEndListener, + * scope: object + * }); + * + * // this is equivalent to the following + * events.unregister("loadstart", object, loadStartListener); + * events.unregister("loadend", object, loadEndListener); + * (end) + */ + un(object: any): void; - /** - * APIMethod: unregister - * - * Parameters: - * type - {String} - * obj - {Object} If none specified, defaults to this.object - * func - {Function} - */ - unregister(type: string, obj: any, func: () => void) : void; + /** + * APIMethod: unregister + * + * Parameters: + * type - {String} + * obj - {Object} If none specified, defaults to this.object + * func - {Function} + */ + unregister(type: string, obj: any, func: () => void): void; - /** - * Method: remove - * Remove all listeners for a given event type. If type is not registered, - * does nothing. - * - * Parameters: - * type - {String} - */ - remove(type: string) : void; + /** + * Method: remove + * Remove all listeners for a given event type. If type is not registered, + * does nothing. + * + * Parameters: + * type - {String} + */ + remove(type: string): void; - /** - * APIMethod: triggerEvent - * Trigger a specified registered event. - * - * Parameters: - * type - {String} - * evt - {Event || Object} will be passed to the listeners. - * - * Returns: - * {Boolean} The last listener return. If a listener returns false, the - * chain of listeners will stop getting called. - */ - triggerEvent(type: string, evt: Event) : boolean; + /** + * APIMethod: triggerEvent + * Trigger a specified registered event. + * + * Parameters: + * type - {String} + * evt - {Event || Object} will be passed to the listeners. + * + * Returns: + * {Boolean} The last listener return. If a listener returns false, the + * chain of listeners will stop getting called. + */ + triggerEvent(type: string, evt: Event): boolean; - /** - * Method: handleBrowserEvent - * Basically just a wrapper to the triggerEvent() function, but takes - * care to set a property 'xy' on the event with the current mouse - * position. - * - * Parameters: - * evt - {Event} - */ - handleBrowserEvent(evt: Event) : void; + /** + * Method: handleBrowserEvent + * Basically just a wrapper to the triggerEvent() function, but takes + * care to set a property 'xy' on the event with the current mouse + * position. + * + * Parameters: + * evt - {Event} + */ + handleBrowserEvent(evt: Event): void; - /** - * Method: getMousePosition - * - * Parameters: - * evt - {Event} - * - * Returns: - * {} The current xy coordinate of the mouse, adjusted - * for offsets - */ - getMousePosition(evt: Event) : Pixel; + /** + * Method: getMousePosition + * + * Parameters: + * evt - {Event} + * + * Returns: + * {} The current xy coordinate of the mouse, adjusted + * for offsets + */ + getMousePosition(evt: Event): Pixel; } export class Feature { @@ -1438,7 +1438,7 @@ declare module OpenLayers { /** * The element that contains the map (or an id for that element). */ - div: Object; + div: HTMLElement; /** * The map is currently being dragged. @@ -4558,8 +4558,143 @@ declare module OpenLayers { getFullRequestString(newParams: Object, altUrl: string): string; } - export class Image { - // TODO + export class Image extends Layer { + /** + * Property: isBaseLayer + * {Boolean} The layer is a base layer. Default is true. Set this property + * in the layer options + */ + isBaseLayer: boolean; + + /** + * Property: url + * {String} URL of the image to use + */ + url: string; + + /** + * Property: extent + * {} The image bounds in map units. This extent will + * also be used as the default maxExtent for the layer. If you wish + * to have a maxExtent that is different than the image extent, set the + * maxExtent property of the options argument (as with any other layer). + */ + extent: OpenLayers.Bounds; + + /** + * Property: size + * {} The image size in pixels + */ + size: OpenLayers.Size; + + /** + * Property: tile + * {} + */ + tile: OpenLayers.Tile.Image; + + /** + * Property: aspectRatio + * {Float} The ratio of height/width represented by a single pixel in the + * graphic + */ + aspectRatio: number; + + /** + * Constructor: OpenLayers.Layer.Image + * Create a new image layer + * + * Parameters: + * name - {String} A name for the layer. + * url - {String} Relative or absolute path to the image + * extent - {} The extent represented by the image + * size - {} The size (in pixels) of the image + * options - {Object} Hashtable of extra options to tag onto the layer + */ + constructor(name: string, url: string, extent: OpenLayers.Bounds, size: OpenLayers.Size, options: any); + + /** + * Method: destroy + * Destroy this layer + */ + destroy(): void; + + /** + * Method: clone + * Create a clone of this layer + * + * Parameters: + * obj - {Object} An optional layer (is this ever used?) + * + * Returns: + * {} An exact copy of this layer + */ + clone(obj?: any): OpenLayers.Layer.Image; + + /** + * APIMethod: setMap + * + * Parameters: + * map - {} + */ + setMap(map: OpenLayers.Map): void; + + /** + * Method: moveTo + * Create the tile for the image or resize it for the new resolution + * + * Parameters: + * bounds - {} + * zoomChanged - {Boolean} + * dragging - {Boolean} + */ + moveTo(bounds: OpenLayers.Bounds, zoomChanged: boolean, dragging: boolean): void; + + /** + * Set the tile size based on the map size. + */ + setTileSize(): void; + + /** + * Method: addTileMonitoringHooks + * This function takes a tile as input and adds the appropriate hooks to + * the tile so that the layer can keep track of the loading tiles. + * + * Parameters: + * tile - {} + */ + addTileMonitoringHooks(tile: OpenLayers.Tile): void; + + /** + * Method: removeTileMonitoringHooks + * This function takes a tile as input and removes the tile hooks + * that were added in . + * + * Parameters: + * tile - {} + */ + removeTileMonitoringHooks(tile: OpenLayers.Tile): void; + + /** + * APIMethod: setUrl + * + * Parameters: + * newUrl - {String} + */ + setUrl(newUrl: string): void; + + /** + * APIMethod: getURL + * The url we return is always the same (the image itself never changes) + * so we can ignore the bounds parameter (it will always be the same, + * anyways) + * + * Parameters: + * bounds - {} + */ + getURL(bounds: OpenLayers.Bounds): string; + + CLASS_NAME: string; } export class KaMap { // TODO @@ -4823,7 +4958,7 @@ declare module OpenLayers { * url - {String} * options - {Object} Hashtable of extra options to tag onto the layer */ - constructor(name: number, url: string, options: {}); + constructor(name: string, url: string, options?: any); /** * APIMethod: clone @@ -4835,7 +4970,7 @@ declare module OpenLayers { * Returns: * {} An exact clone of this OpenLayers.Layer.XYZ */ - clone(obj?: Object): Layer.XYZ; + clone(obj?: any): Layer.XYZ; /** * Method: getURL From afaa34304f74a2bfed53b0d6b2175fa828982412 Mon Sep 17 00:00:00 2001 From: Bryan Nicholls Date: Mon, 22 Dec 2014 07:25:57 -0500 Subject: [PATCH 6/7] function parameters should not be marked as optional --- jquery.joyride/jquery.joyride.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jquery.joyride/jquery.joyride.d.ts b/jquery.joyride/jquery.joyride.d.ts index 202fad376..872fa3557 100644 --- a/jquery.joyride/jquery.joyride.d.ts +++ b/jquery.joyride/jquery.joyride.d.ts @@ -180,7 +180,7 @@ interface JoyrideOptions { modal?: boolean; /** - * Whether to expose the elements at each step in the tour (requires modal?:true) + * Whether to expose the elements at each step in the tour (requires modal:true) * @member {boolean} */ expose?: boolean; @@ -192,7 +192,7 @@ interface JoyrideOptions { * @param {JQuery} nextTip Tip object * @param {JQuery} el Element */ - postExposeCallback?: (index?: number, nextTip?: JQuery, el?: JQuery) => void; + postExposeCallback?: (index: number, nextTip: JQuery, el?: JQuery) => void; /** * A method to call before the tour starts (passed index, tip, and cloned exposed element) @@ -201,7 +201,7 @@ interface JoyrideOptions { * @param {JQuery} currentTip Current Tip object * @param {JQuery} el Element */ - preRideCallback?: (index?: number, currentTip?: JQuery, el?: JQuery) => void; + preRideCallback?: (index: number, currentTip: JQuery, el?: JQuery) => void; /** * a method to call once the tour closes @@ -210,7 +210,7 @@ interface JoyrideOptions { * @param {JQuery} currentTip Current Tip object * @param {boolean} isAborted Is Aborted? */ - postRideCallback?: (index?: number, currentTip?: JQuery, isAborted?: boolean) => void; + postRideCallback?: (index: number, currentTip: JQuery, isAborted?: boolean) => void; /** * A method to call after each step @@ -219,7 +219,7 @@ interface JoyrideOptions { * @param {JQuery} currentTip Current Tip object * @param {boolean} isAborted Is Aborted? */ - postStepCallback?: (index?: number, currentTip?: JQuery, isAborted?: boolean) => void; + postStepCallback?: (index: number, currentTip: JQuery, isAborted?: boolean) => void; /** * A method to call before each step @@ -228,7 +228,7 @@ interface JoyrideOptions { * @param {JQuery} nextTip Tip object * @param {JQuery} el Element */ - preStepCallback?: (index?: number, nextTip?: JQuery, el?: JQuery) => void; + preStepCallback?: (index: number, nextTip: JQuery, el?: JQuery) => void; /** * HTML segments for tip layout From 724e0e6338bb13631e78b681d33dced44c52da0c Mon Sep 17 00:00:00 2001 From: armorik83 Date: Tue, 23 Dec 2014 12:53:47 +0900 Subject: [PATCH 7/7] rename to log4js --- log4js-node/log4js-node-tests.ts => log4js/log4js-tests.ts | 4 ++-- log4js-node/log4js-node.d.ts => log4js/log4js.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename log4js-node/log4js-node-tests.ts => log4js/log4js-tests.ts (89%) rename log4js-node/log4js-node.d.ts => log4js/log4js.d.ts (97%) diff --git a/log4js-node/log4js-node-tests.ts b/log4js/log4js-tests.ts similarity index 89% rename from log4js-node/log4js-node-tests.ts rename to log4js/log4js-tests.ts index 44bebeb1f..e18ad7862 100644 --- a/log4js-node/log4js-node-tests.ts +++ b/log4js/log4js-tests.ts @@ -1,4 +1,4 @@ -/// +/// import log4js = require('log4js'); log4js.addAppender(log4js.appenders.file('logs/cheese.log'), 'cheese'); @@ -24,4 +24,4 @@ log4js.configure({ }); var defaultLogger = log4js.getDefaultLogger(); -defaultLogger.debug('Got cheese.'); \ No newline at end of file +defaultLogger.debug('Got cheese.'); diff --git a/log4js-node/log4js-node.d.ts b/log4js/log4js.d.ts similarity index 97% rename from log4js-node/log4js-node.d.ts rename to log4js/log4js.d.ts index cdfc120b4..869a10c58 100644 --- a/log4js-node/log4js-node.d.ts +++ b/log4js/log4js.d.ts @@ -1,4 +1,4 @@ -// Type definitions for log4js-node +// Type definitions for log4js // Project: https://github.com/nomiddlename/log4js-node // Definitions by: Kentaro Okuno // Definitions: https://github.com/borisyankov/DefinitelyTyped