mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
WIP
This commit is contained in:
+29
-29
@@ -30,7 +30,7 @@ interface ArcDatum {
|
||||
pAngle: number;
|
||||
}
|
||||
|
||||
let arcDefaultDatum: d3Shape.DefaultArcObject = {
|
||||
const arcDefaultDatum: d3Shape.DefaultArcObject = {
|
||||
innerRadius: 40,
|
||||
outerRadius: 60,
|
||||
startAngle: 0,
|
||||
@@ -51,7 +51,7 @@ let accessorArcDatumNumberOrNull: ((this: any, d: ArcDatum, ...args: any[]) => n
|
||||
|
||||
// DefaultArcObject interface ========================================================
|
||||
|
||||
let defaultArcObject: d3Shape.DefaultArcObject = {
|
||||
const defaultArcObject: d3Shape.DefaultArcObject = {
|
||||
innerRadius: 0,
|
||||
outerRadius: 100,
|
||||
startAngle: 0,
|
||||
@@ -152,7 +152,7 @@ accessorArcDatumNumberOrNull = svgArc.padRadius();
|
||||
|
||||
// centroid(...) ---------------------------------------------------------------------
|
||||
|
||||
let centroid: [number, number] = svgArc.centroid(arcDatum);
|
||||
const centroid: [number, number] = svgArc.centroid(arcDatum);
|
||||
// centroid = svgArc.centroid(arcDefaultDatum); // fails, wrong datum type
|
||||
|
||||
// generate arc ----------------------------------------------------------------------
|
||||
@@ -163,9 +163,9 @@ canvasArc(arcDefaultDatum);
|
||||
|
||||
// use with svg
|
||||
|
||||
let pArc: Selection<SVGPathElement, ArcDatum, any, any> = select<SVGPathElement, ArcDatum>('.arc-paths'); // mock
|
||||
let wrongArc1: Selection<SVGCircleElement, ArcDatum, any, any> = select<SVGCircleElement, ArcDatum>('.arc-paths'); // mock
|
||||
let wrongArc2: Selection<SVGPathElement, { test: string }, any, any> = select<SVGPathElement, { test: string }>('.arc-paths'); // mock
|
||||
const pArc: Selection<SVGPathElement, ArcDatum, any, any> = select<SVGPathElement, ArcDatum>('.arc-paths'); // mock
|
||||
const wrongArc1: Selection<SVGCircleElement, ArcDatum, any, any> = select<SVGCircleElement, ArcDatum>('.arc-paths'); // mock
|
||||
const wrongArc2: Selection<SVGPathElement, { test: string }, any, any> = select<SVGPathElement, { test: string }>('.arc-paths'); // mock
|
||||
|
||||
pArc.attr('d', svgArc);
|
||||
// wrongArc1.attr('d', svgArc); // fails, incompatible this contexts
|
||||
@@ -216,7 +216,7 @@ class Arcer {
|
||||
}
|
||||
}
|
||||
|
||||
let arcer = new Arcer(100, 120);
|
||||
const arcer = new Arcer(100, 120);
|
||||
|
||||
pathStringMaybe = arcer.getPathString();
|
||||
pathStringMaybe = arcer.getPathString({ innerRadius: 10, outerRadius: 20 });
|
||||
@@ -236,7 +236,7 @@ let accessorPieDatumNumber: (this: any, data: PieDatum[], ...args: any[]) => num
|
||||
// PieArcDatum interface =============================================================
|
||||
|
||||
|
||||
let pieArcObject: d3Shape.PieArcDatum<PieDatum> = {
|
||||
const pieArcObject: d3Shape.PieArcDatum<PieDatum> = {
|
||||
data: {
|
||||
val: 10,
|
||||
name: "Segment 1"
|
||||
@@ -248,7 +248,7 @@ let pieArcObject: d3Shape.PieArcDatum<PieDatum> = {
|
||||
padAngle: 0
|
||||
};
|
||||
|
||||
let pieDatum: PieDatum = pieArcObject.data;
|
||||
const pieDatum: PieDatum = pieArcObject.data;
|
||||
num = pieArcObject.value;
|
||||
num = pieArcObject.index;
|
||||
num = pieArcObject.startAngle;
|
||||
@@ -342,7 +342,7 @@ let defaultPieChart: Array<d3Shape.PieArcDatum<number | { valueOf(): number }>>;
|
||||
|
||||
defaultPieChart = defaultPie([20, 10, 30, 40]);
|
||||
|
||||
let pieData: PieDatum[] = [
|
||||
const pieData: PieDatum[] = [
|
||||
{ name: 'John', val: 20 },
|
||||
{ name: 'Jill', val: 10 },
|
||||
{ name: 'Rodrigo', val: 30 }
|
||||
@@ -439,13 +439,13 @@ let currentCurveFactory: d3Shape.CurveFactory | d3Shape.CurveFactoryLineOnly = l
|
||||
|
||||
defaultLine([[10, 10], [20, 10], [20, 20]]);
|
||||
|
||||
let lineData: LineDatum[] = [
|
||||
const lineData: LineDatum[] = [
|
||||
{ x: 10, y: 10, missing: false },
|
||||
{ x: 20, y: 10, missing: false },
|
||||
{ x: 20, y: 20, missing: false }
|
||||
];
|
||||
|
||||
let linePathStringMaybe: string | null = line(lineData);
|
||||
const linePathStringMaybe: string | null = line(lineData);
|
||||
|
||||
// radialLine(...) create Line generator =====================================================
|
||||
|
||||
@@ -511,13 +511,13 @@ currentCurveFactory = radialLine.curve();
|
||||
|
||||
defaultRadialLine([[10, 10], [20, 10], [20, 20]]);
|
||||
|
||||
let radialLineData: RadialLineDatum[] = [
|
||||
const radialLineData: RadialLineDatum[] = [
|
||||
{ angle: 0, radius: 10, missing: false },
|
||||
{ angle: Math.PI / 2, radius: 20, missing: false },
|
||||
{ angle: 2 * Math.PI, radius: 10, missing: false }
|
||||
];
|
||||
|
||||
let radialLinePathStringMaybe: string | null = radialLine(radialLineData);
|
||||
const radialLinePathStringMaybe: string | null = radialLine(radialLineData);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
@@ -661,13 +661,13 @@ currentCurveFactory = area.curve();
|
||||
|
||||
defaultArea([[10, 10], [20, 10], [20, 20]]);
|
||||
|
||||
let areaData: AreaDatum[] = [
|
||||
const areaData: AreaDatum[] = [
|
||||
{ x0: 10, y0: 10, x1: 10, y1: 30, missing: false },
|
||||
{ x0: 20, y0: 20, x1: 20, y1: 40, missing: false },
|
||||
{ x0: 30, y0: 30, x1: 30, y1: 30, missing: false }
|
||||
];
|
||||
|
||||
let areaPathStringMaybe: string | null = area(areaData);
|
||||
const areaPathStringMaybe: string | null = area(areaData);
|
||||
|
||||
// Get Line Generators from Area generator ========================================================
|
||||
|
||||
@@ -791,13 +791,13 @@ currentCurveFactory = radialArea.curve();
|
||||
|
||||
defaultRadialArea([[10, 10], [20, 10], [20, 20]]);
|
||||
|
||||
let radialAreaData: RadialAreaDatum[] = [
|
||||
const radialAreaData: RadialAreaDatum[] = [
|
||||
{ startAngle: 0, innerRadius: 10, endAngle: 0, outerRadius: 30, missing: false },
|
||||
{ startAngle: Math.PI / 2, innerRadius: 20, endAngle: Math.PI / 2, outerRadius: 40, missing: false },
|
||||
{ startAngle: Math.PI, innerRadius: 30, endAngle: Math.PI, outerRadius: 30, missing: false }
|
||||
];
|
||||
|
||||
let radialAreaPathStringMaybe: string | null = radialArea(radialAreaData);
|
||||
const radialAreaPathStringMaybe: string | null = radialArea(radialAreaData);
|
||||
|
||||
// Get RadialLine Generators from RadialArea generator ========================================================
|
||||
|
||||
@@ -817,7 +817,7 @@ areaRadialLineGenerator = radialArea.lineOuterRadius();
|
||||
|
||||
let lineOnlyGenerator: d3Shape.CurveGeneratorLineOnly;
|
||||
|
||||
let lineOnlyFactory: d3Shape.CurveFactoryLineOnly = d3Shape.curveBundle;
|
||||
const lineOnlyFactory: d3Shape.CurveFactoryLineOnly = d3Shape.curveBundle;
|
||||
|
||||
lineOnlyGenerator = lineOnlyFactory(path());
|
||||
lineOnlyGenerator = lineOnlyFactory(context!); // force context to be non-null with post-fix for mock
|
||||
@@ -989,14 +989,14 @@ typeAccessorFn = svgSymbol.type();
|
||||
// use with canvas
|
||||
canvasSymbol();
|
||||
|
||||
let symbolDatum: SymbolDatum = {
|
||||
const symbolDatum: SymbolDatum = {
|
||||
size: 30,
|
||||
type: 'circle'
|
||||
};
|
||||
|
||||
let pSymbol: Selection<SVGPathElement, SymbolDatum, any, any> = select<SVGPathElement, SymbolDatum>('.symbol-path'); // mock
|
||||
let wrongSymbol1: Selection<SVGCircleElement, SymbolDatum, any, any> = select<SVGCircleElement, SymbolDatum>('.symbol-path'); // mock
|
||||
let wrongSymbol2: Selection<SVGPathElement, { test: string }, any, any> = select<SVGPathElement, { test: string }>('.symbol-path'); // mock
|
||||
const pSymbol: Selection<SVGPathElement, SymbolDatum, any, any> = select<SVGPathElement, SymbolDatum>('.symbol-path'); // mock
|
||||
const wrongSymbol1: Selection<SVGCircleElement, SymbolDatum, any, any> = select<SVGCircleElement, SymbolDatum>('.symbol-path'); // mock
|
||||
const wrongSymbol2: Selection<SVGPathElement, { test: string }, any, any> = select<SVGPathElement, { test: string }>('.symbol-path'); // mock
|
||||
|
||||
pSymbol.attr('d', svgSymbol);
|
||||
// wrongSymbol1.attr('d', svgSymbol); // fails, incompatible this contexts
|
||||
@@ -1051,7 +1051,7 @@ class Symbolizer {
|
||||
}
|
||||
}
|
||||
|
||||
let sym = new Symbolizer(100, 'square');
|
||||
const sym = new Symbolizer(100, 'square');
|
||||
|
||||
pathStringMaybe = sym.getPathString();
|
||||
pathStringMaybe = sym.getPathString({ size: 10, type: 'circle' });
|
||||
@@ -1059,7 +1059,7 @@ pathStringMaybe = sym.getPathString({ size: 10, type: 'circle' });
|
||||
|
||||
// Test pre-fab symbols ===============================================================
|
||||
|
||||
let symbolArray: d3Shape.SymbolType[] = d3Shape.symbols;
|
||||
const symbolArray: d3Shape.SymbolType[] = d3Shape.symbols;
|
||||
|
||||
customSymbol = d3Shape.symbolCircle;
|
||||
customSymbol = d3Shape.symbolCross;
|
||||
@@ -1086,13 +1086,13 @@ interface StackKey {
|
||||
|
||||
let key: StackKey;
|
||||
|
||||
let keys: StackKey[] = [
|
||||
const keys: StackKey[] = [
|
||||
{ name: 'bananas', label: 'Bananas' },
|
||||
{ name: 'apples', label: 'Apples' },
|
||||
{ name: 'oranges', label: 'Oranges' }
|
||||
];
|
||||
|
||||
let stackData: StackDatum[] = [
|
||||
const stackData: StackDatum[] = [
|
||||
{ values: { bananas: 10, apples: 20, oranges: 10 } },
|
||||
{ values: { bananas: 10, apples: 25, oranges: 0 } },
|
||||
{ values: { bananas: 20, apples: 20, oranges: 30 } },
|
||||
@@ -1171,7 +1171,7 @@ seriesArray = overlyComplicatedStack(stackData, keys);
|
||||
|
||||
// Test SeriesPoint and Series interfaces ============================================
|
||||
|
||||
let series: d3Shape.Series<StackDatum, StackKey> = seriesArray[0];
|
||||
const series: d3Shape.Series<StackDatum, StackKey> = seriesArray[0];
|
||||
let seriesPoint: d3Shape.SeriesPoint<StackDatum>;
|
||||
seriesPoint = series[0];
|
||||
key = series.key;
|
||||
@@ -1186,7 +1186,7 @@ seriesDatum = seriesPoint.data;
|
||||
// Test stack orders ===============================================================
|
||||
|
||||
let order: number[];
|
||||
let seriesAnyAny: d3Shape.Series<any, any> = seriesArray[0];
|
||||
const seriesAnyAny: d3Shape.Series<any, any> = seriesArray[0];
|
||||
|
||||
order = d3Shape.stackOrderAscending(seriesAnyAny);
|
||||
order = d3Shape.stackOrderDescending(seriesAnyAny);
|
||||
|
||||
@@ -39,12 +39,12 @@ interface CircleDatum {
|
||||
color: string;
|
||||
}
|
||||
|
||||
let dimensions: SVGDatum = {
|
||||
const dimensions: SVGDatum = {
|
||||
width: 500,
|
||||
height: 300
|
||||
};
|
||||
|
||||
let startCircleData: CircleDatum[] = [
|
||||
const startCircleData: CircleDatum[] = [
|
||||
{
|
||||
nodeId: 'n1',
|
||||
name: 'node_1',
|
||||
@@ -65,7 +65,7 @@ let startCircleData: CircleDatum[] = [
|
||||
}
|
||||
];
|
||||
|
||||
let endCircleData: CircleDatum[] = [
|
||||
const endCircleData: CircleDatum[] = [
|
||||
{
|
||||
nodeId: 'n1',
|
||||
name: 'node_1',
|
||||
@@ -112,7 +112,7 @@ circles = select<SVGSVGElement, any>('svg')
|
||||
circles = circles
|
||||
.data(endCircleData, d => d.nodeId);
|
||||
|
||||
let enterCircles = circles
|
||||
const enterCircles = circles
|
||||
.enter()
|
||||
.append<SVGCircleElement>('circle')
|
||||
.classed('big', d => d.r > 10)
|
||||
@@ -123,7 +123,7 @@ let enterCircles = circles
|
||||
.style('fill', d => d.color);
|
||||
|
||||
|
||||
let exitCircles = circles.exit<CircleDatum>(); // Note: need to re-type datum type, as the exit selection elements have the 'old data'
|
||||
const exitCircles = circles.exit<CircleDatum>(); // Note: need to re-type datum type, as the exit selection elements have the 'old data'
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Create Transition from Selection
|
||||
@@ -159,12 +159,12 @@ newEnterTransition = enterCircles.transition(differentDatumTypeTransition);
|
||||
// duration() ---------------------------------------------------------------
|
||||
|
||||
enterTransition = enterTransition.duration(2000); // settable and chainable
|
||||
let duration: number = enterTransition.duration();
|
||||
const duration: number = enterTransition.duration();
|
||||
|
||||
// delay() ---------------------------------------------------------------
|
||||
|
||||
enterTransition = enterTransition.delay(500); // settable and chainable
|
||||
let delay: number = enterTransition.delay();
|
||||
const delay: number = enterTransition.delay();
|
||||
|
||||
|
||||
// ease() ---------------------------------------------------------------
|
||||
@@ -188,7 +188,7 @@ interface ParagraphDatum {
|
||||
}
|
||||
|
||||
// assume body was previously selected and its data were set to BodyDatum type using .datum()
|
||||
let bodyTransition: d3Transition.Transition<HTMLBodyElement, BodyDatum, HTMLElement, any> = select<HTMLBodyElement, BodyDatum>('body').transition();
|
||||
const bodyTransition: d3Transition.Transition<HTMLBodyElement, BodyDatum, HTMLElement, any> = select<HTMLBodyElement, BodyDatum>('body').transition();
|
||||
|
||||
// select() ------------------------------------------------------------------
|
||||
|
||||
@@ -196,12 +196,12 @@ let bodyTransition: d3Transition.Transition<HTMLBodyElement, BodyDatum, HTMLElem
|
||||
|
||||
let firstDivTransition: d3Transition.Transition<HTMLDivElement, BodyDatum, HTMLElement, any> = bodyTransition.select<HTMLDivElement>('div');
|
||||
|
||||
firstDivTransition = bodyTransition.select(function (d, i, g) {
|
||||
let that: HTMLBodyElement = this;
|
||||
// let that2: SVGElement = this; // fails, type mismatch
|
||||
let datum: BodyDatum = d;
|
||||
let index: number = i;
|
||||
let group: HTMLBodyElement[] | ArrayLike<HTMLBodyElement> = g;
|
||||
firstDivTransition = bodyTransition.select(function(d, i, g) {
|
||||
const that: HTMLBodyElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLBodyElement[] | ArrayLike<HTMLBodyElement> = g;
|
||||
|
||||
console.log('Body Datum foo', d.foo); // d is of type BodyDatum
|
||||
return this.querySelector('div')!; // 'this' type is HTMLElement, return type is HTMLDivElement
|
||||
@@ -215,12 +215,12 @@ firstDivTransition = bodyTransition.select(function (d, i, g) {
|
||||
|
||||
let paragraphsTransition: d3Transition.Transition<HTMLParagraphElement, ParagraphDatum, HTMLDivElement, BodyDatum> = firstDivTransition.selectAll<HTMLParagraphElement, ParagraphDatum>('p');
|
||||
|
||||
paragraphsTransition = firstDivTransition.selectAll<HTMLParagraphElement, ParagraphDatum>(function (d, i, g) {
|
||||
let that: HTMLDivElement = this;
|
||||
// let that2: SVGElement = this; // fails, type mismatch
|
||||
let datum: BodyDatum = d;
|
||||
let index: number = i;
|
||||
let group: HTMLDivElement[] | ArrayLike<HTMLDivElement> = g;
|
||||
paragraphsTransition = firstDivTransition.selectAll<HTMLParagraphElement, ParagraphDatum>(function(d, i, g) {
|
||||
const that: HTMLDivElement = this;
|
||||
// const that2: SVGElement = this; // fails, type mismatch
|
||||
const datum: BodyDatum = d;
|
||||
const index: number = i;
|
||||
const group: HTMLDivElement[] | ArrayLike<HTMLDivElement> = g;
|
||||
console.log('Body Datum foo', d.foo); // d is of type BodyDatum
|
||||
return this.querySelectorAll('p'); // 'this' type is HTMLElement, return type is HTMLParagraphElement
|
||||
});
|
||||
@@ -231,12 +231,12 @@ paragraphsTransition = firstDivTransition.selectAll<HTMLParagraphElement, Paragr
|
||||
|
||||
enterTransition = enterTransition.filter('.big');
|
||||
|
||||
exitTransition = exitTransition.filter(function (d, i, g) {
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
exitTransition = exitTransition.filter(function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
// console.log(this.x) // fails, x property not defined on SVGCircleElement
|
||||
return this.r.baseVal.value < i * d.r; // this-type SVGCircleElement, datum tpye CircleDatum
|
||||
});
|
||||
@@ -249,16 +249,16 @@ let filterdGElements2: d3Transition.Transition<SVGGElement, any, HTMLElement, an
|
||||
filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>('g');
|
||||
// filterdGElements2 = selectAll('.any-type').transition().filter('g'); // fails without using narrowing generic on filter method
|
||||
|
||||
filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>(function (d, i, g) {
|
||||
let that: SVGElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGElement[] | ArrayLike<SVGElement> = g;
|
||||
filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter<SVGGElement>(function(d, i, g) {
|
||||
const that: SVGElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGElement[] | ArrayLike<SVGElement> = g;
|
||||
return that.tagName === 'g' || that.tagName === 'G';
|
||||
});
|
||||
// filterdGElements2 = selectAll<SVGElement, any>('.any-svg-type').transition().filter(function(){
|
||||
// let that: SVGElement = this;
|
||||
// const that: SVGElement = this;
|
||||
// return that.tagName === 'g'|| that.tagName === 'G';
|
||||
// }); // fails without using narrowing generic on filter method
|
||||
|
||||
@@ -279,21 +279,19 @@ enterTransition = enterTransition // re-assignment test chaining return-type
|
||||
.attr('stroke', 'blue'); // string
|
||||
|
||||
enterTransition = enterTransition // re-assignment test chaining return-type
|
||||
.attr('cx', function (d, i, g) {
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
.attr('cx', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
console.log('Pre-change center x-coordinate: ', this.cx.baseVal.value); // this context SVGCircleElement
|
||||
if (group.length > 0) {
|
||||
console.log('Owner SVG Element of first group element:', g[0].ownerSVGElement); // group : Array<SVGCircleElement>
|
||||
}
|
||||
return d.cx; // numeric return value
|
||||
})
|
||||
.attr('stroke', function (d) {
|
||||
return d.color; // string return value
|
||||
});
|
||||
.attr('stroke', d => d.color); // string return value
|
||||
|
||||
enterTransition = enterTransition
|
||||
.style('fill', 'blue') // string
|
||||
@@ -302,28 +300,26 @@ enterTransition = enterTransition
|
||||
.style('stroke', 'green', 'important');
|
||||
|
||||
enterTransition = enterTransition
|
||||
.style('fill', function (d, i, g) {
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
.style('fill', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
console.log('Client Rectangle Top: ', this.getBoundingClientRect().top); // this context SVGCircleElement
|
||||
if (g.length > 0) {
|
||||
console.log('Radius of first group element:', g[0].r.baseVal.value); // group : Array<SVGCircleElement>
|
||||
}
|
||||
return d.color; // string return value
|
||||
})
|
||||
.style('hidden', function () {
|
||||
return true;
|
||||
}, null) // boolean return + test: priority = null
|
||||
// .style('stroke', function () { return 'green'; }, 'test') // fails, test: invalid priority value
|
||||
.style('stroke', function () { return 'green'; }, 'important'); // string return + test: priority = 'important';
|
||||
.style('hidden', () => true, null) // boolean return + test: priority = null
|
||||
// .style('stroke', function() { return 'green'; }, 'test') // fails, test: invalid priority value
|
||||
.style('stroke', () => 'green', 'important'); // string return + test: priority = 'important';
|
||||
|
||||
select<HTMLBodyElement, { test: string }>('body')
|
||||
.datum({ test: 'New text.' })
|
||||
.transition().duration(500)
|
||||
.text('Let us start with this transition text.')
|
||||
.text('const us start with this transition text.')
|
||||
.transition().duration(100)
|
||||
.text(d => d.test); // selection datum type
|
||||
|
||||
@@ -335,12 +331,12 @@ maybeG1 = selectAll<SVGSVGElement, any>('svg')
|
||||
.selectAll<SVGCircleElement | null, any>('circle')
|
||||
.transition()
|
||||
.duration(500)
|
||||
.attr('fill', function (d, i, g) {
|
||||
let that: SVGCircleElement | null = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: Array<SVGCircleElement | null> | ArrayLike<SVGCircleElement | null> = g;
|
||||
.attr('fill', function(d, i, g) {
|
||||
const that: SVGCircleElement | null = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: Array<SVGCircleElement | null> | ArrayLike<SVGCircleElement | null> = g;
|
||||
|
||||
if (that) {
|
||||
return that.r.baseVal.value < 5 ? 'slateblue' : 'seagreen';
|
||||
@@ -352,19 +348,19 @@ maybeG1 = selectAll<SVGSVGElement, any>('svg')
|
||||
|
||||
// Tweening Function Use =====================================================
|
||||
|
||||
enterTransition = enterTransition.attrTween('r', function (d, i, g) {
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
enterTransition = enterTransition.attrTween('r', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
console.log(this.r.baseVal.value); // this type is SVGCircleElement
|
||||
return interpolateString(0, d.r); // datum type is CircleDatum
|
||||
});
|
||||
|
||||
exitTransition = exitTransition.styleTween('fill', function (d, i, group) {
|
||||
exitTransition = exitTransition.styleTween('fill', function(d, i, group) {
|
||||
console.log(this.r.baseVal.value); // this type is SVGCircleElement
|
||||
let c: string = select(this).style('fill');
|
||||
const c: string = select(this).style('fill');
|
||||
return interpolateRgb(c, d.color); // datum type is CircleDatum
|
||||
});
|
||||
|
||||
@@ -375,16 +371,16 @@ let tweenFnAccessor: undefined | ((this: SVGCircleElement, datum?: CircleDatum,
|
||||
updateTransition = updateTransition.tween('fillColor', null); // remove named tween
|
||||
|
||||
// chainable
|
||||
updateTransition = updateTransition.tween('fillColor', function (d, i, g) {
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
let c: string | null = that.getAttribute('fill');
|
||||
let interpolator = interpolateRgb(c ? c : 'blue', d.color); // datum type CircleDatum
|
||||
updateTransition = updateTransition.tween('fillColor', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
const c: string | null = that.getAttribute('fill');
|
||||
const interpolator = interpolateRgb(c ? c : 'blue', d.color); // datum type CircleDatum
|
||||
console.log('Radius ', this.r.baseVal.value); // this type SVGCircleElement
|
||||
return function (t) {
|
||||
return t => {
|
||||
that.setAttribute('fill', interpolator(t));
|
||||
};
|
||||
});
|
||||
@@ -412,12 +408,12 @@ exitTransition.remove();
|
||||
let listener: undefined | ((this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | ArrayLike<SVGCircleElement>) => void);
|
||||
|
||||
|
||||
enterTransition = enterTransition.on('end', function (d, i, g) {
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
enterTransition = enterTransition.on('end', function(d, i, g) {
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
console.log('transition end radius: ', this.r.baseVal.value); // SVGCircleElement
|
||||
console.log('end event datum color property: ', d.color); // CircleDatum type
|
||||
});
|
||||
@@ -443,12 +439,12 @@ enterTransition = enterTransition.on('end', null); // check chaining return type
|
||||
// each(valueFn: (this: GElement, datum?: Datum, index?: number, group?: Array<GElement> | ArrayLike<GElement>) => void): Transition<GElement, Datum, PElement, PDatum>;
|
||||
|
||||
// returns 'this' transition
|
||||
enterTransition = enterTransition.each(function (d, i, g) { // check chaining return type by re-assigning
|
||||
let that: SVGCircleElement = this;
|
||||
// let that2: HTMLElement = this; // fails, type mismatch
|
||||
let datum: CircleDatum = d;
|
||||
let index: number = i;
|
||||
let group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
enterTransition = enterTransition.each(function(d, i, g) { // check chaining return type by re-assigning
|
||||
const that: SVGCircleElement = this;
|
||||
// const that2: HTMLElement = this; // fails, type mismatch
|
||||
const datum: CircleDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGCircleElement[] | ArrayLike<SVGCircleElement> = g;
|
||||
if (this.r.baseVal.value < d.r) { // this of type SVGCircleElement, datum of type CircleDatum
|
||||
console.log('Color of circles with current radius smaller than data radius: ', d.color);
|
||||
}
|
||||
@@ -466,26 +462,26 @@ function changeExitColor(transition: d3Transition.Transition<SVGCircleElement, C
|
||||
// returns 'this' transition
|
||||
exitTransition = exitTransition.call(changeExitColor, 'midnightblue', 'black'); // check chaining return type by re-assigning
|
||||
|
||||
// exitTransition.call(function (transition: d3Transition.Transition<HTMLDivElement, CircleDatum, any, any>): void {
|
||||
// exitTransition.call(function(transition: d3Transition.Transition<HTMLDivElement, CircleDatum, any, any>): void {
|
||||
// // fails, group element types of selection not compatible: SVGCircleElement v HTMLDivElement
|
||||
// });
|
||||
|
||||
// exitTransition.call(function (transition: d3Transition.Transition<SVGCircleElement, DivDatum, any, any>): void {
|
||||
// exitTransition.call(function(transition: d3Transition.Transition<SVGCircleElement, DivDatum, any, any>): void {
|
||||
// // fails, group datum types of selection not compatible: CircleDatum v DivDatum
|
||||
// });
|
||||
|
||||
// empty() -------------------------------------------------------------------------------
|
||||
|
||||
let empty: boolean = enterTransition.empty();
|
||||
const empty: boolean = enterTransition.empty();
|
||||
|
||||
// node() and nodes() --------------------------------------------------------------------
|
||||
|
||||
let firstCircleNode: SVGCircleElement = enterTransition.node()!;
|
||||
let circleNodes: SVGCircleElement[] = enterTransition.nodes();
|
||||
const firstCircleNode: SVGCircleElement = enterTransition.node()!;
|
||||
const circleNodes: SVGCircleElement[] = enterTransition.nodes();
|
||||
|
||||
// size() --------------------------------------------------------------------------------
|
||||
|
||||
let size: number = enterTransition.size();
|
||||
const size: number = enterTransition.size();
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Sequencing transitions on the same selection
|
||||
|
||||
+98
-101
@@ -16,7 +16,7 @@ import { interpolateZoom, interpolate, interpolateArray, ZoomInterpolator, ZoomV
|
||||
// Preparatory Steps
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
let points: Array<[number, number]> = [
|
||||
const points: Array<[number, number]> = [
|
||||
[10, 10], [20, 20], [50, 50]
|
||||
];
|
||||
|
||||
@@ -28,12 +28,12 @@ interface CanvasDatum {
|
||||
radius: number;
|
||||
}
|
||||
|
||||
let canvas = select<HTMLCanvasElement, any>('canvas')
|
||||
const canvas = select<HTMLCanvasElement, any>('canvas')
|
||||
.datum<CanvasDatum>({ width: 500, height: 400, radius: 2.5 })
|
||||
.attr('width', d => d.width)
|
||||
.attr('height', d => d.height);
|
||||
|
||||
let context = canvas.node()!.getContext('2d');
|
||||
const context = canvas.node()!.getContext('2d');
|
||||
|
||||
function drawPointsOnCanvas(radius: number) {
|
||||
if (context) {
|
||||
@@ -61,13 +61,13 @@ interface SVGDatum {
|
||||
filterBrushEvent: boolean;
|
||||
}
|
||||
|
||||
let svg = select<SVGSVGElement, undefined>('svg')
|
||||
const svg = select<SVGSVGElement, undefined>('svg')
|
||||
.datum<SVGDatum>({ width: 500, height: 500, filterBrushEvent: true })
|
||||
.attr('width', d => d.width)
|
||||
.attr('height', d => d.height);
|
||||
|
||||
|
||||
let g = svg.append<SVGGElement>('g');
|
||||
const g = svg.append<SVGGElement>('g');
|
||||
|
||||
g.selectAll()
|
||||
.data<[number, number]>(points)
|
||||
@@ -85,9 +85,6 @@ interface GroupDatum {
|
||||
toK: number;
|
||||
}
|
||||
|
||||
let groupsSelection: Selection<SVGGElement, GroupDatum, any, any>;
|
||||
let groupsTransition: Transition<SVGGElement, GroupDatum, any, any>;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Define ZoomBehaviour
|
||||
@@ -98,7 +95,7 @@ let groupsTransition: Transition<SVGGElement, GroupDatum, any, any>;
|
||||
function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) {
|
||||
|
||||
// Cast d3 event to D3ZoomEvent to be used in zoom event handler
|
||||
let e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
|
||||
const e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
|
||||
if (context) {
|
||||
context.save();
|
||||
context.clearRect(0, 0, this.width, this.height); // this element
|
||||
@@ -120,7 +117,7 @@ canvasZoom = d3Zoom.zoom()
|
||||
function zoomedSVGOverlay(this: SVGRectElement) {
|
||||
|
||||
// Cast d3 event to D3ZoomEvent to be used in zoom event handler
|
||||
let e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
|
||||
const e = <d3Zoom.D3ZoomEvent<HTMLCanvasElement, any>> event;
|
||||
|
||||
g.attr('transform', e.transform.toString());
|
||||
}
|
||||
@@ -133,9 +130,9 @@ svgZoom = d3Zoom.zoom<SVGRectElement, SVGDatum>();
|
||||
// filter() ----------------------------------------------------------------
|
||||
|
||||
// chainable
|
||||
svgZoom = svgZoom.filter(function (d, i, group) {
|
||||
svgZoom = svgZoom.filter(function(d, i, group) {
|
||||
// Cast d3 event to D3ZoomEvent to be used in filter logic
|
||||
let e = <d3Zoom.D3ZoomEvent<SVGRectElement, SVGDatum>> event;
|
||||
const e = <d3Zoom.D3ZoomEvent<SVGRectElement, SVGDatum>> event;
|
||||
|
||||
console.log('Overlay Rectangle width: ', this.width.baseVal.value); // this typing is SVGRectElement
|
||||
return e.sourceEvent.type !== 'brush' || !d.filterBrushEvent; // datum type is SVGDatum (as propagated to SVGRectElement with zoom event attached)
|
||||
@@ -154,7 +151,7 @@ extentAccessor = svgZoom.extent();
|
||||
svgZoom = svgZoom.extent([[0, 0], [200, 200]]);
|
||||
|
||||
// chainable with accessor function
|
||||
svgZoom = svgZoom.extent(function (d, i, group) {
|
||||
svgZoom = svgZoom.extent(function(d, i, group) {
|
||||
console.log('Overlay Rectangle width: ', this.width.baseVal.value); // this typing is SVGRectElement
|
||||
return [[0, 0], [d.width, d.height]]; // datum type is SVGDatum
|
||||
});
|
||||
@@ -181,7 +178,7 @@ translateExtent = svgZoom.translateExtent();
|
||||
// chainable
|
||||
svgZoom = svgZoom.duration(500);
|
||||
|
||||
let duration: number = svgZoom.duration();
|
||||
const duration: number = svgZoom.duration();
|
||||
|
||||
// interpolate() --------------------------------------------------------------
|
||||
|
||||
@@ -232,14 +229,14 @@ canvas.call(canvasZoom);
|
||||
// SVG Example --------------------------------------------------------------
|
||||
|
||||
// attach the zoom behavior to an overlay svg rectangle
|
||||
let svgOverlay: Selection<SVGRectElement, SVGDatum, HTMLElement, any> = svg.append<SVGRectElement>('rect')
|
||||
const svgOverlay: Selection<SVGRectElement, SVGDatum, HTMLElement, any> = svg.append<SVGRectElement>('rect')
|
||||
.attr('width', d => d.width)
|
||||
.attr('height', d => d.height)
|
||||
.style('fill', 'none')
|
||||
.style('pointer-events', 'all')
|
||||
.call(svgZoom);
|
||||
|
||||
let svgOverlayTransition = svgOverlay.transition();
|
||||
const svgOverlayTransition = svgOverlay.transition();
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Use ZoomBehaviour
|
||||
@@ -251,11 +248,11 @@ let svgOverlayTransition = svgOverlay.transition();
|
||||
svgZoom.transform(svgOverlay, d3Zoom.zoomIdentity);
|
||||
// svgZoom.transform(groupsSelection, d3Zoom.zoomIdentity); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.transform(svgOverlay, function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
svgZoom.transform(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return d3Zoom.zoomIdentity;
|
||||
@@ -265,11 +262,11 @@ svgOverlayTransition.call(svgZoom.transform, d3Zoom.zoomIdentity);
|
||||
// svgZoom.transform(groupsTransition, d3Zoom.zoomIdentity); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.transform(svgOverlayTransition, d3Zoom.zoomIdentity);
|
||||
svgZoom.transform(svgOverlayTransition, function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
svgZoom.transform(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return d3Zoom.zoomIdentity;
|
||||
@@ -284,22 +281,22 @@ svgZoom.translateBy(svgOverlay, 20, 50);
|
||||
svgZoom.translateBy(
|
||||
svgOverlay,
|
||||
20,
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
});
|
||||
svgZoom.translateBy(
|
||||
svgOverlay,
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
@@ -307,20 +304,20 @@ svgZoom.translateBy(
|
||||
50);
|
||||
svgZoom.translateBy(
|
||||
svgOverlay,
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
},
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
@@ -333,22 +330,22 @@ svgZoom.translateBy(svgOverlayTransition, 20, 50);
|
||||
svgZoom.translateBy(
|
||||
svgOverlayTransition,
|
||||
20,
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
});
|
||||
svgZoom.translateBy(
|
||||
svgOverlayTransition,
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
@@ -356,20 +353,20 @@ svgZoom.translateBy(
|
||||
50);
|
||||
svgZoom.translateBy(
|
||||
svgOverlayTransition,
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
},
|
||||
function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
@@ -381,11 +378,11 @@ svgZoom.translateBy(
|
||||
svgZoom.scaleBy(svgOverlay, 3);
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleBy(svgOverlay, function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
svgZoom.scaleBy(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 3;
|
||||
@@ -394,11 +391,11 @@ svgZoom.scaleBy(svgOverlay, function (datum, index, groups) {
|
||||
svgZoom.scaleBy(svgOverlayTransition, 3);
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleBy(svgOverlayTransition, function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
svgZoom.scaleBy(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 3;
|
||||
@@ -410,11 +407,11 @@ svgZoom.scaleBy(svgOverlayTransition, function (datum, index, groups) {
|
||||
svgZoom.scaleTo(svgOverlay, 3);
|
||||
// svgZoom.scaleBy(groupsSelection, 3); // fails, as groupSelection mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleTo(svgOverlay, function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
svgZoom.scaleTo(svgOverlay, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 3;
|
||||
@@ -423,11 +420,11 @@ svgZoom.scaleTo(svgOverlay, function (datum, index, groups) {
|
||||
svgZoom.scaleTo(svgOverlayTransition, 3);
|
||||
// svgZoom.scaleBy(groupsTransition, 3); // fails, as groupTransition mismachtes DOM Element type and datum type
|
||||
|
||||
svgZoom.scaleTo(svgOverlayTransition, function (datum, index, groups) {
|
||||
let that: SVGRectElement = this;
|
||||
let d: SVGDatum = datum;
|
||||
let i: number = index;
|
||||
let g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
svgZoom.scaleTo(svgOverlayTransition, function(datum, index, groups) {
|
||||
const that: SVGRectElement = this;
|
||||
const d: SVGDatum = datum;
|
||||
const i: number = index;
|
||||
const g: SVGRectElement[] | ArrayLike<SVGRectElement> = groups;
|
||||
console.log('Owner SVG Element of svg rect: ', this.ownerSVGElement); // this is of type SVGRectElement
|
||||
console.log('Filter Brush Event status as per datum: ', d.filterBrushEvent); // datum type is SVGDatum
|
||||
return 30;
|
||||
@@ -437,12 +434,12 @@ svgZoom.scaleTo(svgOverlayTransition, function (datum, index, groups) {
|
||||
// Test Zoom Event Interface
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
let e: d3Zoom.D3ZoomEvent<SVGRectElement, SVGDatum> = event; // mock assignment
|
||||
const e: d3Zoom.D3ZoomEvent<SVGRectElement, SVGDatum> = event; // mock assignment
|
||||
|
||||
let target: d3Zoom.ZoomBehavior<SVGRectElement, SVGDatum> = e.target;
|
||||
let type: 'start' | 'zoom' | 'end' | string = e.type;
|
||||
let zoomTransform: d3Zoom.ZoomTransform = e.transform;
|
||||
let sourceEvent: any = e.sourceEvent;
|
||||
const target: d3Zoom.ZoomBehavior<SVGRectElement, SVGDatum> = e.target;
|
||||
const type: 'start' | 'zoom' | 'end' | string = e.type;
|
||||
const zoomTransform: d3Zoom.ZoomTransform = e.transform;
|
||||
const sourceEvent: any = e.sourceEvent;
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Test Zoom Transforms
|
||||
@@ -456,17 +453,17 @@ zTransform = d3Zoom.zoomTransform(canvas.node()!);
|
||||
|
||||
// Test ZoomTransform -------------------------------------------------------
|
||||
|
||||
let x: number = zTransform.x;
|
||||
let y: number = zTransform.y;
|
||||
let k: number = zTransform.k;
|
||||
const x: number = zTransform.x;
|
||||
const y: number = zTransform.y;
|
||||
const k: number = zTransform.k;
|
||||
|
||||
let transformedPoint: [number, number] = zTransform.apply([15, 20]);
|
||||
let transformedX: number = zTransform.applyX(15);
|
||||
let transformedY: number = zTransform.applyY(20);
|
||||
const transformedPoint: [number, number] = zTransform.apply([15, 20]);
|
||||
const transformedX: number = zTransform.applyX(15);
|
||||
const transformedY: number = zTransform.applyY(20);
|
||||
|
||||
let invertedPoint: [number, number] = zTransform.invert([150, 240]);
|
||||
let invertedX: number = zTransform.invertX(150);
|
||||
let invertedY: number = zTransform.invertY(240);
|
||||
const invertedPoint: [number, number] = zTransform.invert([150, 240]);
|
||||
const invertedX: number = zTransform.invertX(150);
|
||||
const invertedY: number = zTransform.invertY(240);
|
||||
|
||||
// TODO: reScaleX, reScaleY
|
||||
|
||||
@@ -475,7 +472,7 @@ let linearScale: ScaleLinear<number, number> = scaleLinear();
|
||||
linearScale = zTransform.rescaleX(linearScale);
|
||||
linearScale = zTransform.rescaleY(linearScale);
|
||||
|
||||
let transformation: string = zTransform.toString();
|
||||
const transformation: string = zTransform.toString();
|
||||
|
||||
zTransform = zTransform.translate(50, 40);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ const docker5 = new Docker({
|
||||
});
|
||||
|
||||
const docker6 = new Docker({
|
||||
protocol: 'https', //you can enforce a protocol
|
||||
protocol: 'https', // you can enforce a protocol
|
||||
host: '192.168.1.10',
|
||||
port: process.env.DOCKER_PORT || 2375,
|
||||
ca: 'ca',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//constructor
|
||||
// constructor
|
||||
var constructorNoOptions = new Dropkick('#my-select');
|
||||
var constructorNoOptions2 = new Dropkick(new HTMLSelectElement());
|
||||
var constructorOptions = new Dropkick('#my-select', {});
|
||||
var constructorOptions2 = new Dropkick(new HTMLSelectElement(), {});
|
||||
|
||||
//options
|
||||
// options
|
||||
var options: DropkickOptions = {
|
||||
disabled: true,
|
||||
form: new HTMLFormElement(),
|
||||
@@ -24,7 +24,7 @@ var withFullOptions = new Dropkick('#test', options);
|
||||
|
||||
var dk = new Dropkick('#test');
|
||||
|
||||
//fields (same as options)
|
||||
// fields (same as options)
|
||||
var o1 = dk.disabled;
|
||||
var o2 = dk.form;
|
||||
var o3 = dk.length;
|
||||
@@ -35,7 +35,7 @@ var o7 = dk.selectedIndex;
|
||||
var o8 = dk.selectedOptions;
|
||||
var o9 = dk.value;
|
||||
|
||||
//methods
|
||||
// methods
|
||||
dk.add('new');
|
||||
dk.add(new HTMLSelectElement());
|
||||
dk.add('new', 'old');
|
||||
@@ -73,11 +73,11 @@ var node4 = dk.select(4, true);
|
||||
var node5 = dk.selectOne(4);
|
||||
var node6 = dk.selectOne(4, true);
|
||||
|
||||
//real life example
|
||||
// real life example
|
||||
var fieldValue = '';
|
||||
var selectOptions: DropkickOptions = {
|
||||
open(this: Dropkick) {
|
||||
const optionsList = (<any> this).data.elem.lastChild; //undocumented but useful data field
|
||||
const optionsList = (<any> this).data.elem.lastChild; // undocumented but useful data field
|
||||
if (optionsList.scrollWidth > optionsList.offsetWidth) {
|
||||
optionsList.style.width = optionsList.scrollWidth + 25 + 'px';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import stream = require("stream");
|
||||
import duplexer2 = require("duplexer2");
|
||||
|
||||
let writable = new stream.Writable({ objectMode: true }),
|
||||
const writable = new stream.Writable({ objectMode: true }),
|
||||
readable = new stream.Readable({ objectMode: true });
|
||||
|
||||
writable.once("finish", () => {
|
||||
@@ -10,7 +10,7 @@ writable.once("finish", () => {
|
||||
}, 500);
|
||||
});
|
||||
|
||||
let duplex = duplexer2(writable, readable);
|
||||
const duplex = duplexer2(writable, readable);
|
||||
|
||||
duplex.on("data", (e: any) => {
|
||||
console.log("got data", JSON.stringify(e));
|
||||
|
||||
@@ -10,7 +10,7 @@ import cs = require('coinstring');
|
||||
var ecparams = ecurve.getCurveByName('secp256k1');
|
||||
console.log(ecparams.n.toString(16));
|
||||
// => fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
|
||||
console.log(ecparams.G.getEncoded().toString('hex')); //getEncoded() returns type 'Buffer' instead of 'BigInteger'
|
||||
console.log(ecparams.G.getEncoded().toString('hex')); // getEncoded() returns type 'Buffer' instead of 'BigInteger'
|
||||
// => 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
|
||||
console.log(ecparams.h.toString(16));
|
||||
// => 1
|
||||
@@ -27,13 +27,13 @@ var publicKey = Buffer.concat([new Buffer([0x04]), x, y]);
|
||||
console.log(publicKey.toString('hex'));
|
||||
// => 04d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6fbdd594388756a7beaf73b4822bc22d36e9bda7db82df2b8b623673eefc0b7495
|
||||
|
||||
//alternatively
|
||||
publicKey = curvePt.getEncoded(false); //false forces uncompressed public key
|
||||
// alternatively
|
||||
publicKey = curvePt.getEncoded(false); // false forces uncompressed public key
|
||||
console.log(publicKey.toString('hex'));
|
||||
// => 04d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6fbdd594388756a7beaf73b4822bc22d36e9bda7db82df2b8b623673eefc0b7495
|
||||
|
||||
//want compressed?
|
||||
publicKey = curvePt.getEncoded(true); //true forces compressed public key
|
||||
// want compressed?
|
||||
publicKey = curvePt.getEncoded(true); // true forces compressed public key
|
||||
console.log(publicKey.toString('hex'));
|
||||
// => 03d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6f
|
||||
|
||||
@@ -45,10 +45,10 @@ console.log(pubkeyHash.toString('hex'));
|
||||
// => a1c2f92a9dacbd2991c3897724a93f338e44bdc1
|
||||
|
||||
// address of compressed public key
|
||||
console.log(cs.encode(pubkeyHash, 0x0)); //<-- 0x0 is for public addresses
|
||||
console.log(cs.encode(pubkeyHash, 0x0)); // <-- 0x0 is for public addresses
|
||||
// => 1FkKMsKNJqWSDvTvETqcCeHcUQQ64kSC6s
|
||||
|
||||
console.log(cs.encode(privateKey, 0x80)); //<--- 0x80 is for private addresses
|
||||
console.log(cs.encode(privateKey, 0x80)); // <--- 0x80 is for private addresses
|
||||
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
|
||||
|
||||
console.log(cs.encode(Buffer.concat([privateKey, new Buffer([0])]), 0x80)); // <-- compressed private address
|
||||
|
||||
@@ -112,7 +112,7 @@ Handlebars.registerHelper('highlight', (property: string, options: any) =>
|
||||
var coolView = App.CoolView.create();
|
||||
|
||||
var Person2 = Em.Object.extend<typeof Em.Object>({
|
||||
sayHello: function() {
|
||||
sayHello() {
|
||||
console.log('Hello from ' + this.get('name'));
|
||||
}
|
||||
});
|
||||
@@ -145,7 +145,7 @@ people2.everyProperty('isHappy', true);
|
||||
people2.someProperty('isHappy', true);
|
||||
|
||||
// Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html
|
||||
var promise = new Em.RSVP.Promise<string, string>(function(resolve: Function, reject: Function) {
|
||||
var promise = new Em.RSVP.Promise<string, string>((resolve: Function, reject: Function) => {
|
||||
// on success
|
||||
resolve('ok!');
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const result1: any = envToObject(map);
|
||||
const result2: any = envToObject(map, {
|
||||
parsers: {
|
||||
'my-custom-type': (str: string, opts: any) => {
|
||||
let foo: any = JSON.parse(str);
|
||||
const foo: any = JSON.parse(str);
|
||||
return foo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as extract from 'extract-zip';
|
||||
|
||||
let str = 'str';
|
||||
let num = 0;
|
||||
const str = 'str';
|
||||
const num = 0;
|
||||
|
||||
let options: extract.Options = {
|
||||
dir: str,
|
||||
|
||||
+35
-35
@@ -125,7 +125,7 @@ function sample3() {
|
||||
}
|
||||
});
|
||||
|
||||
fabric.Image.fromURL('../assets/printio.png', function(img) {
|
||||
fabric.Image.fromURL('../assets/printio.png', img => {
|
||||
var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9);
|
||||
canvas.add(oImg).renderAll();
|
||||
canvas.setActiveObject(oImg);
|
||||
@@ -213,7 +213,7 @@ function sample3() {
|
||||
function sample4() {
|
||||
|
||||
var canvas = new fabric.Canvas('c');
|
||||
var $: (id: string) => HTMLElement = function(id: string) { return document.getElementById(id); };
|
||||
var $: (id: string) => HTMLElement = id => document.getElementById(id);
|
||||
|
||||
var rect = new fabric.Rect({
|
||||
width: 100,
|
||||
@@ -274,10 +274,10 @@ declare module "fabric" {
|
||||
}
|
||||
|
||||
function sample5() {
|
||||
var makeCircle = function(left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle {
|
||||
var makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => {
|
||||
var c = <fabric.CircleWithLineInfos> new fabric.Circle({
|
||||
left: left,
|
||||
top: top,
|
||||
left,
|
||||
top,
|
||||
strokeWidth: 5,
|
||||
radius: 12,
|
||||
fill: '#fff',
|
||||
@@ -453,14 +453,14 @@ function sample8() {
|
||||
top = fabric.util.getRandomInt(0 + offset, 500 - offset),
|
||||
angle = fabric.util.getRandomInt(-20, 40),
|
||||
width = fabric.util.getRandomInt(30, 50),
|
||||
opacity = (function(min: number, max: number) { return Math.random() * (max - min) + min; })(0.5, 1);
|
||||
opacity = ((min: number, max: number) => Math.random() * (max - min) + min)(0.5, 1);
|
||||
|
||||
|
||||
switch (className) {
|
||||
case 'rect':
|
||||
canvas.add(new fabric.Rect({
|
||||
left: left,
|
||||
top: top,
|
||||
left,
|
||||
top,
|
||||
fill: '#' + getRandomColor(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
@@ -470,8 +470,8 @@ function sample8() {
|
||||
|
||||
case 'circle':
|
||||
canvas.add(new fabric.Circle({
|
||||
left: left,
|
||||
top: top,
|
||||
left,
|
||||
top,
|
||||
fill: '#' + getRandomColor(),
|
||||
radius: 50,
|
||||
opacity: 0.8
|
||||
@@ -480,8 +480,8 @@ function sample8() {
|
||||
|
||||
case 'triangle':
|
||||
canvas.add(new fabric.Triangle({
|
||||
left: left,
|
||||
top: top,
|
||||
left,
|
||||
top,
|
||||
fill: '#' + getRandomColor(),
|
||||
width: 50,
|
||||
height: 50,
|
||||
@@ -490,11 +490,11 @@ function sample8() {
|
||||
break;
|
||||
|
||||
case 'image1':
|
||||
fabric.Image.fromURL('../assets/pug.jpg', function(image) {
|
||||
fabric.Image.fromURL('../assets/pug.jpg', image => {
|
||||
image.set({
|
||||
left: left,
|
||||
top: top,
|
||||
angle: angle,
|
||||
left,
|
||||
top,
|
||||
angle,
|
||||
padding: 10,
|
||||
cornersize: 10
|
||||
});
|
||||
@@ -504,11 +504,11 @@ function sample8() {
|
||||
break;
|
||||
|
||||
case 'image2':
|
||||
fabric.Image.fromURL('../assets/logo.png', function(image) {
|
||||
fabric.Image.fromURL('../assets/logo.png', image => {
|
||||
image.set({
|
||||
left: left,
|
||||
top: top,
|
||||
angle: angle,
|
||||
left,
|
||||
top,
|
||||
angle,
|
||||
padding: 10,
|
||||
cornersize: 10
|
||||
});
|
||||
@@ -522,13 +522,13 @@ function sample8() {
|
||||
var id: any = element.id;
|
||||
const match = /\d+$/.exec(id);
|
||||
if (match) {
|
||||
fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function(objects, options) {
|
||||
fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', (objects, options) => {
|
||||
var loadedObject = fabric.util.groupSVGElements(objects, options);
|
||||
|
||||
loadedObject.set({
|
||||
left: left,
|
||||
top: top,
|
||||
angle: angle,
|
||||
left,
|
||||
top,
|
||||
angle,
|
||||
padding: 10,
|
||||
cornersize: 10
|
||||
});
|
||||
@@ -576,13 +576,13 @@ function sample8() {
|
||||
} else if (activeGroup) {
|
||||
var objectsInGroup = activeGroup.getObjects();
|
||||
canvas.discardActiveGroup();
|
||||
objectsInGroup.forEach(function(object) {
|
||||
objectsInGroup.forEach(object => {
|
||||
canvas.remove(object);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var supportsInputOfType = function(type: string) {
|
||||
var supportsInputOfType = (type: string) => {
|
||||
return () => {
|
||||
var el = document.createElement('input');
|
||||
try {
|
||||
@@ -755,7 +755,7 @@ function sample8() {
|
||||
lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation');
|
||||
}
|
||||
|
||||
canvas.on('selection:cleared', function(e) {
|
||||
canvas.on('selection:cleared', e => {
|
||||
for (var i = activeObjectButtons.length; i--; ) {
|
||||
activeObjectButtons[i];
|
||||
}
|
||||
@@ -763,8 +763,8 @@ function sample8() {
|
||||
|
||||
var drawingModeEl = document.getElementById('drawing-mode'),
|
||||
drawingOptionsEl = document.getElementById('drawing-mode-options'),
|
||||
drawingColorEl = document.getElementById('drawing-color'),
|
||||
drawingLineWidthEl = document.getElementById('drawing-line-width');
|
||||
drawingColorEl = <HTMLInputElement> document.getElementById('drawing-color'),
|
||||
drawingLineWidthEl = <HTMLInputElement> document.getElementById('drawing-line-width');
|
||||
|
||||
drawingModeEl.onclick = () => {
|
||||
var canvasWithDrawingMode: any = canvas;
|
||||
@@ -814,7 +814,7 @@ function sample8() {
|
||||
};
|
||||
|
||||
|
||||
document.onkeydown = function(e) {
|
||||
document.onkeydown = e => {
|
||||
var obj = canvas.getActiveObject() || canvas.getActiveGroup();
|
||||
if (obj && e.keyCode === 8) {
|
||||
// this is horrible. need to fix, so that unified interface can be used
|
||||
@@ -825,7 +825,7 @@ function sample8() {
|
||||
// canvas.remove(obj);
|
||||
// });
|
||||
} else {
|
||||
//canvas.remove(obj);
|
||||
// canvas.remove(obj);
|
||||
}
|
||||
canvas.renderAll();
|
||||
// return false;
|
||||
@@ -837,8 +837,8 @@ function sample8() {
|
||||
}, 100);
|
||||
|
||||
if (document.location.search.indexOf('guidelines') > -1) {
|
||||
//initCenteringGuidelines(canvas);
|
||||
//initAligningGuidelines(canvas);
|
||||
// initCenteringGuidelines(canvas);
|
||||
// initAligningGuidelines(canvas);
|
||||
}
|
||||
|
||||
gradientifyBtn.onclick = () => {
|
||||
@@ -856,7 +856,7 @@ function sample8() {
|
||||
}
|
||||
};
|
||||
|
||||
var textEl = document.getElementById('text');
|
||||
var textEl = <HTMLInputElement> document.getElementById('text');
|
||||
if (textEl) {
|
||||
textEl.onfocus = function() {
|
||||
var activeObject = canvas.getActiveObject();
|
||||
@@ -1032,7 +1032,7 @@ function sample8() {
|
||||
|
||||
document.getElementById('load-svg').onclick = () => {
|
||||
var svg = (<HTMLInputElement> document.getElementById('svg-console')).value;
|
||||
fabric.loadSVGFromString(svg, function(objects, options) {
|
||||
fabric.loadSVGFromString(svg, (objects, options) => {
|
||||
var obj = fabric.util.groupSVGElements(objects, options);
|
||||
canvas.add(obj).centerObject(obj).renderAll();
|
||||
obj.setCoords();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import falcor = require('falcor');
|
||||
|
||||
let dataSource: falcor.DataSource;
|
||||
declare const dataSource: falcor.DataSource;
|
||||
dataSource.get([['someParam']]).subscribe(jsonGraphEnvelope => {
|
||||
console.log(jsonGraphEnvelope.jsonGraph);
|
||||
});
|
||||
|
||||
@@ -24,14 +24,14 @@ fetchMock.calls().unmatched[0][0].toUpperCase();
|
||||
fetchMock.calls("http://test.com")[0][0].toUpperCase();
|
||||
(fetchMock.calls("http://test.com")[0][1] as RequestInit).body;
|
||||
|
||||
let doneStatus: boolean = fetchMock.done();
|
||||
let doneStatusArguments: boolean = fetchMock.done("http://test.com");
|
||||
const doneStatus: boolean = fetchMock.done();
|
||||
const doneStatusArguments: boolean = fetchMock.done("http://test.com");
|
||||
|
||||
let calledStatus: boolean = fetchMock.called();
|
||||
let calledStatusArguments = fetchMock.called("http://test.com");
|
||||
const calledStatus: boolean = fetchMock.called();
|
||||
const calledStatusArguments = fetchMock.called("http://test.com");
|
||||
|
||||
(fetchMock.lastCall()[1] as RequestInit).body;
|
||||
let lastUrl: string = fetchMock.lastUrl();
|
||||
const lastUrl: string = fetchMock.lastUrl();
|
||||
fetchMock.lastOptions();
|
||||
|
||||
fetchMock.get("http://test.com", 200);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
function testBlob() {
|
||||
let config: qq.BasicOptions = {
|
||||
const config: qq.BasicOptions = {
|
||||
blobs: {
|
||||
defaultName: "hi.png"
|
||||
}
|
||||
};
|
||||
|
||||
let uploader = new qq.FineUploaderBasic(config);
|
||||
const uploader = new qq.FineUploaderBasic(config);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class CallbacksTest {
|
||||
}
|
||||
|
||||
testCallbacks() {
|
||||
let opts = this.opts;
|
||||
const opts = this.opts;
|
||||
|
||||
interface CustomType {
|
||||
myTypeOfClass: string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
function testCore() {
|
||||
let button: HTMLElement = new HTMLButtonElement();
|
||||
const button: HTMLElement = new HTMLButtonElement();
|
||||
|
||||
let config: qq.BasicOptions = {
|
||||
const config: qq.BasicOptions = {
|
||||
autoUpload: true,
|
||||
button: button,
|
||||
button,
|
||||
debug: true,
|
||||
disableCancelForFormUploads: true,
|
||||
formatFileName: (rawFileName: string) => {
|
||||
@@ -13,5 +13,5 @@ function testCore() {
|
||||
multiple: true
|
||||
};
|
||||
|
||||
let uploader = new qq.FineUploaderBasic(config);
|
||||
const uploader = new qq.FineUploaderBasic(config);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ function deleteFileTest() {
|
||||
myParam: string;
|
||||
}
|
||||
|
||||
let deleteFileOptions: qq.DeleteFileOptions<CustomHeader, CustomParams> = {
|
||||
const deleteFileOptions: qq.DeleteFileOptions<CustomHeader, CustomParams> = {
|
||||
customHeader: {
|
||||
myOption: "ewwww"
|
||||
},
|
||||
@@ -20,9 +20,9 @@ function deleteFileTest() {
|
||||
};
|
||||
|
||||
|
||||
let config: qq.BasicOptions = {
|
||||
const config: qq.BasicOptions = {
|
||||
deleteFile: deleteFileOptions
|
||||
};
|
||||
|
||||
let uploader = new qq.FineUploaderBasic(config);
|
||||
const uploader = new qq.FineUploaderBasic(config);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ function extraButtons() {
|
||||
myValue: string;
|
||||
}
|
||||
|
||||
let element: HTMLElement = new HTMLElement();
|
||||
const element: HTMLElement = new HTMLElement();
|
||||
|
||||
let extraButtonOptions: qq.ExtraButtonsOptions<Validation> = {
|
||||
element: element,
|
||||
const extraButtonOptions: qq.ExtraButtonsOptions<Validation> = {
|
||||
element,
|
||||
fileInputTitle: "inputTitle",
|
||||
folders: true,
|
||||
multiple: false,
|
||||
@@ -15,9 +15,9 @@ function extraButtons() {
|
||||
}
|
||||
};
|
||||
|
||||
let config: qq.BasicOptions = {
|
||||
const config: qq.BasicOptions = {
|
||||
extraButtons: extraButtonOptions
|
||||
};
|
||||
|
||||
let uploader = new qq.FineUploaderBasic(config);
|
||||
const uploader = new qq.FineUploaderBasic(config);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
function formTest() {
|
||||
let formOptions: qq.FormOptions = {
|
||||
const formOptions: qq.FormOptions = {
|
||||
element: "qq-form",
|
||||
autoUpload: true,
|
||||
interceptSubmit: true
|
||||
};
|
||||
|
||||
let config: qq.BasicOptions = {
|
||||
const config: qq.BasicOptions = {
|
||||
form: formOptions
|
||||
};
|
||||
|
||||
let uploader = new qq.FineUploaderBasic(config);
|
||||
const uploader = new qq.FineUploaderBasic(config);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function messageTest() {
|
||||
let messageOptions: qq.MessagesOptions = {
|
||||
const messageOptions: qq.MessagesOptions = {
|
||||
emptyError: "emptyError",
|
||||
maxHeightImageError: "maxHeightImageError",
|
||||
maxWidthImageError: "error occurred",
|
||||
@@ -13,9 +13,9 @@ function messageTest() {
|
||||
unsupportedBrowserIos8Safari: "error occurred"
|
||||
};
|
||||
|
||||
let config: qq.BasicOptions = {
|
||||
const config: qq.BasicOptions = {
|
||||
messages: messageOptions
|
||||
};
|
||||
|
||||
let uploader = new qq.FineUploaderBasic(config);
|
||||
const uploader = new qq.FineUploaderBasic(config);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class TestMethods {
|
||||
interface ResponseType {
|
||||
hi: string;
|
||||
}
|
||||
let response: ResponseType | ResponseType[] = this.uploader.getUploads<ResponseType>({
|
||||
const response: ResponseType | ResponseType[] = this.uploader.getUploads<ResponseType>({
|
||||
status: "proggresssssssesees"
|
||||
});
|
||||
}
|
||||
@@ -98,8 +98,8 @@ class TestMethods {
|
||||
this.uploader.clearStoredFiles();
|
||||
const shouldContinue: boolean = this.uploader.continueUpload(1234);
|
||||
this.uploader.deleteFile(1234);
|
||||
let elem: HTMLElement = this.uploader.getButton(1234);
|
||||
let fileOrBlob: File | Blob = this.uploader.getFile(1234);
|
||||
const elem: HTMLElement = this.uploader.getButton(1234);
|
||||
const fileOrBlob: File | Blob = this.uploader.getFile(1234);
|
||||
let num: number = this.uploader.getInProgress();
|
||||
let s: string = this.uploader.getName(1234);
|
||||
num = this.uploader.getParentId(1234);
|
||||
@@ -108,7 +108,7 @@ class TestMethods {
|
||||
num = this.uploader.getSize(1234);
|
||||
s = this.uploader.getUuid(1234);
|
||||
this.uploader.log("why am i doing this?", "info");
|
||||
let b: boolean = this.uploader.pauseUpload(1234);
|
||||
const b: boolean = this.uploader.pauseUpload(1234);
|
||||
this.uploader.reset();
|
||||
this.uploader.retry(1234);
|
||||
const blobPromise: Promise<Blob> = this.uploader.scaleImage(1234, {
|
||||
@@ -133,7 +133,7 @@ class TestMethods {
|
||||
uiTests() {
|
||||
this.uploader.addExtraDropzone(new HTMLElement());
|
||||
let elem: HTMLElement = this.uploader.getDropTarget(1234);
|
||||
let n: number = this.uploader.getId(elem);
|
||||
const n: number = this.uploader.getId(elem);
|
||||
elem = this.uploader.getItemByFileId(n);
|
||||
this.uploader.removeExtraDropzone(elem);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ function pasteTest() {
|
||||
|
||||
const pasteOptions: qq.PasteOptions = {
|
||||
defaultName: "pasted_image",
|
||||
targetElement: targetElement
|
||||
targetElement
|
||||
};
|
||||
|
||||
const config: qq.BasicOptions = {
|
||||
|
||||
@@ -43,7 +43,7 @@ async function test() {
|
||||
json = await fs.readJson(path, readJsonOptions);
|
||||
json = await fs.readJSON(path, readJsonOptions);
|
||||
await fs.remove(path);
|
||||
let dirs: string[] = await fs.walk(dir);
|
||||
const dirs: string[] = await fs.walk(dir);
|
||||
await fs.writeJson(path, data);
|
||||
await fs.writeJson(path, data, writeJsonOptions);
|
||||
await fs.writeJSON(path, data, writeJsonOptions);
|
||||
|
||||
Vendored
+1
-1
@@ -135,7 +135,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
|
||||
eventAfterAllRender?: (view: ViewObject) => void;
|
||||
eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void;
|
||||
|
||||
//scheduler options
|
||||
// scheduler options
|
||||
resourceAreaWidth?: number;
|
||||
schedulerLicenseKey?: string;
|
||||
customButtons?: any;
|
||||
|
||||
@@ -11,7 +11,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
dayClick: function () {
|
||||
dayClick: () => {
|
||||
alert('a day has been clicked!');
|
||||
}
|
||||
});
|
||||
@@ -66,13 +66,13 @@ $('#calendar').fullCalendar({
|
||||
$('#calendar').fullCalendar('option', 'aspectRatio', 1.8);
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
viewRender: function (view) {
|
||||
viewRender: view => {
|
||||
alert('The new title of the view is ' + view.title);
|
||||
}
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
windowResize: function (view) {
|
||||
windowResize: view => {
|
||||
alert('The calendar has adjusted to a window resize');
|
||||
}
|
||||
});
|
||||
@@ -86,7 +86,7 @@ $('#calendar').fullCalendar({
|
||||
var view = $('#calendar').fullCalendar('getView');
|
||||
alert("The view's title is " + view.title);
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
@@ -150,7 +150,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
@@ -215,7 +215,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
@@ -269,7 +269,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
@@ -334,7 +334,7 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
@@ -388,21 +388,21 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$('#my-prev-button').click(function () {
|
||||
$('#my-prev-button').click(() => {
|
||||
$('#calendar').fullCalendar('prev');
|
||||
});
|
||||
|
||||
$('#my-next-button').click(function () {
|
||||
$('#my-next-button').click(() => {
|
||||
$('#calendar').fullCalendar('next');
|
||||
});
|
||||
|
||||
$('#my-today-button').click(function () {
|
||||
$('#my-today-button').click(() => {
|
||||
$('#calendar').fullCalendar('today');
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar('gotoDate', 1, 0, 1);
|
||||
|
||||
$('#my-button').click(function () {
|
||||
$('#my-button').click(() => {
|
||||
var d = $('#calendar').fullCalendar('getDate');
|
||||
alert("The current date of the calendar is " + d);
|
||||
});
|
||||
@@ -427,7 +427,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
dayClick: function (date, allDay, jsEvent, view) {
|
||||
dayClick(date, allDay, jsEvent, view) {
|
||||
|
||||
if (allDay) {
|
||||
alert('Clicked on the entire day: ' + date);
|
||||
@@ -446,7 +446,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventClick: function (calEvent, jsEvent, view) {
|
||||
eventClick(calEvent, jsEvent, view) {
|
||||
|
||||
alert('Event: ' + calEvent.title);
|
||||
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
|
||||
@@ -467,7 +467,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
// other events here
|
||||
],
|
||||
eventClick: function (event) {
|
||||
eventClick(event) {
|
||||
if (event.url) {
|
||||
window.open(event.url);
|
||||
return false;
|
||||
@@ -487,7 +487,7 @@ $('#calendar').fullCalendar({
|
||||
custom_param1: 'something',
|
||||
custom_param2: 'somethingelse'
|
||||
},
|
||||
error: function () {
|
||||
error: () => {
|
||||
alert('there was an error while fetching events!');
|
||||
},
|
||||
color: 'yellow', // a non-ajax option
|
||||
@@ -509,7 +509,7 @@ $('#calendar').fullCalendar({
|
||||
custom_param1: 'something',
|
||||
custom_param2: 'somethingelse'
|
||||
},
|
||||
error: function () {
|
||||
error: () => {
|
||||
alert('there was an error while fetching events!');
|
||||
},
|
||||
color: 'yellow', // a non-ajax option
|
||||
@@ -599,7 +599,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
events: function (start: any, end: any, callback: any) {
|
||||
events(start: any, end: any, callback: any) {
|
||||
$.ajax({
|
||||
url: 'myxmlfeed.php',
|
||||
dataType: 'xml',
|
||||
@@ -608,9 +608,9 @@ $('#calendar').fullCalendar({
|
||||
start: Math.round(start.getTime() / 1000),
|
||||
end: Math.round(end.getTime() / 1000)
|
||||
},
|
||||
success: function (doc) {
|
||||
success(doc) {
|
||||
var events: any[] = [];
|
||||
$(doc).find('event').each(function () {
|
||||
$(doc).find('event').each(() => {
|
||||
events.push({
|
||||
title: $(this).attr('title'),
|
||||
start: $(this).attr('start') // will be parsed
|
||||
@@ -628,7 +628,7 @@ $('#calendar').fullCalendar({
|
||||
|
||||
// your event source
|
||||
{
|
||||
events: function (start: any, end: any, callback: any) {
|
||||
events(start: any, end: any, callback: any) {
|
||||
// ...
|
||||
},
|
||||
color: 'yellow', // an option!
|
||||
@@ -649,7 +649,7 @@ $('#calendar').fullCalendar({
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
eventClick: function (event, element) {
|
||||
eventClick(event, element) {
|
||||
|
||||
event.title = "CLICKED!";
|
||||
|
||||
@@ -681,7 +681,7 @@ $('#calendar').fullCalendar({
|
||||
}
|
||||
// more events here
|
||||
],
|
||||
eventRender: function (event: EventWithDescription, element: any) {
|
||||
eventRender(event: EventWithDescription, element: any) {
|
||||
element.qtip({
|
||||
content: event.description
|
||||
});
|
||||
@@ -694,7 +694,7 @@ $('#my-draggable').draggable({
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
droppable: true,
|
||||
drop: function (date, allDay) {
|
||||
drop(date, allDay) {
|
||||
alert("Dropped on " + date + " with allDay=" + allDay);
|
||||
}
|
||||
});
|
||||
@@ -702,7 +702,7 @@ $('#calendar').fullCalendar({
|
||||
$('#calendar').fullCalendar({
|
||||
droppable: true,
|
||||
dropAccept: '.cool-event',
|
||||
drop: function () {
|
||||
drop: () => {
|
||||
alert('dropped!');
|
||||
}
|
||||
});
|
||||
@@ -710,7 +710,7 @@ $('#calendar').fullCalendar({
|
||||
$('#draggable1').draggable();
|
||||
$('#draggable2').draggable();
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
|
||||
var date = new Date();
|
||||
var d = date.getDate();
|
||||
@@ -775,10 +775,10 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(() => {
|
||||
/* initialize the external events
|
||||
-----------------------------------------------------------------*/
|
||||
$('#external-events div.external-event').each(function () {
|
||||
$('#external-events div.external-event').each(() => {
|
||||
|
||||
// create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
|
||||
// it doesn't need to have a start or end
|
||||
@@ -808,7 +808,7 @@ $(document).ready(function () {
|
||||
},
|
||||
editable: true,
|
||||
droppable: true, // this allows things to be dropped onto the calendar !!!
|
||||
drop: function (date, allDay) { // this function is called when something is dropped
|
||||
drop(date, allDay) { // this function is called when something is dropped
|
||||
|
||||
// retrieve the dropped element's stored Event Object
|
||||
var originalEventObject = $(this).data('eventObject');
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
describe("tester Google Analytics Tracker _gat object", () => {
|
||||
it("can set ga script element", () => {
|
||||
gaClassic = <HTMLScriptElement>document.createElement("script");
|
||||
gaClassic = <HTMLScriptElement> document.createElement("script");
|
||||
});
|
||||
it("can set aync to true", () => {
|
||||
gaClassic.async = true;
|
||||
});
|
||||
it("can set src to string url", () => {
|
||||
gaClassic.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
gaClassic.src = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
});
|
||||
it("can set type", () => {
|
||||
gaClassic.type = 'text/javascript';
|
||||
@@ -27,10 +27,10 @@ describe('UniversalAnalytics', () => {
|
||||
ga('send', {hitType: 'event', eventCategory: 'Videos', eventAction: 'play', eventLabel: 'Fall Campaign'});
|
||||
ga('send', 'event', 'Videos', 'play', 'Fall Campaign', {nonInteraction: true});
|
||||
ga('send', 'pageview', '/page');
|
||||
ga('send', 'social', {'socialNetwork': 'facebook', 'socialAction': 'like', 'socialTarget': 'http://foo.com'});
|
||||
ga('send', 'social', {'socialNetwork': 'google+', 'socialAction': 'plus', 'socialTarget': 'http://foo.com'});
|
||||
ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123});
|
||||
ga('send', 'timing', {'timingCategory': 'category', 'timingVar': 'lookup', 'timingValue': 123, 'timingLabel': 'label'});
|
||||
ga('send', 'social', {socialNetwork: 'facebook', socialAction: 'like', socialTarget: 'http://foo.com'});
|
||||
ga('send', 'social', {socialNetwork: 'google+', socialAction: 'plus', socialTarget: 'http://foo.com'});
|
||||
ga('send', 'timing', {timingCategory: 'category', timingVar: 'lookup', timingValue: 123});
|
||||
ga('send', 'timing', {timingCategory: 'category', timingVar: 'lookup', timingValue: 123, timingLabel: 'label'});
|
||||
ga('trackerName.send', 'event', 'load');
|
||||
|
||||
ga.create('UA-65432-1', 'auto');
|
||||
|
||||
Vendored
+1
-1
@@ -87,7 +87,7 @@ declare namespace UniversalAnalytics {
|
||||
|
||||
getAll(): UniversalAnalytics.Tracker[];
|
||||
getByName(name: string): UniversalAnalytics.Tracker;
|
||||
remove(name:string): void;
|
||||
remove(name: string): void;
|
||||
}
|
||||
|
||||
interface Tracker {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"dt-header": false,
|
||||
"forbidden-types": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
@@ -63,8 +63,8 @@ $('.cep_with_callback').mask('00000-000', options);
|
||||
// on the fly mask changed
|
||||
options = {
|
||||
onKeyPress(cep, e, field, options) {
|
||||
let masks: string[] = ['00000-000', '0-00-00-00'];
|
||||
let mask: string = (cep.length > 7) ? masks[1] : masks[0];
|
||||
const masks: string[] = ['00000-000', '0-00-00-00'];
|
||||
const mask: string = (cep.length > 7) ? masks[1] : masks[0];
|
||||
$('.crazy_cep').mask(mask, options);
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+14
-16
@@ -1,22 +1,20 @@
|
||||
// Type definitions for JSData Http Adapter v1.2.0
|
||||
// Project: https://github.com/js-data/js-data-http
|
||||
// Type definitions for JSData Http Adapter 1.2
|
||||
// Project: https://github.com/js-data/js-data-http 2.2
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="js-data" />
|
||||
|
||||
import * as JSData from 'js-data';
|
||||
|
||||
declare module 'js-data' {
|
||||
|
||||
interface DSHttpAdapterOptions {
|
||||
serialize?: (resourceName:string, data:any)=>any;
|
||||
deserialize?: (resourceName:string, data:any)=>any;
|
||||
queryTransform?: (resourceName:string, params:DSFilterParams)=>any;
|
||||
serialize?: (resourceName: string, data: any) => any;
|
||||
deserialize?: (resourceName: string, data: any) => any;
|
||||
queryTransform?: (resourceName: string, params: DSFilterParams) => any;
|
||||
httpConfig?: any;
|
||||
forceTrailingSlash?: boolean;
|
||||
log?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
error?: boolean | ((message?:any, ...optionalParams:any[])=> void);
|
||||
log?: boolean | ((message?: any, ...optionalParams: any[]) => void);
|
||||
error?: boolean | ((message?: any, ...optionalParams: any[]) => void);
|
||||
basePath?: string;
|
||||
verbsUseBasePath?: string;
|
||||
}
|
||||
@@ -30,20 +28,20 @@ declare module 'js-data' {
|
||||
|
||||
interface DSHttpAdapter extends IDSAdapter {
|
||||
|
||||
new(options?:DSHttpAdapterOptions):DSHttpAdapter;
|
||||
new(options?: DSHttpAdapterOptions): DSHttpAdapter;
|
||||
|
||||
defaults: DSHttpAdapterOptions;
|
||||
http: any;
|
||||
|
||||
// DSHttpAdapter uses axios so options are axios config objects.
|
||||
HTTP(options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
DEL(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
GET(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
POST(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
PUT(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
HTTP(options?: Object): JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
DEL(url: string, data?: Object, options?: Object): JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
GET(url: string, data?: Object, options?: Object): JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
POST(url: string, data?: Object, options?: Object): JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
PUT(url: string, data?: Object, options?: Object): JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var DSHttpAdapter:JSData.DSHttpAdapter;
|
||||
declare var DSHttpAdapter: JSData.DSHttpAdapter;
|
||||
export = DSHttpAdapter;
|
||||
export as namespace DSHttpAdapter;
|
||||
@@ -1,8 +1,7 @@
|
||||
/// <reference types="axios" />
|
||||
import * as JSData from 'js-data';
|
||||
import DSHttpAdapter = require("js-data-http");
|
||||
|
||||
import * as axios from 'axios';
|
||||
declare var axios: any;
|
||||
|
||||
var adapter = new DSHttpAdapter();
|
||||
var store = new JSData.DS();
|
||||
@@ -11,12 +10,12 @@ store.registerAdapter('http', adapter, { default: true });
|
||||
adapter.defaults.basePath = '/api';
|
||||
adapter.http = axios;
|
||||
|
||||
var ADocument:JSData.DSResourceDefinition<any> = store.defineResource<any>('document');
|
||||
var ADocument: JSData.DSResourceDefinition<any> = store.defineResource<any>('document');
|
||||
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.update(ADocument, 5, { author: 'Johnny' }).then(function (document:any) {
|
||||
adapter.update(ADocument, 5, { author: 'Johnny' }).then((document: any) => {
|
||||
document; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// The updated document has NOT been injected into the data store because we bypassed the data store
|
||||
@@ -24,7 +23,7 @@ adapter.update(ADocument, 5, { author: 'Johnny' }).then(function (document:any)
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.update(5, { author: 'Johnny' }).then(function (document:any) {
|
||||
ADocument.update(5, { author: 'Johnny' }).then((document: any) => {
|
||||
document; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// the updated document has been injected into the data store
|
||||
@@ -35,7 +34,7 @@ ADocument.inject({ id: 5, author: 'John' });
|
||||
ADocument.inject({ id: 6, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(documents => {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// The updated documents have NOT been injected into the data store because we bypassed the data store
|
||||
@@ -44,7 +43,7 @@ adapter.updateAll(ADocument, { author: 'Johnny' }, { author: 'John' }).then(func
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (documents) {
|
||||
ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(documents => {
|
||||
documents[0]; // { id: 5, author: 'Johnny' }
|
||||
|
||||
// the updated documents have been injected into the data store
|
||||
@@ -52,44 +51,44 @@ ADocument.updateAll({ author: 'Johnny' }, { author: 'John' }).then(function (doc
|
||||
ADocument.filter({ author: 'Johnny' }); // [{...}, {...}]
|
||||
});
|
||||
|
||||
adapter.PUT('/user/1', { name: 'Johnny' }).then(function (data) {
|
||||
adapter.PUT('/user/1', { name: 'Johnny' }).then(data => {
|
||||
data.data; // { id: 1, name: 'Johnny', ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
data.config; // {...}
|
||||
});
|
||||
|
||||
adapter.POST('/user/1', { name: 'John' }).then(function (data) {
|
||||
adapter.POST('/user/1', { name: 'John' }).then(data => {
|
||||
data.data; // { id: 1, name: 'John', ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
data.config; // {...}
|
||||
});
|
||||
|
||||
adapter.HTTP({ url: '/user/1', method: 'put', data: { name: 'Johnny' }}).then(function (data) {
|
||||
adapter.HTTP({ url: '/user/1', method: 'put', data: { name: 'Johnny' }}).then(data => {
|
||||
data.data; // { id: 1, name: 'Johnny', ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
data.config; // {...}
|
||||
});
|
||||
|
||||
adapter.GET('/user/1').then(function (data) {
|
||||
adapter.GET('/user/1').then(data => {
|
||||
data.data; // { id: 1, ... }
|
||||
data.headers; // {...}
|
||||
data.status; // 200
|
||||
data.config; //{...}
|
||||
data.config; // {...}
|
||||
});
|
||||
|
||||
var User:JSData.DSResourceDefinition<any> = store.defineResource('user');
|
||||
var User: JSData.DSResourceDefinition<any> = store.defineResource('user');
|
||||
|
||||
var params:any = {
|
||||
var params: any = {
|
||||
age: {
|
||||
'>': 30
|
||||
}
|
||||
};
|
||||
|
||||
// bypass the data store
|
||||
adapter.findAll(User, params).then(function (users) {
|
||||
adapter.findAll(User, params).then(users => {
|
||||
// users[0].age; 55 // etc., etc.
|
||||
|
||||
// the users have NOT been injected into the data store because we bypassed the data store
|
||||
@@ -97,7 +96,7 @@ adapter.findAll(User, params).then(function (users) {
|
||||
});
|
||||
|
||||
// normally you would go through the data store
|
||||
User.findAll(params).then(function (users) {
|
||||
User.findAll(params).then(users => {
|
||||
// users[0].age; 55 // etc., etc.
|
||||
|
||||
// the users have been injected into the data store
|
||||
@@ -105,7 +104,7 @@ User.findAll(params).then(function (users) {
|
||||
});
|
||||
|
||||
// bypass the data store
|
||||
adapter.find(ADocument, 5).then(function (document:any) {
|
||||
adapter.find(ADocument, 5).then((document: any) => {
|
||||
document; // { id: 5, author: 'John Anderson' }
|
||||
|
||||
// the document has NOT been injected into the data store because we bypassed the data store
|
||||
@@ -113,25 +112,25 @@ adapter.find(ADocument, 5).then(function (document:any) {
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.find(5).then(function (document:any) {
|
||||
ADocument.find(5).then((document: any) => {
|
||||
document; // { id: 5, author: 'John Anderson' }
|
||||
|
||||
// the document has been injected into the data store
|
||||
ADocument.get(document.id); // { id: 5, author: 'John Anderson' }
|
||||
});
|
||||
|
||||
var params:any = {
|
||||
var params: any = {
|
||||
author: 'John'
|
||||
};
|
||||
|
||||
// bypass the data store
|
||||
adapter.destroyAll(ADocument, params).then(function () {
|
||||
adapter.destroyAll(ADocument, params).then(() => {
|
||||
// the documents have NOT been ejected from the data store because we bypassed the data store
|
||||
ADocument.filter(params); // [{...}, {...}, ...]
|
||||
});
|
||||
|
||||
// normally you would go through the data store
|
||||
ADocument.destroyAll(params).then(function () {
|
||||
ADocument.destroyAll(params).then(() => {
|
||||
// the documents have been ejected from the data store
|
||||
ADocument.filter(params); // []
|
||||
});
|
||||
@@ -139,26 +138,26 @@ ADocument.destroyAll(params).then(function () {
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
|
||||
// bypass the data store
|
||||
adapter.destroy(ADocument, 5).then(function () {
|
||||
adapter.destroy(ADocument, 5).then(() => {
|
||||
// the document is still in the data store because we bypassed the data store
|
||||
//ADocument.get(document.id); // { id: 5, author: 'John' }
|
||||
// ADocument.get(document.id); // { id: 5, author: 'John' }
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.destroy(5).then(function () {
|
||||
ADocument.destroy(5).then(() => {
|
||||
// the document has been ejected from the data store
|
||||
//ADocument.get(document.id); // undefined
|
||||
// ADocument.get(document.id); // undefined
|
||||
});
|
||||
|
||||
adapter.DEL('/user/1').then(function (data) {
|
||||
adapter.DEL('/user/1').then(data => {
|
||||
data.data; // 1
|
||||
data.headers; // {...}
|
||||
data.status; // 204
|
||||
data.config; //{...}
|
||||
data.config; // {...}
|
||||
});
|
||||
|
||||
// bypass the data store
|
||||
adapter.create(ADocument, { author: 'John' }).then(function (document:any) {
|
||||
adapter.create(ADocument, { author: 'John' }).then((document: any) => {
|
||||
document; // { id: 5, author: 'John' }
|
||||
|
||||
// The new document has NOT been injected into the data store because we bypassed the data store
|
||||
@@ -166,7 +165,7 @@ adapter.create(ADocument, { author: 'John' }).then(function (document:any) {
|
||||
});
|
||||
|
||||
// Normally you would just go through the data store
|
||||
ADocument.create({ author: 'John' }).then(function (document:any) {
|
||||
ADocument.create({ author: 'John' }).then((document: any) => {
|
||||
document; // { id: 5, author: 'John' }
|
||||
|
||||
// the new document has been injected into the data store
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"forbidden-types": false,
|
||||
"no-misused-new": false
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ qty.format(); // same units, current default formatter => '1.12 m'
|
||||
|
||||
Qty('37 tempC').to('tempF'); // => 98.6 tempF
|
||||
|
||||
let scalar: number = 42;
|
||||
const scalar: number = 42;
|
||||
|
||||
Qty('100 tempC').add('10 degC'); // 110 tempC
|
||||
Qty('100 tempC').sub('10 degC'); // 90 tempC
|
||||
@@ -1324,7 +1324,7 @@ describe("js-quantities", () => {
|
||||
it("should divide while trying to avoid numerical errors", () => {
|
||||
expect(Qty.divSafe(0.000773, 0.000001)).toBe(773);
|
||||
// TODO uncomment and fix
|
||||
//expect(Qty.divSafe(24.5, 0.2777777777777778)).toBe(88.2);
|
||||
// expect(Qty.divSafe(24.5, 0.2777777777777778)).toBe(88.2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+13
-13
@@ -141,9 +141,9 @@ let layer: L.Layer;
|
||||
|
||||
const htmlElement = document.getElementById('foo');
|
||||
|
||||
let popupOptions: L.PopupOptions = {};
|
||||
const popupOptions: L.PopupOptions = {};
|
||||
|
||||
let tooltipOptions: L.TooltipOptions = {};
|
||||
const tooltipOptions: L.TooltipOptions = {};
|
||||
|
||||
let zoomPanOptions: L.ZoomPanOptions = {};
|
||||
zoomPanOptions = {
|
||||
@@ -153,11 +153,11 @@ zoomPanOptions = {
|
||||
noMoveStart: true
|
||||
};
|
||||
|
||||
let zoomOptions: L.ZoomOptions = {};
|
||||
const zoomOptions: L.ZoomOptions = {};
|
||||
|
||||
let panOptions: L.PanOptions = {};
|
||||
const panOptions: L.PanOptions = {};
|
||||
|
||||
let fitBoundsOptions: L.FitBoundsOptions = {};
|
||||
const fitBoundsOptions: L.FitBoundsOptions = {};
|
||||
|
||||
let map = L.map('foo');
|
||||
map = L.map('foo', mapOptions);
|
||||
@@ -245,7 +245,7 @@ tileLayerOptions.subdomains = ['a', 'b'];
|
||||
|
||||
tileLayerOptions.tileSize = 256;
|
||||
tileLayerOptions.tileSize = point;
|
||||
//tileLayerOptions.tileSize = pointTuple; investigate if this is valid
|
||||
// tileLayerOptions.tileSize = pointTuple; investigate if this is valid
|
||||
|
||||
tileLayerOptions.bounds = latLngBounds;
|
||||
tileLayerOptions.bounds = latLngBoundsLiteral;
|
||||
@@ -259,8 +259,8 @@ tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png');
|
||||
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions);
|
||||
tileLayer = new L.TileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
|
||||
|
||||
let eventHandler = () => {};
|
||||
let domEvent: Event = {} as Event;
|
||||
const eventHandler = () => {};
|
||||
const domEvent: Event = {} as Event;
|
||||
L.DomEvent
|
||||
.on(htmlElement, 'click', eventHandler)
|
||||
.addListener(htmlElement, 'click', eventHandler)
|
||||
@@ -381,8 +381,8 @@ map = map
|
||||
.whenReady(() => {})
|
||||
.whenReady(() => {}, {});
|
||||
|
||||
let elementToDrag = document.createElement('div');
|
||||
let draggable = new L.Draggable(elementToDrag);
|
||||
const elementToDrag = document.createElement('div');
|
||||
const draggable = new L.Draggable(elementToDrag);
|
||||
draggable.enable();
|
||||
draggable.disable();
|
||||
draggable.on('drag', () => {});
|
||||
@@ -396,7 +396,7 @@ latLng = L.GeoJSON.coordsToLatLng(threeCoords);
|
||||
threeCoords = L.GeoJSON.latLngToCoords(latLng);
|
||||
|
||||
let nestedTwoCoords = [ [12, 13], [13, 14], [14, 15] ];
|
||||
let nestedLatLngs: L.LatLng[] = L.GeoJSON.coordsToLatLngs(nestedTwoCoords, 1);
|
||||
const nestedLatLngs: L.LatLng[] = L.GeoJSON.coordsToLatLngs(nestedTwoCoords, 1);
|
||||
nestedTwoCoords = L.GeoJSON.latLngsToCoords(nestedLatLngs, 1);
|
||||
|
||||
class MyMarker extends L.Marker {
|
||||
@@ -427,8 +427,8 @@ const divIcon = L.divIcon({html: ''});
|
||||
let defaultIcon = new L.Icon.Default();
|
||||
defaultIcon = new L.Icon.Default({imagePath: 'apath'});
|
||||
|
||||
let myControlClass = L.Control.extend({});
|
||||
let myControl = new myControlClass();
|
||||
const myControlClass = L.Control.extend({});
|
||||
const myControl = new myControlClass();
|
||||
|
||||
L.Control.include({});
|
||||
L.Control.mergeOptions({});
|
||||
|
||||
Vendored
+12
-12
@@ -17,14 +17,14 @@ interface _IMobservableStatic {
|
||||
* @param properties the properties that should be added and made reactive
|
||||
* @returns targer
|
||||
*/
|
||||
extendReactive(target: Object, properties: Object):Object;
|
||||
extendReactive(target: Object, properties: Object): Object;
|
||||
|
||||
/**
|
||||
* Returns true if the provided value is reactive.
|
||||
* @param value object, function or array
|
||||
* @param propertyName if propertyName is specified, checkes whether value.propertyName is reactive.
|
||||
*/
|
||||
isReactive(value: any, propertyName?:string): boolean;
|
||||
isReactive(value: any, propertyName?: string): boolean;
|
||||
|
||||
/**
|
||||
* Can be used in combination with makeReactive / extendReactive.
|
||||
@@ -33,12 +33,12 @@ interface _IMobservableStatic {
|
||||
* Future assignments to the same property will inherit this behavior.
|
||||
* @param value initial value of the reactive property that is being defined.
|
||||
*/
|
||||
asReference<T>(value: any):{value:T};
|
||||
asReference<T>(value: any):{value: T};
|
||||
|
||||
/**
|
||||
* ES6 / Typescript decorator which can to make class properties and getter functions reactive.
|
||||
*/
|
||||
observable(target: Object, key: string):any; // decorator / annotation
|
||||
observable(target: Object, key: string): any; // decorator / annotation
|
||||
|
||||
/**
|
||||
* Creates a reactive view and keeps it alive, so that the view is always
|
||||
@@ -84,12 +84,12 @@ interface _IMobservableStatic {
|
||||
logLevel: number; // 0 = production, 1 = development, 2 = debugging
|
||||
|
||||
extras: {
|
||||
getDependencyTree(thing:any, property?:string): Mobservable.IDependencyTree;
|
||||
getDependencyTree(thing: any, property?: string): Mobservable.IDependencyTree;
|
||||
|
||||
getObserverTree(thing:any, property?:string): Mobservable.IObserverTree;
|
||||
getObserverTree(thing: any, property?: string): Mobservable.IObserverTree;
|
||||
|
||||
trackTransitions(extensive?:boolean, onReport?:(lines:Mobservable.ITransitionEvent) => void) : Mobservable.Lambda;
|
||||
}
|
||||
trackTransitions(extensive?: boolean, onReport?:(lines: Mobservable.ITransitionEvent) => void) : Mobservable.Lambda;
|
||||
};
|
||||
}
|
||||
|
||||
interface IMakeReactive {
|
||||
@@ -104,9 +104,9 @@ interface IMobservableStatic extends _IMobservableStatic, IMakeReactive {
|
||||
|
||||
declare namespace Mobservable {
|
||||
interface IMakeReactiveOptions {
|
||||
as?: string /* "auto" | "reference" | TODO: see #8 "structure" */
|
||||
scope?: Object,
|
||||
context?: Object,
|
||||
as?: string; /* "auto" | "reference" | TODO: see #8 "structure" */
|
||||
scope?: Object;
|
||||
context?: Object;
|
||||
recurse?: boolean;
|
||||
name?: string;
|
||||
// protected: boolean TODO: see #9
|
||||
@@ -130,7 +130,7 @@ declare namespace Mobservable {
|
||||
|
||||
interface IObservableValue<T> extends IObservable {
|
||||
(): T;
|
||||
(value: T):void;
|
||||
(value: T): void;
|
||||
observe(callback: (newValue: T, oldValue: T)=>void, fireImmediately?: boolean): Lambda;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import {observable} from "mobservable";
|
||||
var v = mobservable(3);
|
||||
v.observe(() => {});
|
||||
|
||||
var a = mobservable([1,2,3]);
|
||||
var a = mobservable([1, 2, 3]);
|
||||
|
||||
class Order {
|
||||
@observable price:number = 3;
|
||||
@observable amount:number = 2;
|
||||
@observable orders:string[] = [];
|
||||
@observable price: number = 3;
|
||||
@observable amount: number = 2;
|
||||
@observable orders: string[] = [];
|
||||
|
||||
@observable get total() {
|
||||
return this.amount * this.price * (1 + this.orders.length);
|
||||
@@ -27,7 +27,7 @@ export function testAnnotations() {
|
||||
var order2 = new Order();
|
||||
|
||||
var disposer = mobservable.observe(() => {
|
||||
order1totals.push(order1.total)
|
||||
order1totals.push(order1.total);
|
||||
});
|
||||
|
||||
order2.price = 4;
|
||||
@@ -35,22 +35,22 @@ export function testAnnotations() {
|
||||
|
||||
order2.orders.push('bla');
|
||||
|
||||
order1.orders.splice(0,0,'boe', 'hoi');
|
||||
order1.orders.splice(0, 0, 'boe', 'hoi');
|
||||
|
||||
disposer();
|
||||
order1.orders.pop();
|
||||
};
|
||||
|
||||
export function testTyping() {
|
||||
var ar:Mobservable.IObservableArray<number> = mobservable.makeReactive([1,2]);
|
||||
ar.observe((d:Mobservable.IArrayChange<number>|Mobservable.IArraySplice<number>) => {
|
||||
var ar: Mobservable.IObservableArray<number> = mobservable.makeReactive([1, 2]);
|
||||
ar.observe((d: Mobservable.IArrayChange<number>|Mobservable.IArraySplice<number>) => {
|
||||
console.log(d.type);
|
||||
});
|
||||
|
||||
var ar2:Mobservable.IObservableArray<number> = mobservable([1,2]);
|
||||
ar2.observe((d:Mobservable.IArrayChange<number>|Mobservable.IArraySplice<number>) => {
|
||||
var ar2: Mobservable.IObservableArray<number> = mobservable([1, 2]);
|
||||
ar2.observe((d: Mobservable.IArrayChange<number>|Mobservable.IArraySplice<number>) => {
|
||||
console.log(d.type);
|
||||
});
|
||||
|
||||
var x:Mobservable.IObservableValue<number> = mobservable(3);
|
||||
var x: Mobservable.IObservableValue<number> = mobservable(3);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"interface-name": false
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,8 @@ function customExtensionTypes() {
|
||||
codec.addExtUnpacker(0x3F, myVectorUnpacker);
|
||||
|
||||
var data = new MyVector(1, 2);
|
||||
var encoded = msgpack.encode(data, {codec: codec});
|
||||
var decoded = msgpack.decode(encoded, {codec: codec});
|
||||
var encoded = msgpack.encode(data, {codec});
|
||||
var decoded = msgpack.decode(encoded, {codec});
|
||||
|
||||
class MyVector {
|
||||
constructor(public x: number, public y: number) {}
|
||||
|
||||
@@ -18,7 +18,7 @@ function test() {
|
||||
nblas.scal(a, n);
|
||||
nblas.swap(a, a);
|
||||
res = nblas.iamax(a);
|
||||
//nblas.iamin(a);
|
||||
// nblas.iamin(a);
|
||||
|
||||
// BLAS Level 2 Routines
|
||||
nblas.gbmv(a, a, a, n, n, n, n, nblas.Trans);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import emoji = require('node-emoji');
|
||||
|
||||
let coffee: string = emoji.get('coffee');
|
||||
let result: string = emoji.random();
|
||||
const coffee: string = emoji.get('coffee');
|
||||
const result: string = emoji.random();
|
||||
|
||||
let cofee_name: string = emoji.which('☕️');
|
||||
const cofee_name: string = emoji.which('☕️');
|
||||
|
||||
let emoji_string: string = emoji.emojify('I :heart: :coffee:! - :hushed::star::heart_eyes: ::: test : : :+1:+');
|
||||
const emoji_string: string = emoji.emojify('I :heart: :coffee:! - :hushed::star::heart_eyes: ::: test : : :+1:+');
|
||||
|
||||
let emoji_string2: string = emoji.emojify('I :unknown_emoji: :star: :another_one:', (name: string) => name);
|
||||
const emoji_string2: string = emoji.emojify('I :unknown_emoji: :star: :another_one:', (name: string) => name);
|
||||
|
||||
let emoji_direct: string = emoji.emoji.coffee;
|
||||
const emoji_direct: string = emoji.emoji.coffee;
|
||||
|
||||
@@ -2,14 +2,14 @@ import * as NsApi from "ns-api";
|
||||
|
||||
declare var console: { log(msg: any): string };
|
||||
|
||||
let ns: NsApi = NsApi({
|
||||
const ns: NsApi = NsApi({
|
||||
username: "",
|
||||
password: "",
|
||||
timeout: 1500
|
||||
});
|
||||
|
||||
ns.vertrektijden("", (err, data) => {
|
||||
if(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
@@ -18,7 +18,7 @@ ns.vertrektijden("", (err, data) => {
|
||||
|
||||
// Get travel advise
|
||||
ns.reisadvies ({}, (err, data) => {
|
||||
if(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
@@ -26,7 +26,7 @@ ns.reisadvies ({}, (err, data) => {
|
||||
});
|
||||
|
||||
ns.prijzen({}, (err, data) => {
|
||||
if(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
@@ -34,7 +34,7 @@ ns.prijzen({}, (err, data) => {
|
||||
});
|
||||
|
||||
ns.stations("code", (err, data) => {
|
||||
if(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
@@ -42,7 +42,7 @@ ns.stations("code", (err, data) => {
|
||||
});
|
||||
|
||||
ns.stations((err, data) => {
|
||||
if(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
@@ -50,7 +50,7 @@ ns.stations((err, data) => {
|
||||
});
|
||||
|
||||
ns.storingen({}, (err, data) => {
|
||||
if(err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
console.log(data);
|
||||
|
||||
@@ -21,16 +21,16 @@ const configOptions = {
|
||||
};
|
||||
OpticsAgent.configureAgent(configOptions);
|
||||
|
||||
let expressServer = express();
|
||||
const expressServer = express();
|
||||
expressServer.use(OpticsAgent.middleware());
|
||||
|
||||
let hapiServer = new hapi.Server();
|
||||
const hapiServer = new hapi.Server();
|
||||
OpticsAgent.instrumentHapiServer(hapiServer);
|
||||
|
||||
let req = {} as express.Request;
|
||||
const req = {} as express.Request;
|
||||
OpticsAgent.context(req);
|
||||
|
||||
const agent = new OpticsAgent.Agent({ apiKey: '1234' });
|
||||
|
||||
let schema = {} as GraphQLSchema;
|
||||
const schema = {} as GraphQLSchema;
|
||||
agent.instrumentSchema(schema);
|
||||
|
||||
Vendored
+1018
-1015
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,4 @@
|
||||
/// <reference types="pixi.js" />
|
||||
/// <reference types="pixi-spine" />
|
||||
import * as PIXI from "pixi.js";
|
||||
|
||||
namespace Spine {
|
||||
|
||||
@@ -25,13 +24,13 @@ namespace Spine {
|
||||
|
||||
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
|
||||
|
||||
//initiate the spine animation
|
||||
// initiate the spine animation
|
||||
this.dragon = new PIXI.spine.Spine(res.dragon.spineData);
|
||||
this.dragon.skeleton.setToSetupPose();
|
||||
this.dragon.update(0);
|
||||
this.dragon.autoUpdate = false;
|
||||
|
||||
//create a container for the spin animation and add the animation to it
|
||||
// create a container for the spin animation and add the animation to it
|
||||
var dragonCage: PIXI.Container = new PIXI.Container();
|
||||
dragonCage.addChild(this.dragon);
|
||||
|
||||
@@ -94,7 +93,7 @@ namespace Spine {
|
||||
|
||||
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
|
||||
|
||||
//initiate the spine animation
|
||||
// initiate the spine animation
|
||||
this.goblin = new PIXI.spine.Spine(res.goblins.spineData);
|
||||
this.goblin.skeleton.setSkinByName('goblin');
|
||||
this.goblin.skeleton.setSlotsToSetupPose();
|
||||
@@ -270,7 +269,7 @@ namespace Spine {
|
||||
|
||||
private onAssetsLoaded = (loader: PIXI.loaders.Loader, res: any): void => {
|
||||
|
||||
//initiate the spine animation
|
||||
// initiate the spine animation
|
||||
this.spineboy = new PIXI.spine.Spine(res.spineboy.spineData);
|
||||
this.spineboy.position.x = this.renderer.width / 2;
|
||||
this.spineboy.position.y = this.renderer.height;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { RandomSeed, create } from "random-seed";
|
||||
|
||||
// these generators produce different numbers
|
||||
let rand1: RandomSeed = create(); // method 1
|
||||
const rand1: RandomSeed = create(); // method 1
|
||||
|
||||
// these generators will produce
|
||||
// the same sequence of numbers
|
||||
let seed = 'My Secret String Value';
|
||||
let rand2 = create(seed);
|
||||
const seed = 'My Secret String Value';
|
||||
const rand2 = create(seed);
|
||||
|
||||
// API
|
||||
rand1.addEntropy();
|
||||
|
||||
@@ -13,7 +13,7 @@ const withOptions: Promise<string> = getRawBody(stream, {
|
||||
});
|
||||
|
||||
getRawBody(stream, (err, res) => {
|
||||
if(err) console.error(err);
|
||||
if (err) console.error(err);
|
||||
else console.log(res);
|
||||
});
|
||||
|
||||
@@ -22,6 +22,6 @@ getRawBody(stream, {
|
||||
length: 1024,
|
||||
limit: 512
|
||||
}, (err, res) => {
|
||||
if(err) console.error(err);
|
||||
if (err) console.error(err);
|
||||
else console.log(res);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
//region Imports
|
||||
// region Imports
|
||||
import React = require('react');
|
||||
import ReactDOM = require('react-dom');
|
||||
import { Autosuggest, SuggestionSelectedEventData } from 'react-autosuggest';
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
interface Language {
|
||||
name: string;
|
||||
@@ -15,7 +15,7 @@ function escapeRegexCharacters(str: string): string {
|
||||
}
|
||||
|
||||
export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
//region Fields
|
||||
// region Fields
|
||||
static languages: Language[] = [
|
||||
{name: 'C', year: 1972},
|
||||
{name: 'C#', year: 2000},
|
||||
@@ -32,10 +32,10 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
{name: 'Ruby', year: 1995},
|
||||
{name: 'Scala', year: 2003}
|
||||
];
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
|
||||
//region Constructor
|
||||
// region Constructor
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
@@ -44,9 +44,9 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions('')
|
||||
};
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Rendering methods
|
||||
// region Rendering methods
|
||||
render(): JSX.Element {
|
||||
const {value, suggestions} = this.state;
|
||||
const inputProps = {
|
||||
@@ -79,9 +79,9 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
protected renderSuggestion(suggestion: Language): JSX.Element {
|
||||
return <span>{suggestion.name}</span>;
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Event handlers
|
||||
// region Event handlers
|
||||
protected onChange(event: React.FormEvent<any>, {newValue, method}: any): void {
|
||||
this.setState({
|
||||
value: newValue
|
||||
@@ -93,9 +93,9 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Helper methods
|
||||
// region Helper methods
|
||||
protected getSuggestions(value: string): Language[] {
|
||||
const escapedValue = escapeRegexCharacters(value.trim());
|
||||
|
||||
@@ -111,7 +111,7 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
protected getSuggestionValue(suggestion: Language): string {
|
||||
return suggestion.name;
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactAutosuggestBasicTest />, document.getElementById('app'));
|
||||
@@ -122,7 +122,7 @@ interface LanguageGroup {
|
||||
}
|
||||
|
||||
export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
//region Fields
|
||||
// region Fields
|
||||
static languages: LanguageGroup[] = [
|
||||
{
|
||||
title: '1970s',
|
||||
@@ -164,9 +164,9 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
]
|
||||
}
|
||||
];
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Constructor
|
||||
// region Constructor
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
@@ -175,9 +175,9 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions('')
|
||||
};
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Rendering methods
|
||||
// region Rendering methods
|
||||
render(): JSX.Element {
|
||||
const { value, suggestions } = this.state;
|
||||
const inputProps = {
|
||||
@@ -210,9 +210,9 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
protected renderSectionTitle(section: LanguageGroup): JSX.Element {
|
||||
return <strong>{section.title}</strong>;
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Event handlers
|
||||
// region Event handlers
|
||||
protected onChange(event: React.FormEvent<any>, { newValue, method }: any): void {
|
||||
this.setState({
|
||||
value: newValue
|
||||
@@ -224,9 +224,9 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Helper methods
|
||||
// region Helper methods
|
||||
protected getSuggestions(value: string): LanguageGroup[] {
|
||||
const escapedValue = escapeRegexCharacters(value.trim());
|
||||
|
||||
@@ -253,7 +253,7 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
protected getSectionSuggestions(section: LanguageGroup) {
|
||||
return section.languages;
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactAutosuggestMultipleTest />, document.getElementById('app'));
|
||||
@@ -265,16 +265,16 @@ interface Person {
|
||||
}
|
||||
|
||||
export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
//region Fields
|
||||
// region Fields
|
||||
static people: Person[] = [
|
||||
{first: 'Charlie', last: 'Brown', twitter: 'dancounsell'},
|
||||
{first: 'Charlotte', last: 'White', twitter: 'mtnmissy'},
|
||||
{first: 'Chloe', last: 'Jones', twitter: 'ladylexy'},
|
||||
{first: 'Cooper', last: 'King', twitter: 'steveodom'}
|
||||
];
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Constructor
|
||||
// region Constructor
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
|
||||
@@ -283,9 +283,9 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions('')
|
||||
};
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Rendering methods
|
||||
// region Rendering methods
|
||||
render(): JSX.Element {
|
||||
const { value, suggestions } = this.state;
|
||||
const inputProps = {
|
||||
@@ -323,9 +323,9 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
</span>
|
||||
</span>;
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Event handlers
|
||||
// region Event handlers
|
||||
protected onChange(event: React.FormEvent<any>, {newValue, method}: any): void {
|
||||
this.setState({
|
||||
value: newValue
|
||||
@@ -337,9 +337,9 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
//region Helper methods
|
||||
// region Helper methods
|
||||
protected getSuggestions(value: string): Person[] {
|
||||
const escapedValue = escapeRegexCharacters(value.trim());
|
||||
|
||||
@@ -355,7 +355,7 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
protected getSuggestionValue(suggestion: Person): string {
|
||||
return `${suggestion.first} ${suggestion.last}`;
|
||||
}
|
||||
//endregion
|
||||
// endregion
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactAutosuggestCustomTest />, document.getElementById('app'));
|
||||
|
||||
Vendored
+19
-25
@@ -1,32 +1,26 @@
|
||||
// Type definitions for react-fa v1.4.1
|
||||
// Type definitions for react-ga 1.4
|
||||
// Project: https://github.com/react-ga/react-ga
|
||||
// Definitions by: Tim Aldridge <https://github.com/telshin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace __reactGA {
|
||||
export interface EventArgs {
|
||||
category: string;
|
||||
action: string;
|
||||
label?: string;
|
||||
value?: number;
|
||||
nonInteraction?: boolean;
|
||||
}
|
||||
|
||||
export interface InitializeOptions {
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
export interface FieldsObject {
|
||||
[i: string]: any;
|
||||
}
|
||||
|
||||
export function initialize(trackingCode: string, options?: InitializeOptions): void;
|
||||
export function pageview(path: string): void;
|
||||
export function modalview(name: string): void;
|
||||
export function event(args: EventArgs): void;
|
||||
export function set(fieldsObject: FieldsObject): void;
|
||||
export interface EventArgs {
|
||||
category: string;
|
||||
action: string;
|
||||
label?: string;
|
||||
value?: number;
|
||||
nonInteraction?: boolean;
|
||||
}
|
||||
|
||||
declare module 'react-ga' {
|
||||
export = __reactGA;
|
||||
export interface InitializeOptions {
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
export interface FieldsObject {
|
||||
[i: string]: any;
|
||||
}
|
||||
|
||||
export function initialize(trackingCode: string, options?: InitializeOptions): void;
|
||||
export function pageview(path: string): void;
|
||||
export function modalview(name: string): void;
|
||||
export function event(args: EventArgs): void;
|
||||
export function set(fieldsObject: FieldsObject): void;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/// <reference types="jasmine" />
|
||||
|
||||
import * as ga from "react-ga";
|
||||
|
||||
describe("Testing react-ga initialize object", () => {
|
||||
it("Able to initialize react-ga object", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
});
|
||||
it("Able to initailize react-ga object", () => {
|
||||
let ga = __reactGA;
|
||||
|
||||
let options: __reactGA.InitializeOptions = {
|
||||
const options: ga.InitializeOptions = {
|
||||
debug: true,
|
||||
}
|
||||
};
|
||||
|
||||
ga.initialize("UA-65432-1", options);
|
||||
});
|
||||
@@ -18,7 +17,6 @@ describe("Testing react-ga initialize object", () => {
|
||||
|
||||
describe("Testing react-ga pageview calls", () => {
|
||||
it("Able to make pageview calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
ga.pageview("http://telshin.com");
|
||||
@@ -27,7 +25,6 @@ describe("Testing react-ga pageview calls", () => {
|
||||
|
||||
describe("Testing react-ga modal calls", () => {
|
||||
it("Able to make modal calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
ga.modalview("Test modal");
|
||||
@@ -36,16 +33,15 @@ describe("Testing react-ga modal calls", () => {
|
||||
|
||||
describe("Testing react-ga event calls", () => {
|
||||
it("Able to make event calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
let options: __reactGA.EventArgs = {
|
||||
const options: ga.EventArgs = {
|
||||
category: "Test",
|
||||
action: "CI",
|
||||
label: "Running Jasmine tests for react-ga typscript library",
|
||||
value: 4,
|
||||
nonInteraction: true,
|
||||
}
|
||||
};
|
||||
|
||||
ga.event(options);
|
||||
});
|
||||
@@ -53,10 +49,9 @@ describe("Testing react-ga event calls", () => {
|
||||
|
||||
describe("Testing react-ga set calls", () => {
|
||||
it("Able to make set calls", () => {
|
||||
let ga = __reactGA;
|
||||
ga.initialize("UA-65432-1");
|
||||
|
||||
let fieldObject: __reactGA.FieldsObject = {
|
||||
const fieldObject: ga.FieldsObject = {
|
||||
page: '/users'
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Vendored
+3
-5
@@ -1,9 +1,7 @@
|
||||
// Type definitions for react-highlighter
|
||||
// Type definitions for react-highlighter 0.3
|
||||
// Project: https://github.com/helior/react-highlighter
|
||||
// Definitions by: Pedro Pereira <https://github.com/oizie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "react-highlighter" {
|
||||
var Highlight: any;
|
||||
export = Highlight;
|
||||
}
|
||||
declare var Highlight: any;
|
||||
export = Highlight;
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from 'react';
|
||||
import * as Highlight from 'react-highlighter';
|
||||
|
||||
export class ReactHolderTest extends React.Component<any, any> {
|
||||
public render() {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<Highlight
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Vendored
+9
-11
@@ -4,12 +4,10 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="geojson" />
|
||||
|
||||
import * as Leaflet from 'leaflet';
|
||||
import * as React from 'react';
|
||||
|
||||
//All events need to be lowercase so they don't collide with React.DOMAttributes<T>
|
||||
// All events need to be lowercase so they don't collide with React.DOMAttributes<T>
|
||||
// which already declares things with some of the same names
|
||||
|
||||
interface LeafletLayerEvents {
|
||||
@@ -94,16 +92,16 @@ interface PaneProps {
|
||||
declare const Pane: React.ComponentClass<PaneProps>;
|
||||
|
||||
|
||||
//There is no Layer class, these are the base props for all layers on the map
|
||||
// There is no Layer class, these are the base props for all layers on the map
|
||||
interface LayerProps extends LeafletInteractionEvents {
|
||||
onadd?: (event: Leaflet.Event) => void;
|
||||
onremove?: (event: Leaflet.Event) => void;
|
||||
|
||||
//Popup events
|
||||
// Popup events
|
||||
onpopupopen?: (event: Leaflet.PopupEvent) => void;
|
||||
onpopupclose?: (event: Leaflet.PopupEvent) => void;
|
||||
|
||||
//Tooltip events
|
||||
// Tooltip events
|
||||
ontooltipopen?: (event: Leaflet.TooltipEvent) => void;
|
||||
ontooltipclose?: (event: Leaflet.TooltipEvent) => void;
|
||||
}
|
||||
@@ -126,7 +124,7 @@ interface PopupProps extends LayerProps, Leaflet.PopupOptions {
|
||||
}
|
||||
declare const Popup: React.ComponentClass<PopupProps>;
|
||||
|
||||
//tslint:disable-next-line:no-empty-interface
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface TooltipProps extends LayerProps, Leaflet.TooltipOptions { }
|
||||
declare const Tooltip: React.ComponentClass<TooltipProps>;
|
||||
|
||||
@@ -159,8 +157,8 @@ interface WMSTileLayerProps extends TileLayerProps {
|
||||
}
|
||||
declare const WMSTileLayer: React.ComponentClass<WMSTileLayerProps>;
|
||||
|
||||
//Path is an abstract class
|
||||
//tslint:disable-next-line:no-empty-interface
|
||||
// Path is an abstract class
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface PathProps extends LeafletLayerEvents, LeafletInteractionEvents, Leaflet.PathOptions {
|
||||
}
|
||||
|
||||
@@ -193,11 +191,11 @@ interface RectangleProps extends PathProps {
|
||||
declare const Rectangle: React.ComponentClass<RectangleProps>;
|
||||
|
||||
|
||||
//tslint:disable-next-line:no-empty-interface
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface LayerGroupProps extends LayerProps { }
|
||||
declare const LayerGroup: React.ComponentClass<LayerGroupProps>;
|
||||
|
||||
//tslint:disable-next-line:no-empty-interface
|
||||
// tslint:disable-next-line:no-empty-interface
|
||||
interface FeatureGroupProps extends LayerGroupProps, Leaflet.PathOptions { }
|
||||
declare const FeatureGroup: React.ComponentClass<FeatureGroupProps>;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
} from 'react-leaflet';
|
||||
const { BaseLayer, Overlay } = LayersControl;
|
||||
|
||||
///animate.js
|
||||
/// animate.js
|
||||
export class AnimateExample extends Component<any, any> {
|
||||
state = {
|
||||
animate: false,
|
||||
@@ -64,7 +64,7 @@ export class AnimateExample extends Component<any, any> {
|
||||
<Map
|
||||
animate={this.state.animate}
|
||||
center={this.state.latlng}
|
||||
//TODO length={4}
|
||||
// TODO length={4}
|
||||
onclick={this.handleClick}
|
||||
ref='map'
|
||||
zoom={13}>
|
||||
@@ -79,7 +79,7 @@ export class AnimateExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//bounds.js
|
||||
// bounds.js
|
||||
const outer: Array<[number, number]> = [
|
||||
[50.505, -29.09],
|
||||
[52.505, 29.09],
|
||||
@@ -124,7 +124,7 @@ export class BoundsExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//custom-component.js
|
||||
// custom-component.js
|
||||
const SomeFn = (asd: string) => (
|
||||
asd + asd
|
||||
);
|
||||
@@ -179,7 +179,7 @@ export class CustomComponent extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//draggable-marker.js
|
||||
// draggable-marker.js
|
||||
export class DraggableExample extends Component<any, any> {
|
||||
state = {
|
||||
center: {
|
||||
@@ -231,7 +231,7 @@ export class DraggableExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//events.js
|
||||
// events.js
|
||||
export class EventsExample extends Component<any, any> {
|
||||
state = {
|
||||
hasLocation: false,
|
||||
@@ -264,7 +264,7 @@ export class EventsExample extends Component<any, any> {
|
||||
return (
|
||||
<Map
|
||||
center={this.state.latlng}
|
||||
//TODO length={4}
|
||||
// TODO length={4}
|
||||
onClick={this.handleClick}
|
||||
onlocationfound={this.handleLocationFound}
|
||||
ref='map'
|
||||
@@ -279,7 +279,7 @@ export class EventsExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//layers-control.js
|
||||
// layers-control.js
|
||||
export class LayersControlExample extends Component<any, any> {
|
||||
render() {
|
||||
const center: [number, number] = [51.505, -0.09];
|
||||
@@ -334,7 +334,7 @@ export class LayersControlExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//other-layers.js
|
||||
// other-layers.js
|
||||
export class OtherLayersExample extends Component<any, any> {
|
||||
render() {
|
||||
const center: [number, number] = [51.505, -0.09];
|
||||
@@ -368,7 +368,7 @@ export class OtherLayersExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//pane.js
|
||||
// pane.js
|
||||
export class PaneExample extends Component<any, any> {
|
||||
state = {
|
||||
render: true,
|
||||
@@ -405,7 +405,7 @@ export class PaneExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//simple.js
|
||||
// simple.js
|
||||
export class SimpleExample extends Component<any, any> {
|
||||
state = {
|
||||
lat: 51.505,
|
||||
@@ -431,7 +431,7 @@ export class SimpleExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//tooltip.js
|
||||
// tooltip.js
|
||||
export class TooltipExample extends Component<any, any> {
|
||||
state = {
|
||||
clicked: 0,
|
||||
@@ -489,7 +489,7 @@ export class TooltipExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//vector-layers.js
|
||||
// vector-layers.js
|
||||
export class VectorLayersExample extends Component<any, any> {
|
||||
render() {
|
||||
const center: [number, number] = [51.505, -0.09];
|
||||
@@ -543,7 +543,7 @@ export class VectorLayersExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//wms-tile-layer.js
|
||||
// wms-tile-layer.js
|
||||
export class WMSTileLayerExample extends Component<any, any> {
|
||||
state = {
|
||||
lat: 51.505,
|
||||
@@ -577,7 +577,7 @@ export class WMSTileLayerExample extends Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
//zoom-control.js
|
||||
// zoom-control.js
|
||||
const ZoomControlExample = () => (
|
||||
<Map center={[51.505, -0.09]} zoom={13} zoomControl={false}>
|
||||
<TileLayer
|
||||
|
||||
@@ -75,7 +75,7 @@ var uploadProgress: RNFS.UploadCallbackProgress = (response) => {
|
||||
// upload files
|
||||
RNFS.uploadFiles({
|
||||
toUrl: uploadUrl,
|
||||
files: files,
|
||||
files,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -93,7 +93,7 @@ RNFS.uploadFiles({
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
if(err.description === "cancelled") {
|
||||
if (err.description === "cancelled") {
|
||||
// cancelled by user
|
||||
}
|
||||
console.log(err);
|
||||
|
||||
@@ -10,27 +10,24 @@ interface MyTextProperties extends React.Props<MyText> {
|
||||
text: string;
|
||||
}
|
||||
class MyText extends React.Component<MyTextProperties, {}> {
|
||||
public constructor(props: MyTextProperties) {
|
||||
constructor(props: MyTextProperties) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
render(): JSX.Element {
|
||||
return(
|
||||
<Text>this.props.text</Text>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface ScrollableTabViewDemoProperties {
|
||||
class ScrollableTabViewDemo extends React.Component<{}, {}> {
|
||||
|
||||
}
|
||||
class ScrollableTabViewDemo extends React.Component<ScrollableTabViewDemoProperties, {}> {
|
||||
|
||||
public constructor(props: ScrollableTabViewDemo) {
|
||||
constructor(props: ScrollableTabViewDemo) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
|
||||
render(): JSX.Element {
|
||||
return (
|
||||
<ScrollableTabView>
|
||||
<MyText tabLabel='t1' text='t1'></MyText>
|
||||
|
||||
@@ -7,6 +7,6 @@ const sidebarStyle: SidebarStyles = {
|
||||
content: { width: "300px" }
|
||||
};
|
||||
|
||||
let sidebar1 = <Sidebar docked={true} open={true} sidebar={sidebar} styles={sidebarStyle}>
|
||||
const sidebar1 = <Sidebar docked={true} open={true} sidebar={sidebar} styles={sidebarStyle}>
|
||||
<h1>Content</h1>
|
||||
</Sidebar>;
|
||||
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
declare namespace Rx {
|
||||
export interface VirtualTimeScheduler<TAbsolute, TRelative> extends Scheduler {
|
||||
//protected constructor(initialClock: TAbsolute, comparer: (first: TAbsolute, second: TAbsolute) => number);
|
||||
// protected constructor(initialClock: TAbsolute, comparer: (first: TAbsolute, second: TAbsolute) => number);
|
||||
|
||||
advanceBy(time: TRelative): void;
|
||||
advanceTo(time: TAbsolute): void;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Tests.Async {
|
||||
p = p.then(x => x);
|
||||
p = p.then(x => p);
|
||||
p = p.then(undefined, reason => 10);
|
||||
//p = p.then(undefined, reason => p);
|
||||
// p = p.then(undefined, reason => p);
|
||||
|
||||
var ps: Rx.IPromise<string> = p.then(undefined, reason => "error");
|
||||
ps = p.then(x => "");
|
||||
|
||||
Vendored
+407
-411
@@ -1,418 +1,414 @@
|
||||
import * as webdriver from './index';
|
||||
import * as remote from './remote';
|
||||
|
||||
declare namespace chrome {
|
||||
/**
|
||||
* Creates a new WebDriver client for Chrome.
|
||||
*
|
||||
* @extends {webdriver.WebDriver}
|
||||
*/
|
||||
export class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* Creates a new WebDriver client for Chrome.
|
||||
*
|
||||
* @extends {webdriver.WebDriver}
|
||||
* @param {(webdriver.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {remote.DriverService=} opt_service The session to use; will use
|
||||
* the {@link getDefaultService default service} by default.
|
||||
* @param {webdriver.promise.ControlFlow=} opt_flow The control flow to use, or
|
||||
* {@code null} to use the currently active flow.
|
||||
* @constructor
|
||||
*/
|
||||
class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(webdriver.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {remote.DriverService=} opt_service The session to use; will use
|
||||
* the {@link getDefaultService default service} by default.
|
||||
* @param {webdriver.promise.ControlFlow=} opt_flow The control flow to use, or
|
||||
* {@code null} to use the currently active flow.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(opt_config?: Options | webdriver.Capabilities, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
|
||||
}
|
||||
|
||||
interface IOptionsValues {
|
||||
args: string[];
|
||||
binary?: string;
|
||||
detach: boolean;
|
||||
extensions: string[];
|
||||
localState?: any;
|
||||
logFile?: string;
|
||||
prefs?: any;
|
||||
}
|
||||
|
||||
interface IPerfLoggingPrefs {
|
||||
enableNetwork: boolean;
|
||||
enablePage: boolean;
|
||||
enableTimeline: boolean;
|
||||
tracingCategories: string;
|
||||
bufferUsageReportingInterval: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for managing ChromeDriver specific options.
|
||||
*/
|
||||
class Options {
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Extracts the ChromeDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!webdriver.Capabilities} capabilities The capabilities object.
|
||||
* @return {!Options} The ChromeDriver options.
|
||||
*/
|
||||
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Add additional command line arguments to use when launching the Chrome
|
||||
* browser. Each argument may be specified with or without the '--' prefix
|
||||
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
|
||||
* delimited by an '=': 'foo=bar'.
|
||||
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addArguments(...var_args: string[]): Options;
|
||||
|
||||
|
||||
/**
|
||||
* List of Chrome command line switches to exclude that ChromeDriver by default
|
||||
* passes when starting Chrome. Do not prefix switches with '--'.
|
||||
*
|
||||
* @param {...(string|!Array<string>)} var_args The switches to exclude.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
excludeSwitches(...var_args: string[]): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Add additional extensions to install when launching Chrome. Each extension
|
||||
* should be specified as the path to the packed CRX file, or a Buffer for an
|
||||
* extension.
|
||||
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
|
||||
* extensions to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addExtensions(...var_args: any[]): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path to the Chrome binary to use. On Mac OS X, this path should
|
||||
* reference the actual Chrome executable, not just the application binary
|
||||
* (e.g. '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome').
|
||||
*
|
||||
* The binary path be absolute or relative to the chromedriver server
|
||||
* executable, but it must exist on the machine that will launch Chrome.
|
||||
*
|
||||
* @param {string} path The path to the Chrome binary to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setChromeBinaryPath(path: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to leave the started Chrome browser running if the controlling
|
||||
* ChromeDriver service is killed before {@link webdriver.WebDriver#quit()} is
|
||||
* called.
|
||||
* @param {boolean} detach Whether to leave the browser running if the
|
||||
* chromedriver service is killed before the session.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
detachDriver(detach: boolean): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the user preferences for Chrome's user profile. See the 'Preferences'
|
||||
* file in Chrome's user data directory for examples.
|
||||
* @param {!Object} prefs Dictionary of user preferences to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setUserPreferences(prefs: any): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {!webdriver.logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Sets the performance logging preferences. Options include:
|
||||
*
|
||||
* - `enableNetwork`: Whether or not to collect events from Network domain.
|
||||
* - `enablePage`: Whether or not to collect events from Page domain.
|
||||
* - `enableTimeline`: Whether or not to collect events from Timeline domain.
|
||||
* Note: when tracing is enabled, Timeline domain is implicitly disabled,
|
||||
* unless `enableTimeline` is explicitly set to true.
|
||||
* - `tracingCategories`: A comma-separated string of Chrome tracing categories
|
||||
* for which trace events should be collected. An unspecified or empty
|
||||
* string disables tracing.
|
||||
* - `bufferUsageReportingInterval`: The requested number of milliseconds
|
||||
* between DevTools trace buffer usage events. For example, if 1000, then
|
||||
* once per second, DevTools will report how full the trace buffer is. If a
|
||||
* report indicates the buffer usage is 100%, a warning will be issued.
|
||||
*
|
||||
* @param {{enableNetwork: boolean,
|
||||
* enablePage: boolean,
|
||||
* enableTimeline: boolean,
|
||||
* tracingCategories: string,
|
||||
* bufferUsageReportingInterval: number}} prefs The performance
|
||||
* logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setPerfLoggingPrefs(prefs: IPerfLoggingPrefs): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets preferences for the 'Local State' file in Chrome's user data
|
||||
* directory.
|
||||
* @param {!Object} state Dictionary of local state preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLocalState(state: any): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the activity hosting a Chrome-based Android WebView. This
|
||||
* option must be set to connect to an [Android WebView](
|
||||
* https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android)
|
||||
*
|
||||
* @param {string} name The activity name.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidActivity(name: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the device serial number to connect to via ADB. If not specified, the
|
||||
* ChromeDriver will select an unused device at random. An error will be
|
||||
* returned if all devices already have active sessions.
|
||||
*
|
||||
* @param {string} serial The device serial number to connect to.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidDeviceSerial(serial: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Configures the ChromeDriver to launch Chrome on Android via adb. This
|
||||
* function is shorthand for
|
||||
* {@link #androidPackage options.androidPackage('com.android.chrome')}.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidChrome(): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the package name of the Chrome or WebView app.
|
||||
*
|
||||
* @param {?string} pkg The package to connect to, or `null` to disable Android
|
||||
* and switch back to using desktop Chrome.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidPackage(pkg: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the process name of the Activity hosting the WebView (as given by `ps`).
|
||||
* If not specified, the process name is assumed to be the same as
|
||||
* {@link #androidPackage}.
|
||||
*
|
||||
* @param {string} processName The main activity name.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidProcess(processName: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to connect to an already-running instead of the specified
|
||||
* {@linkplain #androidProcess app} instead of launching the app with a clean
|
||||
* data directory.
|
||||
*
|
||||
* @param {boolean} useRunning Whether to connect to a running instance.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidUseRunningApp(useRunning: boolean): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path to Chrome's log file. This path should exist on the machine
|
||||
* that will launch Chrome.
|
||||
* @param {string} path Path to the log file to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setChromeLogFile(path: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the directory to store Chrome minidumps in. This option is only
|
||||
* supported when ChromeDriver is running on Linux.
|
||||
* @param {string} path The directory path.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setChromeMinidumpPath(path: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Configures Chrome to emulate a mobile device. For more information, refer
|
||||
* to the ChromeDriver project page on [mobile emulation][em]. Configuration
|
||||
* options include:
|
||||
*
|
||||
* - `deviceName`: The name of a pre-configured [emulated device][devem]
|
||||
* - `width`: screen width, in pixels
|
||||
* - `height`: screen height, in pixels
|
||||
* - `pixelRatio`: screen pixel ratio
|
||||
*
|
||||
* __Example 1: Using a Pre-configured Device__
|
||||
*
|
||||
* let options = new chrome.Options().setMobileEmulation(
|
||||
* {deviceName: 'Google Nexus 5'});
|
||||
*
|
||||
* let driver = new chrome.Driver(options);
|
||||
*
|
||||
* __Example 2: Using Custom Screen Configuration__
|
||||
*
|
||||
* let options = new chrome.Options().setMobileEmulation({
|
||||
* width: 360,
|
||||
* height: 640,
|
||||
* pixelRatio: 3.0
|
||||
* });
|
||||
*
|
||||
* let driver = new chrome.Driver(options);
|
||||
*
|
||||
*
|
||||
* [em]: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation
|
||||
* [devem]: https://developer.chrome.com/devtools/docs/device-mode
|
||||
*
|
||||
* @param {?({deviceName: string}|
|
||||
* {width: number, height: number, pixelRatio: number})} config The
|
||||
* mobile emulation configuration, or `null` to disable emulation.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setMobileEmulation(config: any): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {webdriver.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link webdriver.Capabilities} object.
|
||||
* @param {webdriver.Capabilities=} opt_capabilities The capabilities to merge
|
||||
* these options into, if any.
|
||||
* @return {!webdriver.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link remote.DriverService} instances that manage a ChromeDriver
|
||||
* server.
|
||||
*/
|
||||
class ServiceBuilder {
|
||||
/**
|
||||
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
||||
* the builder will attempt to locate the chromedriver on the current
|
||||
* PATH.
|
||||
* @throws {Error} If provided executable does not exist, or the chromedriver
|
||||
* cannot be found on the PATH.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Sets the port to start the ChromeDriver on.
|
||||
* @param {number} port The port to use, or 0 for any free port.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
* @throws {Error} If the port is invalid.
|
||||
*/
|
||||
usingPort(port: number): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets which port adb is listening to. _The ChromeDriver will connect to adb
|
||||
* if an {@linkplain Options#androidPackage Android session} is requested, but
|
||||
* adb **must** be started beforehand._
|
||||
*
|
||||
* @param {number} port Which port adb is running on.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setAdbPort(port: number): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path of the log file the driver should log to. If a log file is
|
||||
* not specified, the driver will log to stderr.
|
||||
* @param {string} path Path of the log file to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
loggingTo(path: string): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Enables verbose logging.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
enableVerboseLogging(): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the number of threads the driver should use to manage HTTP requests.
|
||||
* By default, the driver will use 4 threads.
|
||||
* @param {number} n The number of threads to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setNumHttpThreads(n: number): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the base path for WebDriver REST commands (e.g. '/wd/hub').
|
||||
* By default, the driver will accept commands relative to '/'.
|
||||
* @param {string} path The base path to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setUrlBasePath(path: string): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the stdio configuration for the driver service. See
|
||||
* {@code child_process.spawn} for more information.
|
||||
* @param {(string|!Array.<string|number|!Stream|null|undefined>)} config The
|
||||
* configuration to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the environment to start the server under. This settings will be
|
||||
* inherited by every browser session started by the server.
|
||||
* @param {!Object.<string, string>} env The environment to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
withEnvironment(env: { [key: string]: string }): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new DriverService using this instance's current configuration.
|
||||
* @return {remote.DriverService} A new driver service using this instance's
|
||||
* current configuration.
|
||||
* @throws {Error} If the driver exectuable was not specified and a default
|
||||
* could not be found on the current PATH.
|
||||
*/
|
||||
build(): remote.DriverService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default ChromeDriver service. If such a service has not been
|
||||
* configured, one will be constructed using the default configuration for
|
||||
* a ChromeDriver executable found on the system PATH.
|
||||
* @return {!remote.DriverService} The default ChromeDriver service.
|
||||
*/
|
||||
function getDefaultService(): remote.DriverService;
|
||||
|
||||
/**
|
||||
* Sets the default service to use for new ChromeDriver instances.
|
||||
* @param {!remote.DriverService} service The service to use.
|
||||
* @throws {Error} If the default service is currently running.
|
||||
*/
|
||||
function setDefaultService(service: remote.DriverService): void;
|
||||
constructor(opt_config?: Options | webdriver.Capabilities, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
|
||||
}
|
||||
|
||||
export = chrome;
|
||||
interface IOptionsValues {
|
||||
args: string[];
|
||||
binary?: string;
|
||||
detach: boolean;
|
||||
extensions: string[];
|
||||
localState?: any;
|
||||
logFile?: string;
|
||||
prefs?: any;
|
||||
}
|
||||
|
||||
interface IPerfLoggingPrefs {
|
||||
enableNetwork: boolean;
|
||||
enablePage: boolean;
|
||||
enableTimeline: boolean;
|
||||
tracingCategories: string;
|
||||
bufferUsageReportingInterval: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for managing ChromeDriver specific options.
|
||||
*/
|
||||
export class Options {
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Extracts the ChromeDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!webdriver.Capabilities} capabilities The capabilities object.
|
||||
* @return {!Options} The ChromeDriver options.
|
||||
*/
|
||||
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Add additional command line arguments to use when launching the Chrome
|
||||
* browser. Each argument may be specified with or without the '--' prefix
|
||||
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
|
||||
* delimited by an '=': 'foo=bar'.
|
||||
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addArguments(...var_args: string[]): Options;
|
||||
|
||||
|
||||
/**
|
||||
* List of Chrome command line switches to exclude that ChromeDriver by default
|
||||
* passes when starting Chrome. Do not prefix switches with '--'.
|
||||
*
|
||||
* @param {...(string|!Array<string>)} var_args The switches to exclude.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
excludeSwitches(...var_args: string[]): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Add additional extensions to install when launching Chrome. Each extension
|
||||
* should be specified as the path to the packed CRX file, or a Buffer for an
|
||||
* extension.
|
||||
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
|
||||
* extensions to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addExtensions(...var_args: any[]): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path to the Chrome binary to use. On Mac OS X, this path should
|
||||
* reference the actual Chrome executable, not just the application binary
|
||||
* (e.g. '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome').
|
||||
*
|
||||
* The binary path be absolute or relative to the chromedriver server
|
||||
* executable, but it must exist on the machine that will launch Chrome.
|
||||
*
|
||||
* @param {string} path The path to the Chrome binary to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setChromeBinaryPath(path: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to leave the started Chrome browser running if the controlling
|
||||
* ChromeDriver service is killed before {@link webdriver.WebDriver#quit()} is
|
||||
* called.
|
||||
* @param {boolean} detach Whether to leave the browser running if the
|
||||
* chromedriver service is killed before the session.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
detachDriver(detach: boolean): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the user preferences for Chrome's user profile. See the 'Preferences'
|
||||
* file in Chrome's user data directory for examples.
|
||||
* @param {!Object} prefs Dictionary of user preferences to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setUserPreferences(prefs: any): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {!webdriver.logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Sets the performance logging preferences. Options include:
|
||||
*
|
||||
* - `enableNetwork`: Whether or not to collect events from Network domain.
|
||||
* - `enablePage`: Whether or not to collect events from Page domain.
|
||||
* - `enableTimeline`: Whether or not to collect events from Timeline domain.
|
||||
* Note: when tracing is enabled, Timeline domain is implicitly disabled,
|
||||
* unless `enableTimeline` is explicitly set to true.
|
||||
* - `tracingCategories`: A comma-separated string of Chrome tracing categories
|
||||
* for which trace events should be collected. An unspecified or empty
|
||||
* string disables tracing.
|
||||
* - `bufferUsageReportingInterval`: The requested number of milliseconds
|
||||
* between DevTools trace buffer usage events. For example, if 1000, then
|
||||
* once per second, DevTools will report how full the trace buffer is. If a
|
||||
* report indicates the buffer usage is 100%, a warning will be issued.
|
||||
*
|
||||
* @param {{enableNetwork: boolean,
|
||||
* enablePage: boolean,
|
||||
* enableTimeline: boolean,
|
||||
* tracingCategories: string,
|
||||
* bufferUsageReportingInterval: number}} prefs The performance
|
||||
* logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setPerfLoggingPrefs(prefs: IPerfLoggingPrefs): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets preferences for the 'Local State' file in Chrome's user data
|
||||
* directory.
|
||||
* @param {!Object} state Dictionary of local state preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLocalState(state: any): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the name of the activity hosting a Chrome-based Android WebView. This
|
||||
* option must be set to connect to an [Android WebView](
|
||||
* https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android)
|
||||
*
|
||||
* @param {string} name The activity name.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidActivity(name: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the device serial number to connect to via ADB. If not specified, the
|
||||
* ChromeDriver will select an unused device at random. An error will be
|
||||
* returned if all devices already have active sessions.
|
||||
*
|
||||
* @param {string} serial The device serial number to connect to.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidDeviceSerial(serial: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Configures the ChromeDriver to launch Chrome on Android via adb. This
|
||||
* function is shorthand for
|
||||
* {@link #androidPackage options.androidPackage('com.android.chrome')}.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidChrome(): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the package name of the Chrome or WebView app.
|
||||
*
|
||||
* @param {?string} pkg The package to connect to, or `null` to disable Android
|
||||
* and switch back to using desktop Chrome.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidPackage(pkg: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the process name of the Activity hosting the WebView (as given by `ps`).
|
||||
* If not specified, the process name is assumed to be the same as
|
||||
* {@link #androidPackage}.
|
||||
*
|
||||
* @param {string} processName The main activity name.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidProcess(processName: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to connect to an already-running instead of the specified
|
||||
* {@linkplain #androidProcess app} instead of launching the app with a clean
|
||||
* data directory.
|
||||
*
|
||||
* @param {boolean} useRunning Whether to connect to a running instance.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
androidUseRunningApp(useRunning: boolean): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path to Chrome's log file. This path should exist on the machine
|
||||
* that will launch Chrome.
|
||||
* @param {string} path Path to the log file to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setChromeLogFile(path: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the directory to store Chrome minidumps in. This option is only
|
||||
* supported when ChromeDriver is running on Linux.
|
||||
* @param {string} path The directory path.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setChromeMinidumpPath(path: string): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Configures Chrome to emulate a mobile device. For more information, refer
|
||||
* to the ChromeDriver project page on [mobile emulation][em]. Configuration
|
||||
* options include:
|
||||
*
|
||||
* - `deviceName`: The name of a pre-configured [emulated device][devem]
|
||||
* - `width`: screen width, in pixels
|
||||
* - `height`: screen height, in pixels
|
||||
* - `pixelRatio`: screen pixel ratio
|
||||
*
|
||||
* __Example 1: Using a Pre-configured Device__
|
||||
*
|
||||
* let options = new chrome.Options().setMobileEmulation(
|
||||
* {deviceName: 'Google Nexus 5'});
|
||||
*
|
||||
* let driver = new chrome.Driver(options);
|
||||
*
|
||||
* __Example 2: Using Custom Screen Configuration__
|
||||
*
|
||||
* let options = new chrome.Options().setMobileEmulation({
|
||||
* width: 360,
|
||||
* height: 640,
|
||||
* pixelRatio: 3.0
|
||||
* });
|
||||
*
|
||||
* let driver = new chrome.Driver(options);
|
||||
*
|
||||
*
|
||||
* [em]: https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation
|
||||
* [devem]: https://developer.chrome.com/devtools/docs/device-mode
|
||||
*
|
||||
* @param {?({deviceName: string}|
|
||||
* {width: number, height: number, pixelRatio: number})} config The
|
||||
* mobile emulation configuration, or `null` to disable emulation.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setMobileEmulation(config: any): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {webdriver.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link webdriver.Capabilities} object.
|
||||
* @param {webdriver.Capabilities=} opt_capabilities The capabilities to merge
|
||||
* these options into, if any.
|
||||
* @return {!webdriver.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link remote.DriverService} instances that manage a ChromeDriver
|
||||
* server.
|
||||
*/
|
||||
export class ServiceBuilder {
|
||||
/**
|
||||
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
||||
* the builder will attempt to locate the chromedriver on the current
|
||||
* PATH.
|
||||
* @throws {Error} If provided executable does not exist, or the chromedriver
|
||||
* cannot be found on the PATH.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Sets the port to start the ChromeDriver on.
|
||||
* @param {number} port The port to use, or 0 for any free port.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
* @throws {Error} If the port is invalid.
|
||||
*/
|
||||
usingPort(port: number): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets which port adb is listening to. _The ChromeDriver will connect to adb
|
||||
* if an {@linkplain Options#androidPackage Android session} is requested, but
|
||||
* adb **must** be started beforehand._
|
||||
*
|
||||
* @param {number} port Which port adb is running on.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setAdbPort(port: number): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the path of the log file the driver should log to. If a log file is
|
||||
* not specified, the driver will log to stderr.
|
||||
* @param {string} path Path of the log file to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
loggingTo(path: string): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Enables verbose logging.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
enableVerboseLogging(): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the number of threads the driver should use to manage HTTP requests.
|
||||
* By default, the driver will use 4 threads.
|
||||
* @param {number} n The number of threads to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setNumHttpThreads(n: number): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the base path for WebDriver REST commands (e.g. '/wd/hub').
|
||||
* By default, the driver will accept commands relative to '/'.
|
||||
* @param {string} path The base path to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setUrlBasePath(path: string): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the stdio configuration for the driver service. See
|
||||
* {@code child_process.spawn} for more information.
|
||||
* @param {(string|!Array.<string|number|!Stream|null|undefined>)} config The
|
||||
* configuration to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the environment to start the server under. This settings will be
|
||||
* inherited by every browser session started by the server.
|
||||
* @param {!Object.<string, string>} env The environment to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
withEnvironment(env: { [key: string]: string }): ServiceBuilder;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new DriverService using this instance's current configuration.
|
||||
* @return {remote.DriverService} A new driver service using this instance's
|
||||
* current configuration.
|
||||
* @throws {Error} If the driver exectuable was not specified and a default
|
||||
* could not be found on the current PATH.
|
||||
*/
|
||||
build(): remote.DriverService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default ChromeDriver service. If such a service has not been
|
||||
* configured, one will be constructed using the default configuration for
|
||||
* a ChromeDriver executable found on the system PATH.
|
||||
* @return {!remote.DriverService} The default ChromeDriver service.
|
||||
*/
|
||||
export function getDefaultService(): remote.DriverService;
|
||||
|
||||
/**
|
||||
* Sets the default service to use for new ChromeDriver instances.
|
||||
* @param {!remote.DriverService} service The service to use.
|
||||
* @throws {Error} If the default service is currently running.
|
||||
*/
|
||||
export function setDefaultService(service: remote.DriverService): void;
|
||||
|
||||
Vendored
+116
-121
@@ -1,129 +1,124 @@
|
||||
import * as webdriver from './index';
|
||||
import * as remote from './remote';
|
||||
|
||||
declare namespace edge {
|
||||
|
||||
class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {remote.DriverService=} opt_service The session to use; will use
|
||||
* the {@linkplain #getDefaultService default service} by default.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to use, or
|
||||
* {@code null} to use the currently active flow.
|
||||
*/
|
||||
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
setFileDetector(): void;
|
||||
}
|
||||
export class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {remote.DriverService=} opt_service The session to use; will use
|
||||
* the {@linkplain #getDefaultService default service} by default.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to use, or
|
||||
* {@code null} to use the currently active flow.
|
||||
*/
|
||||
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* Class for managing MicrosoftEdgeDriver specific options.
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
class Options {
|
||||
|
||||
/**
|
||||
* Extracts the MicrosoftEdgeDriver specific options from the given
|
||||
* capabilities object.
|
||||
* @param {!capabilities.Capabilities} caps The capabilities object.
|
||||
* @return {!Options} The MicrosoftEdgeDriver options.
|
||||
*/
|
||||
static fromCapabilities(cap: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Sets the page load strategy for Edge.
|
||||
* Supported values are 'normal', 'eager', and 'none';
|
||||
*
|
||||
* @param {string} pageLoadStrategy The page load strategy to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setPageLoadStrategy(pageLoadStrategy: string): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link capabilities.Capabilities}
|
||||
* object.
|
||||
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!capabilities.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link remote.DriverService} instances that manage a
|
||||
* MicrosoftEdgeDriver server in a child process.
|
||||
*/
|
||||
class ServiceBuilder {
|
||||
/**
|
||||
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
||||
* the builder will attempt to locate the MicrosoftEdgeDriver on the current
|
||||
* PATH.
|
||||
* @throws {Error} If provided executable does not exist, or the
|
||||
* MicrosoftEdgeDriver cannot be found on the PATH.
|
||||
*/
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Defines the stdio configuration for the driver service. See
|
||||
* {@code child_process.spawn} for more information.
|
||||
* @param {(string|!Array.<string|number|!stream.Stream|null|undefined>)}
|
||||
* config The configuration to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Sets the port to start the MicrosoftEdgeDriver on.
|
||||
* @param {number} port The port to use, or 0 for any free port.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
* @throws {Error} If the port is invalid.
|
||||
*/
|
||||
usingPort(port: number): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Defines the environment to start the server under. This settings will be
|
||||
* inherited by every browser session started by the server.
|
||||
* @param {!Object.<string, string>} env The environment to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
withEnvironment(env: Object): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Creates a new DriverService using this instance's current configuration.
|
||||
* @return {!remote.DriverService} A new driver service using this instance's
|
||||
* current configuration.
|
||||
* @throws {Error} If the driver exectuable was not specified and a default
|
||||
* could not be found on the current PATH.
|
||||
*/
|
||||
build(): remote.DriverService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default MicrosoftEdgeDriver service. If such a service has
|
||||
* not been configured, one will be constructed using the default configuration
|
||||
* for an MicrosoftEdgeDriver executable found on the system PATH.
|
||||
* @return {!remote.DriverService} The default MicrosoftEdgeDriver service.
|
||||
*/
|
||||
function getDefaultService(): remote.DriverService;
|
||||
|
||||
/**
|
||||
* Sets the default service to use for new MicrosoftEdgeDriver instances.
|
||||
* @param {!remote.DriverService} service The service to use.
|
||||
* @throws {Error} If the default service is currently running.
|
||||
*/
|
||||
function setDefaultService(service: remote.DriverService): void;
|
||||
setFileDetector(): void;
|
||||
}
|
||||
|
||||
export = edge;
|
||||
/**
|
||||
* Class for managing MicrosoftEdgeDriver specific options.
|
||||
*/
|
||||
export class Options {
|
||||
|
||||
/**
|
||||
* Extracts the MicrosoftEdgeDriver specific options from the given
|
||||
* capabilities object.
|
||||
* @param {!capabilities.Capabilities} caps The capabilities object.
|
||||
* @return {!Options} The MicrosoftEdgeDriver options.
|
||||
*/
|
||||
static fromCapabilities(cap: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Sets the page load strategy for Edge.
|
||||
* Supported values are 'normal', 'eager', and 'none';
|
||||
*
|
||||
* @param {string} pageLoadStrategy The page load strategy to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setPageLoadStrategy(pageLoadStrategy: string): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link capabilities.Capabilities}
|
||||
* object.
|
||||
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!capabilities.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link remote.DriverService} instances that manage a
|
||||
* MicrosoftEdgeDriver server in a child process.
|
||||
*/
|
||||
export class ServiceBuilder {
|
||||
/**
|
||||
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
||||
* the builder will attempt to locate the MicrosoftEdgeDriver on the current
|
||||
* PATH.
|
||||
* @throws {Error} If provided executable does not exist, or the
|
||||
* MicrosoftEdgeDriver cannot be found on the PATH.
|
||||
*/
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Defines the stdio configuration for the driver service. See
|
||||
* {@code child_process.spawn} for more information.
|
||||
* @param {(string|!Array.<string|number|!stream.Stream|null|undefined>)}
|
||||
* config The configuration to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Sets the port to start the MicrosoftEdgeDriver on.
|
||||
* @param {number} port The port to use, or 0 for any free port.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
* @throws {Error} If the port is invalid.
|
||||
*/
|
||||
usingPort(port: number): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Defines the environment to start the server under. This settings will be
|
||||
* inherited by every browser session started by the server.
|
||||
* @param {!Object.<string, string>} env The environment to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
withEnvironment(env: Object): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Creates a new DriverService using this instance's current configuration.
|
||||
* @return {!remote.DriverService} A new driver service using this instance's
|
||||
* current configuration.
|
||||
* @throws {Error} If the driver exectuable was not specified and a default
|
||||
* could not be found on the current PATH.
|
||||
*/
|
||||
build(): remote.DriverService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default MicrosoftEdgeDriver service. If such a service has
|
||||
* not been configured, one will be constructed using the default configuration
|
||||
* for an MicrosoftEdgeDriver executable found on the system PATH.
|
||||
* @return {!remote.DriverService} The default MicrosoftEdgeDriver service.
|
||||
*/
|
||||
export function getDefaultService(): remote.DriverService;
|
||||
|
||||
/**
|
||||
* Sets the default service to use for new MicrosoftEdgeDriver instances.
|
||||
* @param {!remote.DriverService} service The service to use.
|
||||
* @throws {Error} If the default service is currently running.
|
||||
*/
|
||||
export function setDefaultService(service: remote.DriverService): void;
|
||||
|
||||
Vendored
+9
-13
@@ -1,15 +1,11 @@
|
||||
import * as webdriver from './index';
|
||||
|
||||
declare namespace executors {
|
||||
/**
|
||||
* Creates a command executor that uses WebDriver's JSON wire protocol.
|
||||
* @param {(string|!promise.Promise<string>)} url The server's URL,
|
||||
* or a promise that will resolve to that URL.
|
||||
* @param {?string=} opt_proxy (optional) The URL of the HTTP proxy for the
|
||||
* client to use.
|
||||
* @returns {!./lib/command.Executor} The new command executor.
|
||||
*/
|
||||
function createExecutor(url: string | webdriver.promise.Promise<string>, opt_agent?: string, opt_proxy?: string): webdriver.Executor;
|
||||
}
|
||||
|
||||
export = executors;
|
||||
/**
|
||||
* Creates a command executor that uses WebDriver's JSON wire protocol.
|
||||
* @param {(string|!promise.Promise<string>)} url The server's URL,
|
||||
* or a promise that will resolve to that URL.
|
||||
* @param {?string=} opt_proxy (optional) The URL of the HTTP proxy for the
|
||||
* client to use.
|
||||
* @returns {!./lib/command.Executor} The new command executor.
|
||||
*/
|
||||
export function createExecutor(url: string | webdriver.promise.Promise<string>, opt_agent?: string, opt_proxy?: string): webdriver.Executor;
|
||||
|
||||
Vendored
+235
-239
@@ -1,257 +1,253 @@
|
||||
import * as webdriver from './index';
|
||||
import * as remote from './remote';
|
||||
|
||||
declare namespace firefox {
|
||||
/**
|
||||
* Manages a Firefox subprocess configured for use with WebDriver.
|
||||
*/
|
||||
export class Binary {
|
||||
/**
|
||||
* Manages a Firefox subprocess configured for use with WebDriver.
|
||||
* @param {string=} opt_exe Path to the Firefox binary to use. If not
|
||||
* specified, will attempt to locate Firefox on the current system.
|
||||
* @constructor
|
||||
*/
|
||||
class Binary {
|
||||
/**
|
||||
* @param {string=} opt_exe Path to the Firefox binary to use. If not
|
||||
* specified, will attempt to locate Firefox on the current system.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Add arguments to the command line used to start Firefox.
|
||||
* @param {...(string|!Array.<string>)} var_args Either the arguments to add as
|
||||
* varargs, or the arguments as an array.
|
||||
*/
|
||||
addArguments(...var_args: string[]): void;
|
||||
|
||||
|
||||
/**
|
||||
* Launches Firefox and eturns a promise that will be fulfilled when the process
|
||||
* terminates.
|
||||
* @param {string} profile Path to the profile directory to use.
|
||||
* @return {!promise.Promise.<!exec.Result>} A promise for the process result.
|
||||
* @throws {Error} If this instance has already been started.
|
||||
*/
|
||||
launch(profile: string): webdriver.promise.Promise<any>;
|
||||
|
||||
|
||||
/**
|
||||
* Kills the managed Firefox process.
|
||||
* @return {!promise.Promise} A promise for when the process has terminated.
|
||||
*/
|
||||
kill(): webdriver.promise.Promise<void>;
|
||||
}
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Models a Firefox proifle directory for use with the FirefoxDriver. The
|
||||
* {@code Proifle} directory uses an in-memory model until {@link #writeToDisk}
|
||||
* is called.
|
||||
* Add arguments to the command line used to start Firefox.
|
||||
* @param {...(string|!Array.<string>)} var_args Either the arguments to add as
|
||||
* varargs, or the arguments as an array.
|
||||
*/
|
||||
class Profile {
|
||||
/**
|
||||
* @param {string=} opt_dir Path to an existing Firefox profile directory to
|
||||
* use a template for this profile. If not specified, a blank profile will
|
||||
* be used.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(opt_dir?: string);
|
||||
addArguments(...var_args: string[]): void;
|
||||
|
||||
/**
|
||||
* Registers an extension to be included with this profile.
|
||||
* @param {string} extension Path to the extension to include, as either an
|
||||
* unpacked extension directory or the path to a xpi file.
|
||||
*/
|
||||
addExtension(extension: string): void;
|
||||
|
||||
|
||||
/**
|
||||
* Sets a desired preference for this profile.
|
||||
* @param {string} key The preference key.
|
||||
* @param {(string|number|boolean)} value The preference value.
|
||||
* @throws {Error} If attempting to set a frozen preference.
|
||||
*/
|
||||
setPreference(key: string, value: string): void;
|
||||
setPreference(key: string, value: number): void;
|
||||
setPreference(key: string, value: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the currently configured value of a profile preference. This does
|
||||
* not include any defaults defined in the profile's template directory user.js
|
||||
* file (if a template were specified on construction).
|
||||
* @param {string} key The desired preference.
|
||||
* @return {(string|number|boolean|undefined)} The current value of the
|
||||
* requested preference.
|
||||
*/
|
||||
getPreference(key: string): any;
|
||||
|
||||
|
||||
/**
|
||||
* @return {number} The port this profile is currently configured to use, or
|
||||
* 0 if the port will be selected at random when the profile is written
|
||||
* to disk.
|
||||
*/
|
||||
getPort(): number;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the port to use for the WebDriver extension loaded by this profile.
|
||||
* @param {number} port The desired port, or 0 to use any free port.
|
||||
*/
|
||||
setPort(port: number): void;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the FirefoxDriver is configured to automatically
|
||||
* accept untrusted SSL certificates.
|
||||
*/
|
||||
acceptUntrustedCerts(): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether the FirefoxDriver should automatically accept untrusted SSL
|
||||
* certificates.
|
||||
* @param {boolean} value .
|
||||
*/
|
||||
setAcceptUntrustedCerts(value: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to assume untrusted certificates come from untrusted issuers.
|
||||
* @param {boolean} value .
|
||||
*/
|
||||
setAssumeUntrustedCertIssuer(value: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether to assume untrusted certs come from untrusted
|
||||
* issuers.
|
||||
*/
|
||||
assumeUntrustedCertIssuer(): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to use native events with this profile.
|
||||
* @param {boolean} enabled .
|
||||
*/
|
||||
setNativeEventsEnabled(enabled: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether native events are enabled in this profile.
|
||||
* @return {boolean} .
|
||||
*/
|
||||
nativeEventsEnabled(): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Writes this profile to disk.
|
||||
* @param {boolean=} opt_excludeWebDriverExt Whether to exclude the WebDriver
|
||||
* extension from the generated profile. Used to reduce the size of an
|
||||
* {@link #encode() encoded profile} since the server will always install
|
||||
* the extension itself.
|
||||
* @return {!promise.Promise.<string>} A promise for the path to the new
|
||||
* profile directory.
|
||||
*/
|
||||
writeToDisk(opt_excludeWebDriverExt?: boolean): webdriver.promise.Promise<string>;
|
||||
|
||||
|
||||
/**
|
||||
* Encodes this profile as a zipped, base64 encoded directory.
|
||||
* @return {!promise.Promise.<string>} A promise for the encoded profile.
|
||||
*/
|
||||
encode(): webdriver.promise.Promise<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for the FirefoxDriver.
|
||||
* Launches Firefox and eturns a promise that will be fulfilled when the process
|
||||
* terminates.
|
||||
* @param {string} profile Path to the profile directory to use.
|
||||
* @return {!promise.Promise.<!exec.Result>} A promise for the process result.
|
||||
* @throws {Error} If this instance has already been started.
|
||||
*/
|
||||
class Options {
|
||||
/**
|
||||
* Sets the profile to use. The profile may be specified as a
|
||||
* {@link Profile} object or as the path to an existing Firefox profile to use
|
||||
* as a template.
|
||||
*
|
||||
* @param {(string|!Profile)} profile The profile to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProfile(profile: string | any): Options;
|
||||
launch(profile: string): webdriver.promise.Promise<any>;
|
||||
|
||||
/**
|
||||
* Sets the binary to use. The binary may be specified as the path to a Firefox
|
||||
* executable, or as a {@link Binary} object.
|
||||
*
|
||||
* @param {(string|!Binary)} binary The binary to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setBinary(binary: string | any): Options;
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPreferences(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy to use.
|
||||
*
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Sets whether to use Mozilla's Marionette to drive the browser.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
|
||||
*/
|
||||
useMarionette(marionette: any): Options;
|
||||
|
||||
/**
|
||||
* Converts these options to a {@link capabilities.Capabilities} instance.
|
||||
*
|
||||
* @return {!capabilities.Capabilities} A new capabilities object.
|
||||
*/
|
||||
toCapabilities(): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string} .
|
||||
* @throws {Error}
|
||||
* Kills the managed Firefox process.
|
||||
* @return {!promise.Promise} A promise for when the process has terminated.
|
||||
*/
|
||||
function findWires(): string;
|
||||
|
||||
/**
|
||||
* @param {(string|!Binary)} binary .
|
||||
* @return {!remote.DriverService} .
|
||||
*/
|
||||
function createWiresService(binary: string | any): remote.DriverService;
|
||||
|
||||
/**
|
||||
* @param {(Profile|string)} profile The profile to prepare.
|
||||
* @param {number} port The port the FirefoxDriver should listen on.
|
||||
* @return {!Promise<string>} a promise for the path to the profile directory.
|
||||
*/
|
||||
function prepareProfile(profile: string | any, port: number): any;
|
||||
|
||||
/**
|
||||
* A WebDriver client for Firefox.
|
||||
*/
|
||||
class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(Options|capabilities.Capabilities|Object)=} opt_config The
|
||||
* configuration options for this driver, specified as either an
|
||||
* {@link Options} or {@link capabilities.Capabilities}, or as a raw hash
|
||||
* object.
|
||||
* @param {promise.ControlFlow=} opt_flow The flow to
|
||||
* schedule commands through. Defaults to the active flow object.
|
||||
*/
|
||||
constructor(opt_config?: Options | webdriver.Capabilities | Object, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
setFileDetector(): void;
|
||||
}
|
||||
kill(): webdriver.promise.Promise<void>;
|
||||
}
|
||||
|
||||
export = firefox;
|
||||
/**
|
||||
* Models a Firefox proifle directory for use with the FirefoxDriver. The
|
||||
* {@code Proifle} directory uses an in-memory model until {@link #writeToDisk}
|
||||
* is called.
|
||||
*/
|
||||
export class Profile {
|
||||
/**
|
||||
* @param {string=} opt_dir Path to an existing Firefox profile directory to
|
||||
* use a template for this profile. If not specified, a blank profile will
|
||||
* be used.
|
||||
* @constructor
|
||||
*/
|
||||
constructor(opt_dir?: string);
|
||||
|
||||
/**
|
||||
* Registers an extension to be included with this profile.
|
||||
* @param {string} extension Path to the extension to include, as either an
|
||||
* unpacked extension directory or the path to a xpi file.
|
||||
*/
|
||||
addExtension(extension: string): void;
|
||||
|
||||
|
||||
/**
|
||||
* Sets a desired preference for this profile.
|
||||
* @param {string} key The preference key.
|
||||
* @param {(string|number|boolean)} value The preference value.
|
||||
* @throws {Error} If attempting to set a frozen preference.
|
||||
*/
|
||||
setPreference(key: string, value: string): void;
|
||||
setPreference(key: string, value: number): void;
|
||||
setPreference(key: string, value: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the currently configured value of a profile preference. This does
|
||||
* not include any defaults defined in the profile's template directory user.js
|
||||
* file (if a template were specified on construction).
|
||||
* @param {string} key The desired preference.
|
||||
* @return {(string|number|boolean|undefined)} The current value of the
|
||||
* requested preference.
|
||||
*/
|
||||
getPreference(key: string): any;
|
||||
|
||||
|
||||
/**
|
||||
* @return {number} The port this profile is currently configured to use, or
|
||||
* 0 if the port will be selected at random when the profile is written
|
||||
* to disk.
|
||||
*/
|
||||
getPort(): number;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the port to use for the WebDriver extension loaded by this profile.
|
||||
* @param {number} port The desired port, or 0 to use any free port.
|
||||
*/
|
||||
setPort(port: number): void;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether the FirefoxDriver is configured to automatically
|
||||
* accept untrusted SSL certificates.
|
||||
*/
|
||||
acceptUntrustedCerts(): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether the FirefoxDriver should automatically accept untrusted SSL
|
||||
* certificates.
|
||||
* @param {boolean} value .
|
||||
*/
|
||||
setAcceptUntrustedCerts(value: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to assume untrusted certificates come from untrusted issuers.
|
||||
* @param {boolean} value .
|
||||
*/
|
||||
setAssumeUntrustedCertIssuer(value: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} Whether to assume untrusted certs come from untrusted
|
||||
* issuers.
|
||||
*/
|
||||
assumeUntrustedCertIssuer(): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Sets whether to use native events with this profile.
|
||||
* @param {boolean} enabled .
|
||||
*/
|
||||
setNativeEventsEnabled(enabled: boolean): void;
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether native events are enabled in this profile.
|
||||
* @return {boolean} .
|
||||
*/
|
||||
nativeEventsEnabled(): boolean;
|
||||
|
||||
|
||||
/**
|
||||
* Writes this profile to disk.
|
||||
* @param {boolean=} opt_excludeWebDriverExt Whether to exclude the WebDriver
|
||||
* extension from the generated profile. Used to reduce the size of an
|
||||
* {@link #encode() encoded profile} since the server will always install
|
||||
* the extension itself.
|
||||
* @return {!promise.Promise.<string>} A promise for the path to the new
|
||||
* profile directory.
|
||||
*/
|
||||
writeToDisk(opt_excludeWebDriverExt?: boolean): webdriver.promise.Promise<string>;
|
||||
|
||||
|
||||
/**
|
||||
* Encodes this profile as a zipped, base64 encoded directory.
|
||||
* @return {!promise.Promise.<string>} A promise for the encoded profile.
|
||||
*/
|
||||
encode(): webdriver.promise.Promise<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for the FirefoxDriver.
|
||||
*/
|
||||
export class Options {
|
||||
/**
|
||||
* Sets the profile to use. The profile may be specified as a
|
||||
* {@link Profile} object or as the path to an existing Firefox profile to use
|
||||
* as a template.
|
||||
*
|
||||
* @param {(string|!Profile)} profile The profile to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProfile(profile: string | any): Options;
|
||||
|
||||
/**
|
||||
* Sets the binary to use. The binary may be specified as the path to a Firefox
|
||||
* executable, or as a {@link Binary} object.
|
||||
*
|
||||
* @param {(string|!Binary)} binary The binary to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setBinary(binary: string | any): Options;
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPreferences(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy to use.
|
||||
*
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Sets whether to use Mozilla's Marionette to drive the browser.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
|
||||
*/
|
||||
useMarionette(marionette: any): Options;
|
||||
|
||||
/**
|
||||
* Converts these options to a {@link capabilities.Capabilities} instance.
|
||||
*
|
||||
* @return {!capabilities.Capabilities} A new capabilities object.
|
||||
*/
|
||||
toCapabilities(): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {string} .
|
||||
* @throws {Error}
|
||||
*/
|
||||
export function findWires(): string;
|
||||
|
||||
/**
|
||||
* @param {(string|!Binary)} binary .
|
||||
* @return {!remote.DriverService} .
|
||||
*/
|
||||
export function createWiresService(binary: string | any): remote.DriverService;
|
||||
|
||||
/**
|
||||
* @param {(Profile|string)} profile The profile to prepare.
|
||||
* @param {number} port The port the FirefoxDriver should listen on.
|
||||
* @return {!Promise<string>} a promise for the path to the profile directory.
|
||||
*/
|
||||
export function prepareProfile(profile: string | any, port: number): any;
|
||||
|
||||
/**
|
||||
* A WebDriver client for Firefox.
|
||||
*/
|
||||
export class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(Options|capabilities.Capabilities|Object)=} opt_config The
|
||||
* configuration options for this driver, specified as either an
|
||||
* {@link Options} or {@link capabilities.Capabilities}, or as a raw hash
|
||||
* object.
|
||||
* @param {promise.ControlFlow=} opt_flow The flow to
|
||||
* schedule commands through. Defaults to the active flow object.
|
||||
*/
|
||||
constructor(opt_config?: Options | webdriver.Capabilities | Object, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
setFileDetector(): void;
|
||||
}
|
||||
|
||||
Vendored
+145
-149
@@ -1,156 +1,152 @@
|
||||
import * as webdriver from './index';
|
||||
|
||||
declare namespace http {
|
||||
/**
|
||||
* Converts a headers map to a HTTP header block string.
|
||||
* @param {!Map<string, string>} headers The map to convert.
|
||||
* @return {string} The headers as a string.
|
||||
*/
|
||||
export function headersToString(headers: any): string;
|
||||
|
||||
/**
|
||||
* Represents a HTTP request message. This class is a 'partial' request and only
|
||||
* defines the path on the server to send a request to. It is each client's
|
||||
* responsibility to build the full URL for the final request.
|
||||
* @final
|
||||
*/
|
||||
export class HttpRequest {
|
||||
/**
|
||||
* Converts a headers map to a HTTP header block string.
|
||||
* @param {!Map<string, string>} headers The map to convert.
|
||||
* @return {string} The headers as a string.
|
||||
* @param {string} method The HTTP method to use for the request.
|
||||
* @param {string} path The path on the server to send the request to.
|
||||
* @param {Object=} opt_data This request's non-serialized JSON payload data.
|
||||
*/
|
||||
function headersToString(headers: any): string;
|
||||
constructor(method: string, path: string, opt_data?: Object);
|
||||
|
||||
/**
|
||||
* Represents a HTTP request message. This class is a 'partial' request and only
|
||||
* defines the path on the server to send a request to. It is each client's
|
||||
* responsibility to build the full URL for the final request.
|
||||
* @final
|
||||
*/
|
||||
class HttpRequest {
|
||||
/**
|
||||
* @param {string} method The HTTP method to use for the request.
|
||||
* @param {string} path The path on the server to send the request to.
|
||||
* @param {Object=} opt_data This request's non-serialized JSON payload data.
|
||||
*/
|
||||
constructor(method: string, path: string, opt_data?: Object);
|
||||
|
||||
/** @override */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a HTTP response message.
|
||||
* @final
|
||||
*/
|
||||
class HttpResponse {
|
||||
/**
|
||||
* @param {number} status The response code.
|
||||
* @param {!Object<string>} headers The response headers. All header names
|
||||
* will be converted to lowercase strings for consistent lookups.
|
||||
* @param {string} body The response body.
|
||||
*/
|
||||
constructor(status: number, headers: Object, body: string);
|
||||
|
||||
/** @override */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
function post(path: string): any;
|
||||
function del(path: string): any;
|
||||
function get(path: string): any;
|
||||
function resource(method: string, path: string): any;
|
||||
|
||||
/**
|
||||
* A basic HTTP client used to send messages to a remote end.
|
||||
*/
|
||||
class HttpClient {
|
||||
/**
|
||||
* @param {string} serverUrl URL for the WebDriver server to send commands to.
|
||||
* @param {http.Agent=} opt_agent The agent to use for each request.
|
||||
* Defaults to `http.globalAgent`.
|
||||
* @param {?string=} opt_proxy The proxy to use for the connection to the
|
||||
* server. Default is to use no proxy.
|
||||
*/
|
||||
constructor(serverUrl: string, opt_agent?: any, opt_proxy?: string);
|
||||
|
||||
/**
|
||||
* Sends a request to the server. The client will automatically follow any
|
||||
* redirects returned by the server, fulfilling the returned promise with the
|
||||
* final response.
|
||||
*
|
||||
* @param {!HttpRequest} httpRequest The request to send.
|
||||
* @return {!promise.Promise<HttpResponse>} A promise that will be fulfilled
|
||||
* with the server's response.
|
||||
*/
|
||||
send(httpRequest: HttpRequest): webdriver.promise.Promise<HttpResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a single HTTP request.
|
||||
* @param {!Object} options The request options.
|
||||
* @param {function(!HttpResponse)} onOk The function to call if the
|
||||
* request succeeds.
|
||||
* @param {function(!Error)} onError The function to call if the request fails.
|
||||
* @param {?string=} opt_data The data to send with the request.
|
||||
* @param {?string=} opt_proxy The proxy server to use for the request.
|
||||
*/
|
||||
function sendRequest(options: Object, onOk: any, onError: any, opt_data?: string, opt_proxy?: string): any;
|
||||
|
||||
/**
|
||||
* A command executor that communicates with the server using HTTP + JSON.
|
||||
*
|
||||
* By default, each instance of this class will use the legacy wire protocol
|
||||
* from [Selenium project][json]. The executor will automatically switch to the
|
||||
* [W3C wire protocol][w3c] if the remote end returns a compliant response to
|
||||
* a new session command.
|
||||
*
|
||||
* [json]: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
|
||||
* [w3c]: https://w3c.github.io/webdriver/webdriver-spec.html
|
||||
*
|
||||
* @implements {cmd.Executor}
|
||||
*/
|
||||
class Executor {
|
||||
/**
|
||||
* @param {!HttpClient} client The client to use for sending requests to the
|
||||
* server.
|
||||
*/
|
||||
constructor(client: HttpClient);
|
||||
|
||||
/**
|
||||
* Defines a new command for use with this executor. When a command is sent,
|
||||
* the {@code path} will be preprocessed using the command's parameters; any
|
||||
* path segments prefixed with ':' will be replaced by the parameter of the
|
||||
* same name. For example, given '/person/:name' and the parameters
|
||||
* '{name: 'Bob'}', the final command path will be '/person/Bob'.
|
||||
*
|
||||
* @param {string} name The command name.
|
||||
* @param {string} method The HTTP method to use when sending this command.
|
||||
* @param {string} path The path to send the command to, relative to
|
||||
* the WebDriver server's command root and of the form
|
||||
* '/path/:variable/segment'.
|
||||
*/
|
||||
defineCommand(name: string, method: string, path: string): void;
|
||||
|
||||
/** @override */
|
||||
execute(command: any): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} str .
|
||||
* @return {?} .
|
||||
*/
|
||||
function tryParse(str: string): any;
|
||||
|
||||
/**
|
||||
* Callback used to parse {@link HttpResponse} objects from a
|
||||
* {@link HttpClient}.
|
||||
* @param {!HttpResponse} httpResponse The HTTP response to parse.
|
||||
* @param {boolean} w3c Whether the response should be processed using the
|
||||
* W3C wire protocol.
|
||||
* @return {{value: ?}} The parsed response.
|
||||
* @throws {WebDriverError} If the HTTP response is an error.
|
||||
*/
|
||||
function parseHttpResponse(httpResponse: HttpResponse, w3c: boolean): any;
|
||||
|
||||
/**
|
||||
* Builds a fully qualified path using the given set of command parameters. Each
|
||||
* path segment prefixed with ':' will be replaced by the value of the
|
||||
* corresponding parameter. All parameters spliced into the path will be
|
||||
* removed from the parameter map.
|
||||
* @param {string} path The original resource path.
|
||||
* @param {!Object<*>} parameters The parameters object to splice into the path.
|
||||
* @return {string} The modified path.
|
||||
*/
|
||||
function buildPath(path: string, parameters: Object): string;
|
||||
/** @override */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export = http;
|
||||
/**
|
||||
* Represents a HTTP response message.
|
||||
* @final
|
||||
*/
|
||||
export class HttpResponse {
|
||||
/**
|
||||
* @param {number} status The response code.
|
||||
* @param {!Object<string>} headers The response headers. All header names
|
||||
* will be converted to lowercase strings for consistent lookups.
|
||||
* @param {string} body The response body.
|
||||
*/
|
||||
constructor(status: number, headers: Object, body: string);
|
||||
|
||||
/** @override */
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
export function post(path: string): any;
|
||||
export function del(path: string): any;
|
||||
export function get(path: string): any;
|
||||
export function resource(method: string, path: string): any;
|
||||
|
||||
/**
|
||||
* A basic HTTP client used to send messages to a remote end.
|
||||
*/
|
||||
export class HttpClient {
|
||||
/**
|
||||
* @param {string} serverUrl URL for the WebDriver server to send commands to.
|
||||
* @param {http.Agent=} opt_agent The agent to use for each request.
|
||||
* Defaults to `http.globalAgent`.
|
||||
* @param {?string=} opt_proxy The proxy to use for the connection to the
|
||||
* server. Default is to use no proxy.
|
||||
*/
|
||||
constructor(serverUrl: string, opt_agent?: any, opt_proxy?: string);
|
||||
|
||||
/**
|
||||
* Sends a request to the server. The client will automatically follow any
|
||||
* redirects returned by the server, fulfilling the returned promise with the
|
||||
* final response.
|
||||
*
|
||||
* @param {!HttpRequest} httpRequest The request to send.
|
||||
* @return {!promise.Promise<HttpResponse>} A promise that will be fulfilled
|
||||
* with the server's response.
|
||||
*/
|
||||
send(httpRequest: HttpRequest): webdriver.promise.Promise<HttpResponse>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a single HTTP request.
|
||||
* @param {!Object} options The request options.
|
||||
* @param {function(!HttpResponse)} onOk The function to call if the
|
||||
* request succeeds.
|
||||
* @param {function(!Error)} onError The function to call if the request fails.
|
||||
* @param {?string=} opt_data The data to send with the request.
|
||||
* @param {?string=} opt_proxy The proxy server to use for the request.
|
||||
*/
|
||||
export function sendRequest(options: Object, onOk: any, onError: any, opt_data?: string, opt_proxy?: string): any;
|
||||
|
||||
/**
|
||||
* A command executor that communicates with the server using HTTP + JSON.
|
||||
*
|
||||
* By default, each instance of this class will use the legacy wire protocol
|
||||
* from [Selenium project][json]. The executor will automatically switch to the
|
||||
* [W3C wire protocol][w3c] if the remote end returns a compliant response to
|
||||
* a new session command.
|
||||
*
|
||||
* [json]: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
|
||||
* [w3c]: https://w3c.github.io/webdriver/webdriver-spec.html
|
||||
*
|
||||
* @implements {cmd.Executor}
|
||||
*/
|
||||
export class Executor {
|
||||
/**
|
||||
* @param {!HttpClient} client The client to use for sending requests to the
|
||||
* server.
|
||||
*/
|
||||
constructor(client: HttpClient);
|
||||
|
||||
/**
|
||||
* Defines a new command for use with this executor. When a command is sent,
|
||||
* the {@code path} will be preprocessed using the command's parameters; any
|
||||
* path segments prefixed with ':' will be replaced by the parameter of the
|
||||
* same name. For example, given '/person/:name' and the parameters
|
||||
* '{name: 'Bob'}', the final command path will be '/person/Bob'.
|
||||
*
|
||||
* @param {string} name The command name.
|
||||
* @param {string} method The HTTP method to use when sending this command.
|
||||
* @param {string} path The path to send the command to, relative to
|
||||
* the WebDriver server's command root and of the form
|
||||
* '/path/:variable/segment'.
|
||||
*/
|
||||
defineCommand(name: string, method: string, path: string): void;
|
||||
|
||||
/** @override */
|
||||
execute(command: any): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} str .
|
||||
* @return {?} .
|
||||
*/
|
||||
export function tryParse(str: string): any;
|
||||
|
||||
/**
|
||||
* Callback used to parse {@link HttpResponse} objects from a
|
||||
* {@link HttpClient}.
|
||||
* @param {!HttpResponse} httpResponse The HTTP response to parse.
|
||||
* @param {boolean} w3c Whether the response should be processed using the
|
||||
* W3C wire protocol.
|
||||
* @return {{value: ?}} The parsed response.
|
||||
* @throws {WebDriverError} If the HTTP response is an error.
|
||||
*/
|
||||
export function parseHttpResponse(httpResponse: HttpResponse, w3c: boolean): any;
|
||||
|
||||
/**
|
||||
* Builds a fully qualified path using the given set of command parameters. Each
|
||||
* path segment prefixed with ':' will be replaced by the value of the
|
||||
* corresponding parameter. All parameters spliced into the path will be
|
||||
* removed from the parameter map.
|
||||
* @param {string} path The original resource path.
|
||||
* @param {!Object<*>} parameters The parameters object to splice into the path.
|
||||
* @return {string} The modified path.
|
||||
*/
|
||||
export function buildPath(path: string, parameters: Object): string;
|
||||
|
||||
Vendored
+198
-204
@@ -1,211 +1,205 @@
|
||||
import * as webdriver from './index';
|
||||
|
||||
declare namespace ie {
|
||||
/**
|
||||
* A WebDriver client for Microsoft's Internet Explorer.
|
||||
*/
|
||||
export class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to use,
|
||||
* or {@code null} to use the currently active flow.
|
||||
*/
|
||||
constructor(opt_config?: webdriver.Capabilities | Options, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* A WebDriver client for Microsoft's Internet Explorer.
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to use,
|
||||
* or {@code null} to use the currently active flow.
|
||||
*/
|
||||
constructor(opt_config?: webdriver.Capabilities | Options, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
setFileDetector(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for managing IEDriver specific options.
|
||||
*/
|
||||
class Options {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Extracts the IEDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!capabilities.Capabilities} caps The capabilities object.
|
||||
* @return {!Options} The IEDriver options.
|
||||
*/
|
||||
static fromCapabilities(caps: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Whether to disable the protected mode settings check when the session is
|
||||
* created. Disbling this setting may lead to significant instability as the
|
||||
* browser may become unresponsive/hang. Only 'best effort' support is provided
|
||||
* when using this capability.
|
||||
*
|
||||
* For more information, refer to the IEDriver's
|
||||
* [required system configuration](http://goo.gl/eH0Yi3).
|
||||
*
|
||||
* @param {boolean} ignoreSettings Whether to ignore protected mode settings.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
introduceFlakinessByIgnoringProtectedModeSettings(ignoreSettings: boolean): Options;
|
||||
|
||||
/**
|
||||
* Indicates whether to skip the check that the browser's zoom level is set to
|
||||
* 100%.
|
||||
*
|
||||
* @param {boolean} ignore Whether to ignore the browser's zoom level settings.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
ignoreZoomSetting(ignore: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the initial URL loaded when IE starts. This is intended to be used with
|
||||
* {@link #ignoreProtectedModeSettings} to allow the user to initialize IE in
|
||||
* the proper Protected Mode zone. Setting this option may cause browser
|
||||
* instability or flaky and unresponsive code. Only 'best effort' support is
|
||||
* provided when using this option.
|
||||
*
|
||||
* @param {string} url The initial browser URL.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
initialBrowserUrl(url: string): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to enable persistent mouse hovering (true by default).
|
||||
* Persistent hovering is achieved by continuously firing mouse over events at
|
||||
* the last location the mouse cursor has been moved to.
|
||||
*
|
||||
* @param {boolean} enable Whether to enable persistent hovering.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
enablePersistentHover(enable: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures whether the driver should attempt to remove obsolete
|
||||
* {@linkplain webdriver.WebElement WebElements} from its internal cache on
|
||||
* page navigation (true by default). Disabling this option will cause the
|
||||
* driver to run with a larger memory footprint.
|
||||
*
|
||||
* @param {boolean} enable Whether to enable element reference cleanup.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
enableElementCacheCleanup(enable: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to require the IE window to have input focus before
|
||||
* performing any user interactions (i.e. mouse or keyboard events). This
|
||||
* option is disabled by default, but delivers much more accurate interaction
|
||||
* events when enabled.
|
||||
*
|
||||
* @param {boolean} require Whether to require window focus.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
requireWindowFocus(require: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures the timeout, in milliseconds, that the driver will attempt to
|
||||
* located and attach to a newly opened instance of Internet Explorer. The
|
||||
* default is zero, which indicates waiting indefinitely.
|
||||
*
|
||||
* @param {number} timeout How long to wait for IE.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
browserAttachTimeout(timeout: number): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to launch Internet Explorer using the CreateProcess API.
|
||||
* If this option is not specified, IE is launched using IELaunchURL, if
|
||||
* available. For IE 8 and above, this option requires the TabProcGrowth
|
||||
* registry value to be set to 0.
|
||||
*
|
||||
* @param {boolean} force Whether to use the CreateProcess API.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
forceCreateProcessApi(force: boolean): Options;
|
||||
|
||||
/**
|
||||
* Specifies command-line switches to use when launching Internet Explorer.
|
||||
* This is only valid when used with {@link #forceCreateProcessApi}.
|
||||
*
|
||||
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addArguments(...var_args: Array<string>): Options;
|
||||
|
||||
/**
|
||||
* Configures whether proxies should be configured on a per-process basis. If
|
||||
* not set, setting a {@linkplain #setProxy proxy} will configure the system
|
||||
* proxy. The default behavior is to use the system proxy.
|
||||
*
|
||||
* @param {boolean} enable Whether to enable per-process proxy settings.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
usePerProcessProxy(enable: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to clear the cache, cookies, history, and saved form data
|
||||
* before starting the browser. _Using this capability will clear session data
|
||||
* for all running instances of Internet Explorer, including those started
|
||||
* manually._
|
||||
*
|
||||
* @param {boolean} cleanSession Whether to clear all session data on startup.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
ensureCleanSession(cleanSession: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the path to the log file the driver should log to.
|
||||
* @param {string} file The log file path.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLogFile(file: string): Options;
|
||||
|
||||
/**
|
||||
* Sets the IEDriverServer's logging {@linkplain Level level}.
|
||||
* @param {Level} level The logging level.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLogLevel(level: webdriver.logging.Level): Options;
|
||||
|
||||
/**
|
||||
* Sets the IP address of the driver's host adapter.
|
||||
* @param {string} host The IP address to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setHost(host: string): Options;
|
||||
|
||||
/**
|
||||
* Sets the path of the temporary data directory to use.
|
||||
* @param {string} path The log file path.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setExtractPath(path: string): Options;
|
||||
|
||||
/**
|
||||
* Sets whether the driver should start in silent mode.
|
||||
* @param {boolean} silent Whether to run in silent mode.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
silent(silent: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link capabilities.Capabilities}
|
||||
* object.
|
||||
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!capabilities.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
setFileDetector(): void;
|
||||
}
|
||||
|
||||
export = ie;
|
||||
/**
|
||||
* Class for managing IEDriver specific options.
|
||||
*/
|
||||
export class Options {
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Extracts the IEDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!capabilities.Capabilities} caps The capabilities object.
|
||||
* @return {!Options} The IEDriver options.
|
||||
*/
|
||||
static fromCapabilities(caps: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Whether to disable the protected mode settings check when the session is
|
||||
* created. Disbling this setting may lead to significant instability as the
|
||||
* browser may become unresponsive/hang. Only 'best effort' support is provided
|
||||
* when using this capability.
|
||||
*
|
||||
* For more information, refer to the IEDriver's
|
||||
* [required system configuration](http://goo.gl/eH0Yi3).
|
||||
*
|
||||
* @param {boolean} ignoreSettings Whether to ignore protected mode settings.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
introduceFlakinessByIgnoringProtectedModeSettings(ignoreSettings: boolean): Options;
|
||||
|
||||
/**
|
||||
* Indicates whether to skip the check that the browser's zoom level is set to
|
||||
* 100%.
|
||||
*
|
||||
* @param {boolean} ignore Whether to ignore the browser's zoom level settings.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
ignoreZoomSetting(ignore: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the initial URL loaded when IE starts. This is intended to be used with
|
||||
* {@link #ignoreProtectedModeSettings} to allow the user to initialize IE in
|
||||
* the proper Protected Mode zone. Setting this option may cause browser
|
||||
* instability or flaky and unresponsive code. Only 'best effort' support is
|
||||
* provided when using this option.
|
||||
*
|
||||
* @param {string} url The initial browser URL.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
initialBrowserUrl(url: string): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to enable persistent mouse hovering (true by default).
|
||||
* Persistent hovering is achieved by continuously firing mouse over events at
|
||||
* the last location the mouse cursor has been moved to.
|
||||
*
|
||||
* @param {boolean} enable Whether to enable persistent hovering.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
enablePersistentHover(enable: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures whether the driver should attempt to remove obsolete
|
||||
* {@linkplain webdriver.WebElement WebElements} from its internal cache on
|
||||
* page navigation (true by default). Disabling this option will cause the
|
||||
* driver to run with a larger memory footprint.
|
||||
*
|
||||
* @param {boolean} enable Whether to enable element reference cleanup.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
enableElementCacheCleanup(enable: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to require the IE window to have input focus before
|
||||
* performing any user interactions (i.e. mouse or keyboard events). This
|
||||
* option is disabled by default, but delivers much more accurate interaction
|
||||
* events when enabled.
|
||||
*
|
||||
* @param {boolean} require Whether to require window focus.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
requireWindowFocus(require: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures the timeout, in milliseconds, that the driver will attempt to
|
||||
* located and attach to a newly opened instance of Internet Explorer. The
|
||||
* default is zero, which indicates waiting indefinitely.
|
||||
*
|
||||
* @param {number} timeout How long to wait for IE.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
browserAttachTimeout(timeout: number): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to launch Internet Explorer using the CreateProcess API.
|
||||
* If this option is not specified, IE is launched using IELaunchURL, if
|
||||
* available. For IE 8 and above, this option requires the TabProcGrowth
|
||||
* registry value to be set to 0.
|
||||
*
|
||||
* @param {boolean} force Whether to use the CreateProcess API.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
forceCreateProcessApi(force: boolean): Options;
|
||||
|
||||
/**
|
||||
* Specifies command-line switches to use when launching Internet Explorer.
|
||||
* This is only valid when used with {@link #forceCreateProcessApi}.
|
||||
*
|
||||
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addArguments(...var_args: string[]): Options;
|
||||
|
||||
/**
|
||||
* Configures whether proxies should be configured on a per-process basis. If
|
||||
* not set, setting a {@linkplain #setProxy proxy} will configure the system
|
||||
* proxy. The default behavior is to use the system proxy.
|
||||
*
|
||||
* @param {boolean} enable Whether to enable per-process proxy settings.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
usePerProcessProxy(enable: boolean): Options;
|
||||
|
||||
/**
|
||||
* Configures whether to clear the cache, cookies, history, and saved form data
|
||||
* before starting the browser. _Using this capability will clear session data
|
||||
* for all running instances of Internet Explorer, including those started
|
||||
* manually._
|
||||
*
|
||||
* @param {boolean} cleanSession Whether to clear all session data on startup.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
ensureCleanSession(cleanSession: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the path to the log file the driver should log to.
|
||||
* @param {string} file The log file path.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLogFile(file: string): Options;
|
||||
|
||||
/**
|
||||
* Sets the IEDriverServer's logging {@linkplain Level level}.
|
||||
* @param {Level} level The logging level.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLogLevel(level: webdriver.logging.Level): Options;
|
||||
|
||||
/**
|
||||
* Sets the IP address of the driver's host adapter.
|
||||
* @param {string} host The IP address to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setHost(host: string): Options;
|
||||
|
||||
/**
|
||||
* Sets the path of the temporary data directory to use.
|
||||
* @param {string} path The log file path.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setExtractPath(path: string): Options;
|
||||
|
||||
/**
|
||||
* Sets whether the driver should start in silent mode.
|
||||
* @param {boolean} silent Whether to run in silent mode.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
silent(silent: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link capabilities.Capabilities}
|
||||
* object.
|
||||
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!capabilities.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
Vendored
+4859
-4864
File diff suppressed because it is too large
Load Diff
Vendored
+153
-157
@@ -1,177 +1,173 @@
|
||||
import * as webdriver from './index';
|
||||
import * as remote from './remote';
|
||||
|
||||
declare namespace opera {
|
||||
/**
|
||||
* Creates {@link remote.DriverService} instances that manages an
|
||||
* [OperaDriver](https://github.com/operasoftware/operachromiumdriver)
|
||||
* server in a child process.
|
||||
*/
|
||||
export class ServiceBuilder {
|
||||
/**
|
||||
* Creates {@link remote.DriverService} instances that manages an
|
||||
* [OperaDriver](https://github.com/operasoftware/operachromiumdriver)
|
||||
* server in a child process.
|
||||
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
||||
* the builder will attempt to locate the operadriver on the current
|
||||
* PATH.
|
||||
* @throws {Error} If provided executable does not exist, or the operadriver
|
||||
* cannot be found on the PATH.
|
||||
*/
|
||||
class ServiceBuilder {
|
||||
/**
|
||||
* @param {string=} opt_exe Path to the server executable to use. If omitted,
|
||||
* the builder will attempt to locate the operadriver on the current
|
||||
* PATH.
|
||||
* @throws {Error} If provided executable does not exist, or the operadriver
|
||||
* cannot be found on the PATH.
|
||||
*/
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Sets the port to start the OperaDriver on.
|
||||
* @param {number} port The port to use, or 0 for any free port.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
* @throws {Error} If the port is invalid.
|
||||
*/
|
||||
usingPort(port: number): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Sets the path of the log file the driver should log to. If a log file is
|
||||
* not specified, the driver will log to stderr.
|
||||
* @param {string} path Path of the log file to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
loggingTo(path: string): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Enables verbose logging.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
enableVerboseLogging(): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Silence sthe drivers output.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
silent(): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Defines the stdio configuration for the driver service. See
|
||||
* {@code child_process.spawn} for more information.
|
||||
* @param {(string|!Array<string|number|!stream.Stream|null|undefined>)}
|
||||
* config The configuration to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Defines the environment to start the server under. This settings will be
|
||||
* inherited by every browser session started by the server.
|
||||
* @param {!Object.<string, string>} env The environment to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
withEnvironment(env: Object): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Creates a new DriverService using this instance's current configuration.
|
||||
* @return {!remote.DriverService} A new driver service using this instance's
|
||||
* current configuration.
|
||||
* @throws {Error} If the driver exectuable was not specified and a default
|
||||
* could not be found on the current PATH.
|
||||
*/
|
||||
build(): remote.DriverService;
|
||||
}
|
||||
constructor(opt_exe?: string);
|
||||
|
||||
/**
|
||||
* Sets the default service to use for new OperaDriver instances.
|
||||
* @param {!remote.DriverService} service The service to use.
|
||||
* @throws {Error} If the default service is currently running.
|
||||
* Sets the port to start the OperaDriver on.
|
||||
* @param {number} port The port to use, or 0 for any free port.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
* @throws {Error} If the port is invalid.
|
||||
*/
|
||||
function setDefaultService(service: remote.DriverService): any;
|
||||
usingPort(port: number): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Returns the default OperaDriver service. If such a service has not been
|
||||
* configured, one will be constructed using the default configuration for
|
||||
* a OperaDriver executable found on the system PATH.
|
||||
* @return {!remote.DriverService} The default OperaDriver service.
|
||||
* Sets the path of the log file the driver should log to. If a log file is
|
||||
* not specified, the driver will log to stderr.
|
||||
* @param {string} path Path of the log file to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
function getDefaultService(): remote.DriverService;
|
||||
loggingTo(path: string): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Class for managing {@linkplain Driver OperaDriver} specific options.
|
||||
* Enables verbose logging.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
class Options {
|
||||
/**
|
||||
* Extracts the OperaDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!capabilities.Capabilities} caps The capabilities object.
|
||||
* @return {!Options} The OperaDriver options.
|
||||
*/
|
||||
static fromCapabilities(caps: webdriver.Capabilities): Options;
|
||||
enableVerboseLogging(): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Add additional command line arguments to use when launching the Opera
|
||||
* browser. Each argument may be specified with or without the '--' prefix
|
||||
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
|
||||
* delimited by an '=': 'foo=bar'.
|
||||
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addArguments(...var_args: Array<string>): Options;
|
||||
/**
|
||||
* Silence sthe drivers output.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
silent(): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Add additional extensions to install when launching Opera. Each extension
|
||||
* should be specified as the path to the packed CRX file, or a Buffer for an
|
||||
* extension.
|
||||
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
|
||||
* extensions to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addExtensions(...var_args: Array<any>): Options;
|
||||
/**
|
||||
* Defines the stdio configuration for the driver service. See
|
||||
* {@code child_process.spawn} for more information.
|
||||
* @param {(string|!Array<string|number|!stream.Stream|null|undefined>)}
|
||||
* config The configuration to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
setStdio(config: string | Array<string | number | any>): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Sets the path to the Opera binary to use. On Mac OS X, this path should
|
||||
* reference the actual Opera executable, not just the application binary. The
|
||||
* binary path be absolute or relative to the operadriver server executable, but
|
||||
* it must exist on the machine that will launch Opera.
|
||||
*
|
||||
* @param {string} path The path to the Opera binary to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setOperaBinaryPath(path: string): Options;
|
||||
/**
|
||||
* Defines the environment to start the server under. This settings will be
|
||||
* inherited by every browser session started by the server.
|
||||
* @param {!Object.<string, string>} env The environment to use.
|
||||
* @return {!ServiceBuilder} A self reference.
|
||||
*/
|
||||
withEnvironment(env: Object): ServiceBuilder;
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {!./lib/logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link capabilities.Capabilities}
|
||||
* object.
|
||||
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!capabilities.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {remote.DriverService=} opt_service The session to use; will use
|
||||
* the {@link getDefaultService default service} by default.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to use,
|
||||
* or {@code null} to use the currently active flow.
|
||||
*/
|
||||
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
setFileDetector(): void;
|
||||
}
|
||||
/**
|
||||
* Creates a new DriverService using this instance's current configuration.
|
||||
* @return {!remote.DriverService} A new driver service using this instance's
|
||||
* current configuration.
|
||||
* @throws {Error} If the driver exectuable was not specified and a default
|
||||
* could not be found on the current PATH.
|
||||
*/
|
||||
build(): remote.DriverService;
|
||||
}
|
||||
|
||||
export = opera;
|
||||
/**
|
||||
* Sets the default service to use for new OperaDriver instances.
|
||||
* @param {!remote.DriverService} service The service to use.
|
||||
* @throws {Error} If the default service is currently running.
|
||||
*/
|
||||
export function setDefaultService(service: remote.DriverService): any;
|
||||
|
||||
/**
|
||||
* Returns the default OperaDriver service. If such a service has not been
|
||||
* configured, one will be constructed using the default configuration for
|
||||
* a OperaDriver executable found on the system PATH.
|
||||
* @return {!remote.DriverService} The default OperaDriver service.
|
||||
*/
|
||||
export function getDefaultService(): remote.DriverService;
|
||||
|
||||
/**
|
||||
* Class for managing {@linkplain Driver OperaDriver} specific options.
|
||||
*/
|
||||
export class Options {
|
||||
/**
|
||||
* Extracts the OperaDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!capabilities.Capabilities} caps The capabilities object.
|
||||
* @return {!Options} The OperaDriver options.
|
||||
*/
|
||||
static fromCapabilities(caps: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Add additional command line arguments to use when launching the Opera
|
||||
* browser. Each argument may be specified with or without the '--' prefix
|
||||
* (e.g. '--foo' and 'foo'). Arguments with an associated value should be
|
||||
* delimited by an '=': 'foo=bar'.
|
||||
* @param {...(string|!Array.<string>)} var_args The arguments to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addArguments(...var_args: string[]): Options;
|
||||
|
||||
/**
|
||||
* Add additional extensions to install when launching Opera. Each extension
|
||||
* should be specified as the path to the packed CRX file, or a Buffer for an
|
||||
* extension.
|
||||
* @param {...(string|!Buffer|!Array.<(string|!Buffer)>)} var_args The
|
||||
* extensions to add.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
addExtensions(...var_args: any[]): Options;
|
||||
|
||||
/**
|
||||
* Sets the path to the Opera binary to use. On Mac OS X, this path should
|
||||
* reference the actual Opera executable, not just the application binary. The
|
||||
* binary path be absolute or relative to the operadriver server executable, but
|
||||
* it must exist on the machine that will launch Opera.
|
||||
*
|
||||
* @param {string} path The path to the Opera binary to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setOperaBinaryPath(path: string): Options;
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {!./lib/logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Sets the proxy settings for the new session.
|
||||
* @param {capabilities.ProxyConfig} proxy The proxy configuration to use.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setProxy(proxy: webdriver.ProxyConfig): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link capabilities.Capabilities}
|
||||
* object.
|
||||
* @param {capabilities.Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!capabilities.Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities?: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
export class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(capabilities.Capabilities|Options)=} opt_config The configuration
|
||||
* options.
|
||||
* @param {remote.DriverService=} opt_service The session to use; will use
|
||||
* the {@link getDefaultService default service} by default.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to use,
|
||||
* or {@code null} to use the currently active flow.
|
||||
*/
|
||||
constructor(opt_config?: webdriver.Capabilities | Options, opt_service?: remote.DriverService, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
/**
|
||||
* This function is a no-op as file detectors are not supported by this
|
||||
* implementation.
|
||||
* @override
|
||||
*/
|
||||
setFileDetector(): void;
|
||||
}
|
||||
|
||||
Vendored
+55
-59
@@ -1,71 +1,67 @@
|
||||
import * as webdriver from './index';
|
||||
|
||||
declare namespace remote {
|
||||
/**
|
||||
* A record object that defines the configuration options for a DriverService
|
||||
* instance.
|
||||
*
|
||||
* @record
|
||||
*/
|
||||
interface ServiceOptions { }
|
||||
|
||||
/**
|
||||
* Manages the life and death of a native executable WebDriver server.
|
||||
*
|
||||
* It is expected that the driver server implements the
|
||||
* https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol.
|
||||
* Furthermore, the managed server should support multiple concurrent sessions,
|
||||
* so that this class may be reused for multiple clients.
|
||||
*/
|
||||
export class DriverService {
|
||||
/**
|
||||
* A record object that defines the configuration options for a DriverService
|
||||
* instance.
|
||||
*
|
||||
* @record
|
||||
* @param {string} executable Path to the executable to run.
|
||||
* @param {!ServiceOptions} options Configuration options for the service.
|
||||
*/
|
||||
interface ServiceOptions { }
|
||||
constructor(executable: string, options: ServiceOptions);
|
||||
|
||||
/**
|
||||
* Manages the life and death of a native executable WebDriver server.
|
||||
*
|
||||
* It is expected that the driver server implements the
|
||||
* https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol.
|
||||
* Furthermore, the managed server should support multiple concurrent sessions,
|
||||
* so that this class may be reused for multiple clients.
|
||||
* @return {!promise.Promise<string>} A promise that resolves to
|
||||
* the server's address.
|
||||
* @throws {Error} If the server has not been started.
|
||||
*/
|
||||
class DriverService {
|
||||
/**
|
||||
* @param {string} executable Path to the executable to run.
|
||||
* @param {!ServiceOptions} options Configuration options for the service.
|
||||
*/
|
||||
constructor(executable: string, options: ServiceOptions);
|
||||
address(): webdriver.promise.Promise<string>;
|
||||
|
||||
/**
|
||||
* @return {!promise.Promise<string>} A promise that resolves to
|
||||
* the server's address.
|
||||
* @throws {Error} If the server has not been started.
|
||||
*/
|
||||
address(): webdriver.promise.Promise<string>;
|
||||
/**
|
||||
* Returns whether the underlying process is still running. This does not take
|
||||
* into account whether the process is in the process of shutting down.
|
||||
* @return {boolean} Whether the underlying service process is running.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
|
||||
/**
|
||||
* Returns whether the underlying process is still running. This does not take
|
||||
* into account whether the process is in the process of shutting down.
|
||||
* @return {boolean} Whether the underlying service process is running.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
/**
|
||||
* Starts the server if it is not already running.
|
||||
* @param {number=} opt_timeoutMs How long to wait, in milliseconds, for the
|
||||
* server to start accepting requests. Defaults to 30 seconds.
|
||||
* @return {!promise.Promise<string>} A promise that will resolve
|
||||
* to the server's base URL when it has started accepting requests. If the
|
||||
* timeout expires before the server has started, the promise will be
|
||||
* rejected.
|
||||
*/
|
||||
start(opt_timeoutMs?: number): webdriver.promise.Promise<string>;
|
||||
|
||||
/**
|
||||
* Starts the server if it is not already running.
|
||||
* @param {number=} opt_timeoutMs How long to wait, in milliseconds, for the
|
||||
* server to start accepting requests. Defaults to 30 seconds.
|
||||
* @return {!promise.Promise<string>} A promise that will resolve
|
||||
* to the server's base URL when it has started accepting requests. If the
|
||||
* timeout expires before the server has started, the promise will be
|
||||
* rejected.
|
||||
*/
|
||||
start(opt_timeoutMs?: number): webdriver.promise.Promise<string>;
|
||||
/**
|
||||
* Stops the service if it is not currently running. This function will kill
|
||||
* the server immediately. To synchronize with the active control flow, use
|
||||
* {@link #stop()}.
|
||||
* @return {!promise.Promise} A promise that will be resolved when
|
||||
* the server has been stopped.
|
||||
*/
|
||||
kill(): webdriver.promise.Promise<any>;
|
||||
|
||||
/**
|
||||
* Stops the service if it is not currently running. This function will kill
|
||||
* the server immediately. To synchronize with the active control flow, use
|
||||
* {@link #stop()}.
|
||||
* @return {!promise.Promise} A promise that will be resolved when
|
||||
* the server has been stopped.
|
||||
*/
|
||||
kill(): webdriver.promise.Promise<any>;
|
||||
|
||||
/**
|
||||
* Schedules a task in the current control flow to stop the server if it is
|
||||
* currently running.
|
||||
* @return {!promise.Promise} A promise that will be resolved when
|
||||
* the server has been stopped.
|
||||
*/
|
||||
stop(): webdriver.promise.Promise<any>;
|
||||
}
|
||||
/**
|
||||
* Schedules a task in the current control flow to stop the server if it is
|
||||
* currently running.
|
||||
* @return {!promise.Promise} A promise that will be resolved when
|
||||
* the server has been stopped.
|
||||
*/
|
||||
stop(): webdriver.promise.Promise<any>;
|
||||
}
|
||||
|
||||
export = remote;
|
||||
|
||||
Vendored
+80
-84
@@ -1,93 +1,89 @@
|
||||
import * as webdriver from './index';
|
||||
|
||||
declare namespace safari {
|
||||
class Server { }
|
||||
export class Server { }
|
||||
|
||||
/**
|
||||
* @return {!Promise<string>} A promise that will resolve with the path
|
||||
* to Safari on the current system.
|
||||
*/
|
||||
function findSafariExecutable(): any;
|
||||
/**
|
||||
* @return {!Promise<string>} A promise that will resolve with the path
|
||||
* to Safari on the current system.
|
||||
*/
|
||||
export function findSafariExecutable(): any;
|
||||
|
||||
/**
|
||||
* @param {string} serverUrl The URL to connect to.
|
||||
* @return {!Promise<string>} A promise for the path to a file that Safari can
|
||||
* open on start-up to trigger a new connection to the WebSocket server.
|
||||
*/
|
||||
function createConnectFile(serverUrl: string): any;
|
||||
/**
|
||||
* @param {string} serverUrl The URL to connect to.
|
||||
* @return {!Promise<string>} A promise for the path to a file that Safari can
|
||||
* open on start-up to trigger a new connection to the WebSocket server.
|
||||
*/
|
||||
export function createConnectFile(serverUrl: string): any;
|
||||
|
||||
/**
|
||||
* Deletes all session data files if so desired.
|
||||
* @param {!Object} desiredCapabilities .
|
||||
* @return {!Array<promise.Promise>} A list of promises for the deleted files.
|
||||
*/
|
||||
function cleanSession(desiredCapabilities: webdriver.Capabilities): any[];
|
||||
/**
|
||||
* Deletes all session data files if so desired.
|
||||
* @param {!Object} desiredCapabilities .
|
||||
* @return {!Array<promise.Promise>} A list of promises for the deleted files.
|
||||
*/
|
||||
export function cleanSession(desiredCapabilities: webdriver.Capabilities): any[];
|
||||
|
||||
/** @return {string} . */
|
||||
function getRandomString(): string;
|
||||
/** @return {string} . */
|
||||
export function getRandomString(): string;
|
||||
|
||||
/**
|
||||
* @implements {command.Executor}
|
||||
*/
|
||||
class CommandExecutor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options specific to the {@link Driver SafariDriver}.
|
||||
*/
|
||||
class Options {
|
||||
/**
|
||||
* Extracts the SafariDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!Capabilities} capabilities The capabilities object.
|
||||
* @return {!Options} The ChromeDriver options.
|
||||
*/
|
||||
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Sets whether to force Safari to start with a clean session. Enabling this
|
||||
* option will cause all global browser data to be deleted.
|
||||
* @param {boolean} clean Whether to make sure the session has no cookies,
|
||||
* cache entries, local storage, or databases.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setCleanSession(clean: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {!./lib/logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link Capabilities} object.
|
||||
* @param {Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* A WebDriver client for Safari. This class should never be instantiated
|
||||
* directly; instead, use the {@linkplain ./builder.Builder Builder}:
|
||||
*
|
||||
* var driver = new Builder()
|
||||
* .forBrowser('safari')
|
||||
* .build();
|
||||
*
|
||||
*/
|
||||
class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(Options|Capabilities)=} opt_config The configuration
|
||||
* options for the new session.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to create
|
||||
* the driver under.
|
||||
*/
|
||||
constructor(opt_config?: Options | webdriver.Capabilities, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
}
|
||||
/**
|
||||
* @implements {command.Executor}
|
||||
*/
|
||||
export class CommandExecutor {
|
||||
}
|
||||
|
||||
export = safari;
|
||||
/**
|
||||
* Configuration options specific to the {@link Driver SafariDriver}.
|
||||
*/
|
||||
export class Options {
|
||||
/**
|
||||
* Extracts the SafariDriver specific options from the given capabilities
|
||||
* object.
|
||||
* @param {!Capabilities} capabilities The capabilities object.
|
||||
* @return {!Options} The ChromeDriver options.
|
||||
*/
|
||||
static fromCapabilities(capabilities: webdriver.Capabilities): Options;
|
||||
|
||||
/**
|
||||
* Sets whether to force Safari to start with a clean session. Enabling this
|
||||
* option will cause all global browser data to be deleted.
|
||||
* @param {boolean} clean Whether to make sure the session has no cookies,
|
||||
* cache entries, local storage, or databases.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setCleanSession(clean: boolean): Options;
|
||||
|
||||
/**
|
||||
* Sets the logging preferences for the new session.
|
||||
* @param {!./lib/logging.Preferences} prefs The logging preferences.
|
||||
* @return {!Options} A self reference.
|
||||
*/
|
||||
setLoggingPrefs(prefs: webdriver.logging.Preferences): Options;
|
||||
|
||||
/**
|
||||
* Converts this options instance to a {@link Capabilities} object.
|
||||
* @param {Capabilities=} opt_capabilities The capabilities to
|
||||
* merge these options into, if any.
|
||||
* @return {!Capabilities} The capabilities.
|
||||
*/
|
||||
toCapabilities(opt_capabilities: webdriver.Capabilities): webdriver.Capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* A WebDriver client for Safari. This class should never be instantiated
|
||||
* directly; instead, use the {@linkplain ./builder.Builder Builder}:
|
||||
*
|
||||
* var driver = new Builder()
|
||||
* .forBrowser('safari')
|
||||
* .build();
|
||||
*
|
||||
*/
|
||||
export class Driver extends webdriver.WebDriver {
|
||||
/**
|
||||
* @param {(Options|Capabilities)=} opt_config The configuration
|
||||
* options for the new session.
|
||||
* @param {promise.ControlFlow=} opt_flow The control flow to create
|
||||
* the driver under.
|
||||
*/
|
||||
constructor(opt_config?: Options | webdriver.Capabilities, opt_flow?: webdriver.promise.ControlFlow);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ function TestServiceBuilder() {
|
||||
builder = builder.setUrlBasePath('path');
|
||||
builder = builder.setStdio('config');
|
||||
builder = builder.setStdio(['A', 'B']);
|
||||
builder = builder.withEnvironment({ 'A': 'a', 'B': 'b' });
|
||||
builder = builder.withEnvironment({ A: 'a', B: 'b' });
|
||||
}
|
||||
|
||||
function TestChromeModule() {
|
||||
|
||||
@@ -8,7 +8,7 @@ function TestBinary() {
|
||||
|
||||
binary.addArguments('A', 'B', 'C');
|
||||
var promise: webdriver.promise.Promise<void> = binary.kill();
|
||||
binary.launch('profile').then(function (result: any) { });
|
||||
binary.launch('profile').then((result: any) => {});
|
||||
}
|
||||
|
||||
function TestFirefoxDriver() {
|
||||
@@ -38,7 +38,7 @@ function TestFirefoxProfile() {
|
||||
var bool: boolean = profile.acceptUntrustedCerts();
|
||||
profile.addExtension('ext');
|
||||
bool = profile.assumeUntrustedCertIssuer();
|
||||
profile.encode().then(function (prof: string) { });
|
||||
profile.encode().then((prof: string) => {});
|
||||
var num: number = profile.getPort();
|
||||
var anything: any = profile.getPreference('key');
|
||||
bool = profile.nativeEventsEnabled();
|
||||
|
||||
@@ -28,7 +28,7 @@ function TestBuilder() {
|
||||
builder = builder.setEnableNativeEvents(true);
|
||||
builder = builder.setFirefoxOptions(new firefox.Options());
|
||||
builder = builder.setLoggingPrefs(new webdriver.logging.Preferences());
|
||||
builder = builder.setLoggingPrefs({ 'key': 'value' });
|
||||
builder = builder.setLoggingPrefs({ key: 'value' });
|
||||
builder = builder.setProxy({ proxyType: 'type' });
|
||||
builder = builder.setScrollBehavior(1);
|
||||
builder = builder.usingServer('http://someserver');
|
||||
@@ -89,7 +89,7 @@ function TestActionSequence() {
|
||||
sequence = sequence.sendKeys('A', 'B', 'C');
|
||||
sequence = sequence.sendKeys('A', webdriver.Key.NULL);
|
||||
|
||||
sequence.perform().then(function () { });
|
||||
sequence.perform().then(() => {});
|
||||
}
|
||||
|
||||
function TestTouchSequence() {
|
||||
@@ -111,7 +111,7 @@ function TestTouchSequence() {
|
||||
sequence = sequence.flick({ xspeed: 100, yspeed: 100 });
|
||||
sequence = sequence.flickElement(element, { x: 100, y: 100 }, 100);
|
||||
|
||||
sequence.perform().then(function () { });
|
||||
sequence.perform().then(() => {});
|
||||
}
|
||||
|
||||
function TestAlert() {
|
||||
@@ -121,10 +121,10 @@ function TestAlert() {
|
||||
|
||||
var alert: webdriver.Alert = driver.switchTo().alert();
|
||||
|
||||
alert.accept().then(function () { });
|
||||
alert.dismiss().then(function () { });
|
||||
alert.getText().then(function (text: string) { });
|
||||
alert.sendKeys('ABC').then(function () { });
|
||||
alert.accept().then(() => {});
|
||||
alert.dismiss().then(() => {});
|
||||
alert.getText().then((text: string) => {});
|
||||
alert.sendKeys('ABC').then(() => {});
|
||||
}
|
||||
|
||||
function TestBrowser() {
|
||||
@@ -164,7 +164,7 @@ function TestCapabilities() {
|
||||
capabilities = capabilities.set(webdriver.Capability.VERSION, { abc: 'def' });
|
||||
capabilities = capabilities.set(webdriver.Capability.VERSION, null);
|
||||
capabilities = capabilities.setLoggingPrefs(new webdriver.logging.Preferences());
|
||||
capabilities = capabilities.setLoggingPrefs({ 'key': 'value' });
|
||||
capabilities = capabilities.setLoggingPrefs({ key: 'value' });
|
||||
capabilities = capabilities.setProxy({ proxyType: 'Type' });
|
||||
capabilities = capabilities.setEnableNativeEvents(true);
|
||||
capabilities = capabilities.setScrollBehavior(1);
|
||||
@@ -328,7 +328,7 @@ function TestCommandName() {
|
||||
function TestEventEmitter() {
|
||||
var emitter: webdriver.EventEmitter = new webdriver.EventEmitter();
|
||||
|
||||
var callback = function (a: number, b: number, c: number) { };
|
||||
var callback = (a: number, b: number, c: number) => {};
|
||||
|
||||
emitter = emitter.addListener('ABC', callback);
|
||||
emitter = emitter.addListener('ABC', callback, this);
|
||||
@@ -453,7 +453,7 @@ function TestBy() {
|
||||
locatorHash = { tagName: 'tag' };
|
||||
locatorHash = { xpath: 'xpath' };
|
||||
|
||||
webdriver.By.js('script', 1, 2, 3)(driver).then(function (abc: number) { });
|
||||
webdriver.By.js('script', 1, 2, 3)(driver).then((abc: number) => {});
|
||||
}
|
||||
|
||||
function TestSession() {
|
||||
@@ -470,11 +470,11 @@ function TestSession() {
|
||||
}
|
||||
|
||||
function TestUnhandledAlertError() {
|
||||
var someFunc = function (error: webdriver.UnhandledAlertError) {
|
||||
var someFunc = (error: webdriver.UnhandledAlertError) => {
|
||||
var baseError: Error = error;
|
||||
var str: string = error.getAlertText();
|
||||
str = error.toString();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function TestWebDriverFileDetector() {
|
||||
@@ -484,7 +484,7 @@ function TestWebDriverFileDetector() {
|
||||
|
||||
var fileDetector: webdriver.FileDetector = new webdriver.FileDetector();
|
||||
|
||||
fileDetector.handleFile(driver, 'path/to/file').then(function (path: string) { });
|
||||
fileDetector.handleFile(driver, 'path/to/file').then((path: string) => {});
|
||||
}
|
||||
|
||||
function TestWebDriverLogs() {
|
||||
@@ -494,8 +494,8 @@ function TestWebDriverLogs() {
|
||||
|
||||
var logs: webdriver.Logs = new webdriver.Logs(driver);
|
||||
|
||||
logs.get(webdriver.logging.Type.BROWSER).then(function (entries: webdriver.logging.Entry[]) { });;
|
||||
logs.getAvailableLogTypes().then(function (types: string[]) { });
|
||||
logs.get(webdriver.logging.Type.BROWSER).then((entries: webdriver.logging.Entry[]) => {});
|
||||
logs.getAvailableLogTypes().then((types: string[]) => {});
|
||||
}
|
||||
|
||||
function TestWebDriverNavigation() {
|
||||
@@ -505,10 +505,10 @@ function TestWebDriverNavigation() {
|
||||
|
||||
var navigation: webdriver.Navigation = new webdriver.Navigation(driver);
|
||||
|
||||
navigation.back().then(function () { });
|
||||
navigation.forward().then(function () { });
|
||||
navigation.refresh().then(function () { });
|
||||
navigation.to('http://google.com').then(function () { });
|
||||
navigation.back().then(() => {});
|
||||
navigation.forward().then(() => {});
|
||||
navigation.refresh().then(() => {});
|
||||
navigation.to('http://google.com').then(() => {});
|
||||
}
|
||||
|
||||
function TestWebDriverOptions() {
|
||||
@@ -529,8 +529,8 @@ function TestWebDriverOptions() {
|
||||
|
||||
promise = options.deleteAllCookies();
|
||||
promise = options.deleteCookie('name');
|
||||
options.getCookie('name').then(function (cookies: webdriver.IWebDriverOptionsCookie) { });
|
||||
options.getCookies().then(function (cookies: webdriver.IWebDriverOptionsCookie[]) { });
|
||||
options.getCookie('name').then((cookies: webdriver.IWebDriverOptionsCookie) => {});
|
||||
options.getCookies().then((cookies: webdriver.IWebDriverOptionsCookie[]) => {});
|
||||
|
||||
var logs: webdriver.Logs = options.logs();
|
||||
var timeouts: webdriver.Timeouts = options.timeouts();
|
||||
@@ -600,10 +600,10 @@ function TestWebDriver() {
|
||||
var touchActions: webdriver.TouchSequence = driver.touchActions();
|
||||
|
||||
// call
|
||||
stringPromise = driver.call<string>(function () { return 'value'; });
|
||||
stringPromise = driver.call<string>(function () { return stringPromise; });
|
||||
stringPromise = driver.call<string>(function () { var d: any = this; return 'value'; }, driver);
|
||||
stringPromise = driver.call<string>(function (a: number) { return 'value'; }, driver, 1);
|
||||
stringPromise = driver.call<string>(() => 'value');
|
||||
stringPromise = driver.call<string>(() => stringPromise);
|
||||
stringPromise = driver.call<string>(() => { var d: any = this; return 'value'; }, driver);
|
||||
stringPromise = driver.call<string>((a: number) => 'value', driver, 1);
|
||||
|
||||
voidPromise = driver.close();
|
||||
flow = driver.controlFlow();
|
||||
@@ -611,14 +611,14 @@ function TestWebDriver() {
|
||||
// executeAsyncScript
|
||||
stringPromise = driver.executeAsyncScript<string>('function(){}');
|
||||
stringPromise = driver.executeAsyncScript<string>('function(){}', 1, 2, 3);
|
||||
stringPromise = driver.executeAsyncScript<string>(function () { });
|
||||
stringPromise = driver.executeAsyncScript<string>(function (a: number) { }, 1);
|
||||
stringPromise = driver.executeAsyncScript<string>(() => {});
|
||||
stringPromise = driver.executeAsyncScript<string>((a: number) => {}, 1);
|
||||
|
||||
// executeScript
|
||||
stringPromise = driver.executeScript<string>('function(){}');
|
||||
stringPromise = driver.executeScript<string>('function(){}', 1, 2, 3);
|
||||
stringPromise = driver.executeScript<string>(function () { });
|
||||
stringPromise = driver.executeScript<string>(function (a: number) { }, 1);
|
||||
stringPromise = driver.executeScript<string>(() => {});
|
||||
stringPromise = driver.executeScript<string>((a: number) => {}, 1);
|
||||
|
||||
// findElement
|
||||
var element: webdriver.WebElement;
|
||||
@@ -626,15 +626,15 @@ function TestWebDriver() {
|
||||
element = driver.findElement(webdriver.By.js('function(){}'));
|
||||
|
||||
// findElements
|
||||
driver.findElements(webdriver.By.className('ABC')).then(function (elements: webdriver.WebElement[]) { });
|
||||
driver.findElements(webdriver.By.js('function(){}')).then(function (elements: webdriver.WebElement[]) { });
|
||||
driver.findElements(webdriver.By.className('ABC')).then((elements: webdriver.WebElement[]) => {});
|
||||
driver.findElements(webdriver.By.js('function(){}')).then((elements: webdriver.WebElement[]) => {});
|
||||
|
||||
voidPromise = driver.get('http://www.google.com');
|
||||
driver.getAllWindowHandles().then(function (handles: string[]) { });
|
||||
driver.getCapabilities().then(function (caps: webdriver.Capabilities) { });
|
||||
driver.getAllWindowHandles().then((handles: string[]) => {});
|
||||
driver.getCapabilities().then((caps: webdriver.Capabilities) => {});
|
||||
stringPromise = driver.getCurrentUrl();
|
||||
stringPromise = driver.getPageSource()
|
||||
driver.getSession().then(function (session: webdriver.Session) { });;
|
||||
stringPromise = driver.getPageSource();
|
||||
driver.getSession().then((session: webdriver.Session) => {});
|
||||
stringPromise = driver.getTitle();
|
||||
stringPromise = driver.getWindowHandle();
|
||||
|
||||
@@ -656,8 +656,8 @@ function TestWebDriver() {
|
||||
var booleanCondition: webdriver.until.Condition<boolean>;
|
||||
booleanPromise = driver.wait(booleanPromise);
|
||||
booleanPromise = driver.wait(booleanCondition);
|
||||
booleanPromise = driver.wait(function (driver: webdriver.WebDriver) { return true; });
|
||||
let conditionFunction: Function;
|
||||
booleanPromise = driver.wait((driver: webdriver.WebDriver) => true);
|
||||
let conditionFunction: Function; // tslint:disable-line:prefer-const
|
||||
booleanPromise = driver.wait(conditionFunction);
|
||||
booleanPromise = driver.wait(booleanPromise, 123);
|
||||
booleanPromise = driver.wait(booleanPromise, 123, 'Message');
|
||||
@@ -690,16 +690,16 @@ function TestWebElement() {
|
||||
voidPromise = element.click();
|
||||
|
||||
element = element.findElement(webdriver.By.id('ABC'));
|
||||
element.findElements(webdriver.By.className('ABC')).then(function (elements: webdriver.WebElement[]) { });
|
||||
element.findElements(webdriver.By.className('ABC')).then((elements: webdriver.WebElement[]) => {});
|
||||
booleanPromise = element.isElementPresent(webdriver.By.className('ABC'));
|
||||
|
||||
stringPromise = element.getAttribute('class');
|
||||
stringPromise = element.getCssValue('display');
|
||||
driver = element.getDriver();
|
||||
stringPromise = element.getInnerHtml();
|
||||
element.getLocation().then(function (location: webdriver.ILocation) { });
|
||||
element.getLocation().then((location: webdriver.ILocation) => {});
|
||||
stringPromise = element.getOuterHtml();
|
||||
element.getSize().then(function (size: webdriver.ISize) { });
|
||||
element.getSize().then((size: webdriver.ISize) => {});
|
||||
stringPromise = element.getTagName();
|
||||
stringPromise = element.getText();
|
||||
booleanPromise = element.isDisplayed();
|
||||
@@ -711,9 +711,9 @@ function TestWebElement() {
|
||||
voidPromise = element.sendKeys(stringPromise, stringPromise, stringPromise);
|
||||
voidPromise = element.sendKeys('A', 1, webdriver.Key.BACK_SPACE, stringPromise);
|
||||
voidPromise = element.submit();
|
||||
element.getId().then(function (id: string) { });
|
||||
element.getRawId().then(function (id: string) { });
|
||||
element.serialize().then(function (id: webdriver.IWebElementId) { });
|
||||
element.getId().then((id: string) => {});
|
||||
element.getRawId().then((id: string) => {});
|
||||
element.serialize().then((id: webdriver.IWebElementId) => {});
|
||||
|
||||
booleanPromise = webdriver.WebElement.equals(element, new webdriver.WebElement(driver, 'elementId'));
|
||||
}
|
||||
@@ -731,13 +731,13 @@ function TestWebElementPromise() {
|
||||
var bool: boolean = elementPromise.isPending();
|
||||
|
||||
elementPromise.then();
|
||||
elementPromise.then(function (element: webdriver.WebElement) { });
|
||||
elementPromise.then(function (element: webdriver.WebElement) { }, function (error: any) { });
|
||||
elementPromise.then(function (element: webdriver.WebElement) { return 'foo'; }, function (error: any) { }).then(function (result: string) { });
|
||||
elementPromise.then((element: webdriver.WebElement) => {});
|
||||
elementPromise.then((element: webdriver.WebElement) => {}, (error: any) => {});
|
||||
elementPromise.then((element: webdriver.WebElement) => 'foo', (error: any) => {}).then((result: string) => {});
|
||||
|
||||
elementPromise.thenCatch(function (error: any) { }).then(function (value: any) { });
|
||||
elementPromise.thenCatch((error: any) => {}).then((value: any) => {});
|
||||
|
||||
elementPromise.thenFinally(function () { });
|
||||
elementPromise.thenFinally(() => {});
|
||||
}
|
||||
|
||||
function TestLogging() {
|
||||
@@ -794,52 +794,51 @@ function TestPromiseModule() {
|
||||
var booleanPromise: webdriver.promise.Promise<boolean>;
|
||||
var voidPromise: webdriver.promise.Promise<void>;
|
||||
|
||||
webdriver.promise.all([stringPromise]).then(function (values: string[]) { });
|
||||
webdriver.promise.all([stringPromise]).then((values: string[]) => {});
|
||||
|
||||
webdriver.promise.asap('abc', function (value: any) { return true; });
|
||||
webdriver.promise.asap('abc', function (value: any) { }, function (err: any) { return 'ABC'; });
|
||||
webdriver.promise.asap('abc', (value: any) => true);
|
||||
webdriver.promise.asap('abc', (value: any) => {}, (err: any) => 'ABC');
|
||||
|
||||
stringPromise = webdriver.promise.checkedNodeCall<string>(function (err: any, value: any) { return 'abc'; });
|
||||
stringPromise = webdriver.promise.checkedNodeCall<string>((err: any, value: any) => 'abc');
|
||||
|
||||
webdriver.promise.consume(function () {
|
||||
webdriver.promise.consume(() => {
|
||||
return 5;
|
||||
}).then(function (value: number) { });
|
||||
webdriver.promise.consume(function () {
|
||||
}).then((value: number) => {});
|
||||
webdriver.promise.consume(() => {
|
||||
return 5;
|
||||
}, this).then(function (value: number) { });
|
||||
webdriver.promise.consume(function (a: number, b: number, c: number) {
|
||||
return 5;
|
||||
}, this, 1, 2, 3).then(function (value: number) { });
|
||||
}, this).then((value: number) => {});
|
||||
webdriver.promise.consume((a: number, b: number, c: number) => 5, this, 1, 2, 3)
|
||||
.then((value: number) => {});
|
||||
|
||||
var numbersPromise: webdriver.promise.Promise<number[]> = webdriver.promise.filter([1, 2, 3], function (element: number, type: any, index: number, arr: number[]) {
|
||||
var numbersPromise: webdriver.promise.Promise<number[]> = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
});
|
||||
numbersPromise = webdriver.promise.filter([1, 2, 3], function (element: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.filter([1, 2, 3], (element: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
}, this);
|
||||
numbersPromise = webdriver.promise.filter(numbersPromise, function (element: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.filter(numbersPromise, (element: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
});
|
||||
numbersPromise = webdriver.promise.filter(numbersPromise, function (element: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.filter(numbersPromise, (element: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
}, this);
|
||||
|
||||
numbersPromise = webdriver.promise.map([1, 2, 3], function (el: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.map([1, 2, 3], (el: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
});
|
||||
numbersPromise = webdriver.promise.map([1, 2, 3], function (el: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.map([1, 2, 3], (el: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
}, this);
|
||||
numbersPromise = webdriver.promise.map(numbersPromise, function (el: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.map(numbersPromise, (el: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
});
|
||||
numbersPromise = webdriver.promise.map(numbersPromise, function (el: number, type: any, index: number, arr: number[]) {
|
||||
numbersPromise = webdriver.promise.map(numbersPromise, (el: number, type: any, index: number, arr: number[]) => {
|
||||
return true;
|
||||
}, this);
|
||||
|
||||
var flow: webdriver.promise.ControlFlow = webdriver.promise.controlFlow();
|
||||
|
||||
stringPromise = webdriver.promise.createFlow<string>(function (newFlow: webdriver.promise.ControlFlow) { return 'ABC' });
|
||||
stringPromise = webdriver.promise.createFlow<string>((newFlow: webdriver.promise.ControlFlow) => 'ABC');
|
||||
|
||||
var deferred: webdriver.promise.Deferred<string>;
|
||||
deferred = webdriver.promise.defer();
|
||||
@@ -857,14 +856,14 @@ function TestPromiseModule() {
|
||||
|
||||
stringPromise = webdriver.promise.fullyResolved('abc');
|
||||
|
||||
var bool: boolean = webdriver.promise.isGenerator(function () { });
|
||||
var bool: boolean = webdriver.promise.isGenerator(() => {});
|
||||
var isPromise: boolean = webdriver.promise.isPromise('ABC');
|
||||
|
||||
stringPromise = webdriver.promise.rejected('{a: 123}');
|
||||
|
||||
webdriver.promise.setDefaultFlow(new webdriver.promise.ControlFlow());
|
||||
|
||||
numberPromise = webdriver.promise.when('abc', function (value: any) { return 123; }, function (err: Error) { return 123; });
|
||||
numberPromise = webdriver.promise.when('abc', (value: any) => 123, (err: Error) => 123);
|
||||
}
|
||||
|
||||
function TestUntilModule() {
|
||||
@@ -872,7 +871,7 @@ function TestUntilModule() {
|
||||
withCapabilities(webdriver.Capabilities.chrome()).
|
||||
build();
|
||||
|
||||
var conditionB: webdriver.until.Condition<boolean> = new webdriver.until.Condition<boolean>('message', function (driver: webdriver.WebDriver) { return true; });
|
||||
var conditionB: webdriver.until.Condition<boolean> = new webdriver.until.Condition<boolean>('message', (driver: webdriver.WebDriver) => true);
|
||||
var conditionBBase: webdriver.until.Condition<boolean> = conditionB;
|
||||
var conditionWebElement: webdriver.until.Condition<webdriver.WebElement>;
|
||||
var conditionWebElements: webdriver.until.Condition<webdriver.WebElement[]>;
|
||||
@@ -912,9 +911,9 @@ function TestControlFlow() {
|
||||
eventType = webdriver.promise.ControlFlow.EventType.UNCAUGHT_EXCEPTION;
|
||||
|
||||
var stringPromise: webdriver.promise.Promise<string>;
|
||||
stringPromise = flow.execute(function () { return 'value'; });
|
||||
stringPromise = flow.execute(function () { return stringPromise; });
|
||||
stringPromise = flow.execute(function () { return stringPromise; }, 'Description');
|
||||
stringPromise = flow.execute(() => 'value');
|
||||
stringPromise = flow.execute(() => stringPromise);
|
||||
stringPromise = flow.execute(() => stringPromise, 'Description');
|
||||
|
||||
var schedule: string;
|
||||
schedule = flow.toString();
|
||||
@@ -928,9 +927,9 @@ function TestControlFlow() {
|
||||
|
||||
stringPromise = flow.wait(stringPromise);
|
||||
|
||||
voidPromise = flow.wait<void>(function () { return true; });
|
||||
voidPromise = flow.wait<void>(function () { return true; }, 123);
|
||||
voidPromise = flow.wait<void>(function () { return stringPromise; }, 123, 'Timeout Message');
|
||||
voidPromise = flow.wait<void>(() => true);
|
||||
voidPromise = flow.wait<void>(() => true, 123);
|
||||
voidPromise = flow.wait<void>(() => stringPromise, 123, 'Timeout Message');
|
||||
}
|
||||
|
||||
function TestDeferred() {
|
||||
@@ -952,28 +951,22 @@ function TestDeferred() {
|
||||
function TestPromiseClass() {
|
||||
var controlFlow: webdriver.promise.ControlFlow;
|
||||
var promise: webdriver.promise.Promise<string>;
|
||||
promise = new webdriver.promise.Promise<string>(function (
|
||||
resolve: (value: string) => void,
|
||||
reject: () => void) { });
|
||||
promise = new webdriver.promise.Promise<string>(function (
|
||||
resolve: (value: webdriver.promise.Promise<string>) => void,
|
||||
reject: () => void) { });
|
||||
promise = new webdriver.promise.Promise<string>(function (
|
||||
resolve: (value: string) => void,
|
||||
reject: () => void) { }, controlFlow);
|
||||
promise = new webdriver.promise.Promise<string>((resolve: (value: string) => void, reject: () => void) => {});
|
||||
promise = new webdriver.promise.Promise<string>((resolve: (value: webdriver.promise.Promise<string>) => void, reject: () => void) => {});
|
||||
promise = new webdriver.promise.Promise<string>((resolve: (value: string) => void, reject: () => void) => {}, controlFlow);
|
||||
|
||||
promise.cancel('Abort');
|
||||
|
||||
var isPending: boolean = promise.isPending();
|
||||
|
||||
promise = promise.then();
|
||||
promise = promise.then(function (a: string) { return 'cde'; });
|
||||
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.then((a: string) => 'cde');
|
||||
promise = promise.then((a: string) => 'cde', (e: any) => {});
|
||||
promise = promise.then((a: string) => 'cde', (e: any) => 123);
|
||||
|
||||
promise = promise.thenCatch(function (error: any) { });
|
||||
promise = promise.thenCatch((error: any) => {});
|
||||
|
||||
promise.thenFinally(function () { });
|
||||
promise.thenFinally(() => {});
|
||||
}
|
||||
|
||||
function TestThenableClass() {
|
||||
@@ -985,13 +978,13 @@ function TestThenableClass() {
|
||||
|
||||
var isPending: boolean = thenable.isPending();
|
||||
|
||||
thenable = thenable.then(function (a: string) { return 'cde'; });
|
||||
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.then((a: string) => 'cde');
|
||||
thenable = thenable.then((a: string) => 'cde', (e: any) => {});
|
||||
thenable = thenable.then((a: string) => 'cde', (e: any) => 123);
|
||||
|
||||
thenable = thenable.thenCatch(function (error: any) { });
|
||||
thenable = thenable.thenCatch((error: any) => {});
|
||||
|
||||
thenable.thenFinally(function () { });
|
||||
thenable.thenFinally(() => {});
|
||||
}
|
||||
|
||||
function TestErrorCode() {
|
||||
@@ -1029,29 +1022,29 @@ async function TestAsyncAwaitable() {
|
||||
}
|
||||
|
||||
function TestTestingModule() {
|
||||
testing.before(function () {
|
||||
testing.before(() => {
|
||||
});
|
||||
|
||||
testing.beforeEach(function () {
|
||||
testing.beforeEach(() => {
|
||||
});
|
||||
|
||||
testing.describe('My test suite', function () {
|
||||
testing.it('My test', function () {
|
||||
testing.describe('My test suite', () => {
|
||||
testing.it('My test', () => {
|
||||
});
|
||||
|
||||
testing.iit('My exclusive test.', function () {
|
||||
testing.iit('My exclusive test.', () => {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
testing.xdescribe('My disabled suite', function () {
|
||||
testing.xit('My disabled test.', function () {
|
||||
testing.xdescribe('My disabled suite', () => {
|
||||
testing.xit('My disabled test.', () => {
|
||||
});
|
||||
});
|
||||
|
||||
testing.after(function () {
|
||||
testing.after(() => {
|
||||
});
|
||||
|
||||
testing.afterEach(function () {
|
||||
testing.afterEach(() => {
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+51
-55
@@ -1,63 +1,59 @@
|
||||
declare namespace testing {
|
||||
/**
|
||||
* Registers a new test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
function describe(name: string, fn: Function): void;
|
||||
/**
|
||||
* Registers a new test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
export function describe(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Defines a suppressed test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
function xdescribe(name: string, fn: Function): void;
|
||||
/**
|
||||
* Defines a suppressed test suite.
|
||||
* @param name The suite name.
|
||||
* @param fn The suite function, or {@code undefined} to define a pending test suite.
|
||||
*/
|
||||
export function xdescribe(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call after the current suite finishes.
|
||||
* @param fn
|
||||
*/
|
||||
function after(fn: Function): void;
|
||||
/**
|
||||
* Register a function to call after the current suite finishes.
|
||||
* @param fn
|
||||
*/
|
||||
export function after(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call after each test in a suite.
|
||||
* @param fn
|
||||
*/
|
||||
function afterEach(fn: Function): void;
|
||||
/**
|
||||
* Register a function to call after each test in a suite.
|
||||
* @param fn
|
||||
*/
|
||||
export function afterEach(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call before the current suite starts.
|
||||
* @param fn
|
||||
*/
|
||||
function before(fn: Function): void;
|
||||
/**
|
||||
* Register a function to call before the current suite starts.
|
||||
* @param fn
|
||||
*/
|
||||
export function before(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Register a function to call before each test in a suite.
|
||||
* @param fn
|
||||
*/
|
||||
function beforeEach(fn: Function): void;
|
||||
/**
|
||||
* Register a function to call before each test in a suite.
|
||||
* @param fn
|
||||
*/
|
||||
export function beforeEach(fn: Function): void;
|
||||
|
||||
/**
|
||||
* Add a test to the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
function it(name: string, fn: Function): void;
|
||||
/**
|
||||
* Add a test to the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
export function it(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* An alias for {@link #it()} that flags the test as the only one that should
|
||||
* be run within the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
function iit(name: string, fn: Function): void;
|
||||
/**
|
||||
* An alias for {@link #it()} that flags the test as the only one that should
|
||||
* be run within the current suite.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
export function iit(name: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Adds a test to the current suite while suppressing it so it is not run.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
function xit(name: string, fn: Function): void;
|
||||
}
|
||||
|
||||
export = testing;
|
||||
/**
|
||||
* Adds a test to the current suite while suppressing it so it is not run.
|
||||
* @param name The test name.
|
||||
* @param fn The test function, or {@code undefined} to define a pending test case.
|
||||
*/
|
||||
export function xit(name: string, fn: Function): void;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"callable-types": false,
|
||||
"forbidden-types": false,
|
||||
"interface-name": false,
|
||||
"no-empty-interface": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user