Merge branch 'master' of github.com:DefinitelyTyped/DefinitelyTyped into upstream

This commit is contained in:
unHealthy
2016-09-30 02:10:35 +08:00
8 changed files with 345 additions and 31 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ declare namespace autobahn {
retry_delay_jitter?: number;
url?: string;
protocols?: string[];
onchallenge?: (session: Session, method: string, extra: any) => OnChallengeHandler;
onchallenge?: OnChallengeHandler;
realm?: string;
authmethods?: string[];
authid?: string;
+63
View File
@@ -0,0 +1,63 @@
/// <reference path="cheap-ruler.d.ts"/>
import * as cheapRuler from 'cheap-ruler'
// -- Fixtures --
const bbox = [30.5, 50.5, 31, 51]
const point1 = [30.5, 50.5]
const point2 = [30.51, 50.49]
const unit = 'miles'
const lineString = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[-77.031669, 38.878605],
[-77.029609, 38.881946],
[-77.020339, 38.884084],
[-77.025661, 38.885821],
[-77.021884, 38.889563],
[-77.019824, 38.892368]
]
}
}
const line = lineString.geometry.coordinates
const polygon = [[
[-67.031, 50.458], [-67.031, 50.534], [-66.929, 50.534],
[-66.929, 50.458], [-67.031, 50.458]
]]
const points = [
[-67.031, 50.458], [-67.031, 50.534],
[-66.929, 50.534], [-66.929, 50.458]
]
// -- Test initiators --
cheapRuler(35.05)
cheapRuler(35.05, 'miles')
cheapRuler(35.05, unit)
cheapRuler.fromTile(1567, 12)
cheapRuler.fromTile(1567, 12, 'miles')
cheapRuler.fromTile(1567, 12, unit)
// -- Test units --
cheapRuler.units
cheapRuler.units.miles
cheapRuler.units.kilometers
50 * cheapRuler.units.yards / cheapRuler.units.meters
// -- Test cheapRuler --
const ruler = cheapRuler(35.05)
ruler.distance(point1, point2)
ruler.bearing(point1, point2)
ruler.destination(point1, 0.1, 90)
ruler.lineDistance(points)
ruler.area(polygon)
ruler.along(line, 2.5)
ruler.pointOnLine(line, point1).point
ruler.lineSlice(point1, point2, line)
ruler.lineSliceAlong(10, 20, line)
ruler.bufferPoint(point1, 0.01)
ruler.bufferBBox(bbox, 0.2)
ruler.insideBBox(point1, bbox)
+216
View File
@@ -0,0 +1,216 @@
// Type definitions for cheap-ruler 2.4.1
// Project: https://github.com/mapbox/cheap-ruler
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "cheap-ruler" {
type BBox = [number, number, number, number] | number[]
type Point = [number, number] | number[]
type Line = Array<Point>
type Points = Array<Point>
type Polygon = Array<Array<Point>>
interface TemplateUnits {
kilometers: number
miles: number
nauticalmiles: number
meters: number
metres: number
yards: number
feet: number
inches: number
}
interface InterfacePointOnLine {
point: Point
index: number
t: number
}
class CheapRuler {
/**
* Given two points of the form [longitude, latitude], returns the distance.
*
* @param {Point} a point [longitude, latitude]
* @param {Point} b point [longitude, latitude]
* @returns {number} distance
* @example
* var distance = ruler.distance([30.5, 50.5], [30.51, 50.49]);
* //=distance
*/
distance(a: Point, b: Point): number;
/**
* Returns the bearing between two points in angles.
*
* @param {Point} a point [longitude, latitude]
* @param {Point} b point [longitude, latitude]
* @returns {number} bearing
* @example
* var bearing = ruler.bearing([30.5, 50.5], [30.51, 50.49]);
* //=bearing
*/
bearing(a: Point, b: Point): number;
/**
* Returns a new point given distance and bearing from the starting point.
*
* @param {Point} p point [longitude, latitude]
* @param {number} dist distance
* @param {number} bearing
* @returns {Point} point [longitude, latitude]
* @example
* var point = ruler.destination([30.5, 50.5], 0.1, 90);
* //=point
*/
destination(p: Point, dist: number, bearing: number): Point;
/**
* Given a line (an array of points), returns the total line distance.
*
* @param {Points} points [longitude, latitude]
* @returns {number} total line distance
* @example
* var length = ruler.lineDistance([
* [-67.031, 50.458], [-67.031, 50.534],
* [-66.929, 50.534], [-66.929, 50.458]
* ]);
* //=length
*/
lineDistance(points: Points): number;
/**
* Given a polygon (an array of rings, where each ring is an array of points), returns the area.
*
* @param {Polygon} polygon
* @returns {number} area value in the specified units (square kilometers by default)
* @example
* var area = ruler.area([[
* [-67.031, 50.458], [-67.031, 50.534], [-66.929, 50.534],
* [-66.929, 50.458], [-67.031, 50.458]
* ]]);
* //=area
*/
area(polygon: Polygon): number;
/**
* Returns the point at a specified distance along the line.
*
* @param {Line} line
* @param {number} dist distance
* @returns {Point} point [longitude, latitude]
* @example
* var point = ruler.along(line, 2.5);
* //=point
*/
along(line: Line, dist: number): Point
/**
* Returns an object of the form {point, index} where point is closest point on the line from the given point, and index is the start index of the segment with the closest point.
*
* @pointOnLine
* @param {Line} line
* @param {Point} p point [longitude, latitude]
* @returns {Object} {point, index}
* @example
* var point = ruler.pointOnLine(line, [-67.04, 50.5]).point;
* //=point
*/
pointOnLine(line: Line, p: Point): InterfacePointOnLine
/**
* Returns a part of the given line between the start and the stop points (or their closest points on the line).
*
* @param {Point} start point [longitude, latitude]
* @param {Point} stop point [longitude, latitude]
* @param {Line} line
* @returns {Line} line part of a line
* @example
* var line2 = ruler.lineSlice([-67.04, 50.5], [-67.05, 50.56], line1);
* //=line2
*/
lineSlice(start: Point, stop: Point, line: Line): Line
/**
* Returns a part of the given line between the start and the stop points indicated by distance along the line.
*
* @param {number} start distance
* @param {number} stop distance
* @param {Line} line
* @returns {Line} line part of a line
* @example
* var line2 = ruler.lineSliceAlong(10, 20, line1);
* //=line2
*/
lineSliceAlong(start: number, stop: number, line: Line): Line
/**
* Given a point, returns a bounding box object ([w, s, e, n]) created from the given point buffered by a given distance.
*
* @param {Point} p point [longitude, latitude]
* @param {number} buffer
* @returns {BBox} box object ([w, s, e, n])
* @example
* var bbox = ruler.bufferPoint([30.5, 50.5], 0.01);
* //=bbox
*/
bufferPoint(p: Point, buffer: number): BBox
/**
* Given a bounding box, returns the box buffered by a given distance.
*
* @param {BBox} box object ([w, s, e, n])
* @param {number} buffer
* @returns {BBox} box object ([w, s, e, n])
* @example
* var bbox = ruler.bufferBBox([30.5, 50.5, 31, 51], 0.2);
* //=bbox
*/
bufferBBox(bbox: BBox, buffer: number): BBox
/**
* Returns true if the given point is inside in the given bounding box, otherwise false.
*
* @param {Point} p point [longitude, latitude]
* @param {Point} box object ([w, s, e, n])
* @returns {boolean}
* @example
* var inside = ruler.insideBBox([30.5, 50.5], [30, 50, 31, 51]);
* //=inside
*/
insideBBox(p: Point, bbox: BBox): boolean
}
/**
* A collection of very fast approximations to common geodesic measurements. Useful for performance-sensitive code that measures things on a city scale.
*
* @param {number} lat latitude
* @param {string} [units='kilometers']
* @returns {CheapRuler}
* @example
* var ruler = cheapRuler(35.05, 'miles');
* //=ruler
*/
function cheapRuler(lat: number, units?: string): CheapRuler;
namespace cheapRuler {
/**
* Multipliers for converting between units.
*
* @example
* // convert 50 meters to yards
* 50 * cheapRuler.units.yards / cheapRuler.units.meters;
*/
const units: TemplateUnits
/**
* Creates a ruler object from tile coordinates (y and z). Convenient in tile-reduce scripts.
*
* @param {number} y
* @param {number} z
* @param {string} [units='kilometers']
* @returns {CheapRuler}
* @example
* var ruler = cheapRuler.fromTile(1567, 12);
* //=ruler
*/
function fromTile(y: number, z: number, units?: string): CheapRuler;
}
export = cheapRuler
}
+19
View File
@@ -300,3 +300,22 @@ function test_adding_widget() {
});
}
}
function test_focusManager() {
var textarea = document.createElement('textarea');
var instance = CKEDITOR.replace(textarea);
var element = CKEDITOR.document.getById('myElement');
instance.focusManager.focus();
instance.focusManager.focus(element);
instance.focusManager.lock();
instance.focusManager.unlock();
instance.focusManager.blur();
instance.focusManager.blur(true);
instance.focusManager.add(element, true);
instance.focusManager.remove(element);
var focusManager = new CKEDITOR.focusManager(instance);
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
var bool: boolean = focusManager.hasFocus;
}
+12 -1
View File
@@ -544,8 +544,19 @@ declare namespace CKEDITOR {
}
interface focusManager {
class focusManager {
// Properties
currentActive: dom.domObject;
hasFocus: boolean;
// Methods
constructor(editor: editor);
focus(currentActive?: dom.element): void;
lock(): void;
unlock(): void;
blur(noDelay?: boolean): void;
add(element: dom.element, isCapture: boolean): void;
remove(element: dom.element): void;
}
interface keystrokeHandler {
+28 -28
View File
@@ -13,7 +13,7 @@ declare module 'node-schedule' {
* The callback executed by a Job
*/
export interface JobCallback {
():void;
(): void;
}
/**
@@ -25,7 +25,7 @@ declare module 'node-schedule' {
/**
* This Job's name. read-only.
*/
name:string;
name: string;
/**
* Use the function scheduleJob() to create new Job objects.
@@ -36,7 +36,7 @@ declare module 'node-schedule' {
* @param {JobCallback|Function} job either this Job's callback or an optional callback function
* @param {Function} callback optional callback that is executed right before the JobCallback
*/
constructor(name: string|JobCallback, job?: JobCallback|Function, callback?: Function);
constructor(name: string | JobCallback, job?: JobCallback | Function, callback?: Function);
/**
* Adds an Invocation to this job. For internal use.
@@ -44,7 +44,7 @@ declare module 'node-schedule' {
* @param {Invocation} invokation
* @return {boolean} whether the invocation could be added
*/
trackInvocation(invokation:Invocation):boolean;
trackInvocation(invokation: Invocation): boolean;
/**
* removes an Invocation from this Job's tracking list. For internal use.
@@ -52,69 +52,69 @@ declare module 'node-schedule' {
* @param invocation {Invocation}
* @return boolean whether the invocation was successful. Removing an Invocation that doesn't exist, returns false.
*/
stopTrackingInvocation(invocation:Invocation):boolean;
stopTrackingInvocation(invocation: Invocation): boolean;
/**
* @internal
* @return {number} the number of currently running instances of this Job.
*/
triggeredJobs():number;
triggeredJobs(): number;
/**
* set the number of currently running Jobs.
* @internal
* @param triggeredJobs
*/
setTriggeredJobs(triggeredJobs:number):void;
setTriggeredJobs(triggeredJobs: number): void;
/**
* cancel all pending Invocations of this Job.
* @param reschedule {boolean} whether to reschedule the canceled Invocations.
*/
cancel(reschedule?:boolean):boolean;
cancel(reschedule?: boolean): boolean;
/**
* cancel the next Invocation of this Job.
* @param reschedule {boolean} whether to reschedule the canceled Invocation.
* @return {boolean} whether cancelation was successful
*/
cancelNext(reschedule?:boolean):boolean;
cancelNext(reschedule?: boolean): boolean;
/**
* Changes the scheduling information for this Job.
* @param spec {RecurrenceRule|string|number} the
* @return {boolean} whether the reschedule was successful
*/
reschedule(spec:RecurrenceRule|string|number):boolean;
reschedule(spec: RecurrenceRule | string | number): boolean;
/**
* Returns the Date on which this Job will be run next.
* @return {Date}
*/
nextInvocation():Date;
nextInvocation(): Date;
/**
* @return Invocation[] a list of all pending Invocations
*/
pendingInvocations():Invocation[];
pendingInvocations(): Invocation[];
/**
* run this Job immediately.
*/
invoke():void;
invoke(): void;
/**
* schedule this Job to be run on the specified date.
* @param date {Date}
*/
runOnDate(date:Date): void;
runOnDate(date: Date): void;
/**
* set scheduling information
* @param {Date|string|number} date
* @public
*/
schedule(date: Date|string|number): boolean;
schedule(date: Date | string | number): boolean;
}
/**
@@ -160,7 +160,7 @@ declare module 'node-schedule' {
* @public
* @type {number|Array<number|Range>}
*/
dayOfWeek: number|Array<number|Range>;
dayOfWeek: number | Array<number | Range>;
/**
* Hour.
@@ -202,15 +202,15 @@ declare module 'node-schedule' {
*/
year: number;
constructor(year:number,
month:number,
date:number,
dayOfWeek:number|Array<number|Range>,
hour:number,
minute:number,
second:number);
constructor(year?: number,
month?: number,
date?: number,
dayOfWeek?: number | Array<number | Range>,
hour?: number,
minute?: number,
second?: number);
nextInvocationDate(base:Date):Date;
nextInvocationDate(base: Date): Date;
}
/**
@@ -269,7 +269,7 @@ declare module 'node-schedule' {
* @param {RecurrenceRule|Date|string} rule either the scheduling info or the JobCallback
* @param {JobCallback} callback The callback to be executed on each invocation.
*/
export function scheduleJob(name:string|RecurrenceRule|Date, rule: RecurrenceRule|Date|string|JobCallback, callback?: JobCallback): Job;
export function scheduleJob(name: string | RecurrenceRule | Date, rule: RecurrenceRule | Date | string | JobCallback, callback?: JobCallback): Job;
/**
* Changes the timing of a Job, canceling all pending invocations.
@@ -278,12 +278,12 @@ declare module 'node-schedule' {
* @param spec {JobCallback} the new timing for this Job
* @return {Job} if the job could be rescheduled, {null} otherwise.
*/
export function rescheduleJob(job:Job|string, spec:RecurrenceRule|Date|string):Job;
export function rescheduleJob(job: Job | string, spec: RecurrenceRule | Date | string): Job;
/**
* Dictionary of all Jobs, accessible by name.
*/
export let scheduledJobs:{[jobName:string]:Job};
export let scheduledJobs: { [jobName: string]: Job };
/**
* Cancels the job.
@@ -291,5 +291,5 @@ declare module 'node-schedule' {
* @param {Job} job The job.
* @returns {boolean} {true} if the job has been cancelled with success, otherwise, {false}.
*/
export function cancelJob(job: Job|string): boolean;
export function cancelJob(job: Job | string): boolean;
}
+5
View File
@@ -88,6 +88,11 @@ namespace TestGlobalAPI {
},
init: function() {}
});
Vue.component("component", {
activate: function(callback: Function) {
callback();
}
});
var transition = Vue.transition("transition");
Vue.transition("transition", transition);
Vue.transition("transition", {
+1 -1
View File
@@ -96,7 +96,7 @@ declare namespace vuejs {
detached?(): void;
beforeDestroy?(): void;
destroyed?(): void;
activate?(): void;
activate?: (done: () => void) => void;
directives?: { [key: string]: (DirectiveOption | Function) };
elementDirectives?: { [key: string]: (DirectiveOption | Function) };
filters?: { [key: string]: (Function | FilterOption) };