mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Generator for material-ui
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
node scripts/material-ui/generate.js
|
||||
```
|
||||
|
||||
### GitHub API Limitation
|
||||
|
||||
The error `GitHub response: 401 Unauthorized` is due to [Rate Limiting | GitHub API v3 \| GitHub Developer Guide](https://developer.github.com/v3/#rate-limiting). In order to avoid this, it is necessary to publish [Personal access token](https://github.com/settings/tokens) and specify it as an environment variable.
|
||||
|
||||
```sh
|
||||
GITHUB_ACCESS_TOKEN=XXXXX node scripts/material-ui/generate.js
|
||||
```
|
||||
@@ -0,0 +1,147 @@
|
||||
const {get} = require('https')
|
||||
const {readdir, readFile, writeFile} = require('fs')
|
||||
const {join, extname, basename, dirname, relative} = require('path')
|
||||
|
||||
const token = process.env.GITHUB_ACCESS_TOKEN || ''
|
||||
|
||||
const toMixedCase = (name) => {
|
||||
let dist = name[0].toUpperCase()
|
||||
for (let i = 1; i < name.length; i++) {
|
||||
const c = name[i]
|
||||
if (c !== '-') {
|
||||
dist += c
|
||||
continue
|
||||
}
|
||||
i++
|
||||
dist += name[i].toUpperCase()
|
||||
}
|
||||
return dist
|
||||
}
|
||||
|
||||
const github = (path) => new Promise((resolve, reject) => {
|
||||
get({
|
||||
headers: {'user-agent': 'DefinitelyTyped/material-ui/generate'},
|
||||
host: 'api.github.com',
|
||||
path,
|
||||
}, (res) => {
|
||||
if ((res.statusCode / 100 >> 0) != 2) {
|
||||
reject(`GitHub response: ${res.statusCode} ${res.statusMessage}`)
|
||||
return
|
||||
}
|
||||
let data = '';
|
||||
res
|
||||
.on('data', (chunk) => data += chunk)
|
||||
.on('end', () => resolve(JSON.parse(data)))
|
||||
}).on('error', reject)
|
||||
})
|
||||
|
||||
const categories = () => github(`/repos/callemall/material-ui/contents/src/svg-icons?ref=master&access_token=${token}`)
|
||||
|
||||
const contents = (path) => github(`/repos/callemall/material-ui/contents/${path}?ref=master&access_token=${token}`)
|
||||
|
||||
const collator = new Intl.Collator()
|
||||
|
||||
const resolvePath = (filename) => join(__dirname, '../../types/material-ui', filename)
|
||||
|
||||
const readText = (filename) => new Promise((resolve, reject) => {
|
||||
readFile(resolvePath(filename), 'utf8', (err, data) => {
|
||||
if (err != null) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
resolve(data)
|
||||
})
|
||||
})
|
||||
|
||||
const writeText = (filename, text) => new Promise((resolve, reject) => {
|
||||
writeFile(resolvePath(filename), text, 'utf8', (err) => {
|
||||
if (err != null) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
|
||||
const inject = (content) => {
|
||||
content.category = this.name
|
||||
return content
|
||||
}
|
||||
|
||||
const rMark = /(\/{2} \{{3})[\s\S]*?(\/{2} \}{3})/g
|
||||
|
||||
categories()
|
||||
.then((cats) => Promise.all(Array.prototype.map.call(cats, (cat) => contents(cat.path)
|
||||
.then((cons) => Array.prototype.map.call(cons, (con) => {
|
||||
con.category = cat.name
|
||||
return con
|
||||
}))
|
||||
)))
|
||||
.then((contentsList) => Array.prototype.concat.apply([], contentsList)
|
||||
.map((content) => {
|
||||
const {path} = content
|
||||
const name = basename(path, extname(path))
|
||||
content.id = join(relative('src', dirname(path)), name)
|
||||
content.className = toMixedCase(content.category) + toMixedCase(name)
|
||||
return content
|
||||
})
|
||||
.sort((a, b) => collator.compare(a.id, b.id))
|
||||
.reduce((prev, content) => {
|
||||
const {dts, test} = prev
|
||||
dts.individuals.push(`declare module 'material-ui/${content.id}' {
|
||||
export import ${content.className} = __MaterialUI.SvgIcon;
|
||||
export default ${content.className};
|
||||
}`)
|
||||
dts.summarizeds.push(` export import ${content.className} = __MaterialUI.SvgIcon; // require('material-ui/${content.id}');`)
|
||||
|
||||
test.individuals.push(`import _${content.className} from 'material-ui/${content.id}';`)
|
||||
test.summarizeds.push(` ${content.className},`)
|
||||
return prev
|
||||
}, {
|
||||
dts: {individuals: [], summarizeds: []},
|
||||
test: {individuals: [], summarizeds: []},
|
||||
})
|
||||
)
|
||||
.then(({dts, test}) => {
|
||||
return Promise.all([
|
||||
(() => {
|
||||
const {individuals, summarizeds} = dts
|
||||
const file = 'index.d.ts'
|
||||
let index = 0
|
||||
return readText(file)
|
||||
.then((script) => writeText(file, script.replace(rMark, (_, p1, p2) => {
|
||||
let text = ''
|
||||
switch (index) {
|
||||
case 0:
|
||||
text = individuals.join('\n\n')
|
||||
break
|
||||
case 1:
|
||||
text = summarizeds.join('\n')
|
||||
break
|
||||
}
|
||||
index++
|
||||
return p1 + '\n' + text + '\n' + p2
|
||||
})))
|
||||
})(),
|
||||
(() => {
|
||||
const {individuals, summarizeds} = test
|
||||
const file = join('material-ui-tests.tsx')
|
||||
let index = 0
|
||||
return readText(file)
|
||||
.then((script) => writeText(file, script.replace(rMark, (_, p1, p2) => {
|
||||
let text = ''
|
||||
switch (index) {
|
||||
case 0:
|
||||
text = individuals.join('\n')
|
||||
break
|
||||
case 1:
|
||||
text = summarizeds.join('\n')
|
||||
break
|
||||
}
|
||||
index++
|
||||
return p1 + '\n' + text + '\n' + p2
|
||||
})))
|
||||
})(),
|
||||
])
|
||||
})
|
||||
.catch((err) => console.error(err))
|
||||
@@ -1,7 +1,7 @@
|
||||
// source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
|
||||
|
||||
// Generates a string describing the drive type of a given Drive object.
|
||||
let showDriveType = (drive: Scripting.Drive) => {
|
||||
function showDriveType(drive: Scripting.Drive) {
|
||||
switch (drive.DriveType) {
|
||||
case Scripting.DriveTypeConst.Removable:
|
||||
return 'Removeable';
|
||||
@@ -16,15 +16,15 @@ let showDriveType = (drive: Scripting.Drive) => {
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Generates a string describing the attributes of a file or folder.
|
||||
let showFileAttributes = (file: Scripting.File) => {
|
||||
let attr = file.Attributes;
|
||||
function showFileAttributes(file: Scripting.File) {
|
||||
const attr = file.Attributes;
|
||||
if (attr === 0) {
|
||||
return 'Normal';
|
||||
}
|
||||
let attributeStrings: string[] = [];
|
||||
const attributeStrings: string[] = [];
|
||||
if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); }
|
||||
if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); }
|
||||
if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); }
|
||||
@@ -34,22 +34,22 @@ let showFileAttributes = (file: Scripting.File) => {
|
||||
if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); }
|
||||
if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); }
|
||||
return attributeStrings.join(',');
|
||||
};
|
||||
}
|
||||
|
||||
// source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
|
||||
let showFreeSpace = (drvPath: string) => {
|
||||
let fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
let d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
function showFreeSpace(drvPath: string) {
|
||||
const fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
const d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
let s = 'Drive ' + drvPath + ' - ';
|
||||
s += d.VolumeName + '<br>';
|
||||
s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes';
|
||||
return (s);
|
||||
};
|
||||
}
|
||||
|
||||
// source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
|
||||
let getALine = (filespec: string) => {
|
||||
let fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
let file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
function getALine(filespec: string) {
|
||||
const fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
|
||||
let s = '';
|
||||
while (!file.AtEndOfLine) {
|
||||
@@ -57,4 +57,4 @@ let getALine = (filespec: string) => {
|
||||
}
|
||||
file.Close();
|
||||
return (s);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ let img = commonDialog.ShowAcquireImage();
|
||||
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
|
||||
let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}';
|
||||
if (img.FormatID !== jpegFormatID) {
|
||||
let ip = new ActiveXObject('WIA.ImageProcess');
|
||||
const ip = new ActiveXObject('WIA.ImageProcess');
|
||||
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
|
||||
ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID;
|
||||
img = ip.Apply(img);
|
||||
@@ -24,8 +24,8 @@ if (img.FormatID !== jpegFormatID) {
|
||||
let dev = commonDialog.ShowSelectDevice();
|
||||
if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) {
|
||||
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
|
||||
let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}';
|
||||
let itm = dev.ExecuteCommand(commandID);
|
||||
const commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}';
|
||||
const itm = dev.ExecuteCommand(commandID);
|
||||
|
||||
// with this:
|
||||
// let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
|
||||
@@ -36,7 +36,7 @@ dev = commonDialog.ShowSelectDevice();
|
||||
let e = new Enumerator<WIA.Property>(dev.Properties); // no foreach over ActiveX collections
|
||||
e.moveFirst();
|
||||
while (!e.atEnd()) {
|
||||
let p = e.item();
|
||||
const p = e.item();
|
||||
let s = p.Name + ' (' + p.PropertyID + ') = ';
|
||||
if (p.IsVector) {
|
||||
s += '[vector of data]';
|
||||
@@ -60,7 +60,7 @@ while (!e.atEnd()) {
|
||||
} else {
|
||||
s += ' [valid values include: ';
|
||||
}
|
||||
let count = p.SubTypeValues.Count;
|
||||
const count = p.SubTypeValues.Count;
|
||||
for (let i = 1; i <= count; i++) {
|
||||
s += p.SubTypeValues.Item(i);
|
||||
if (i < count) {
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for alertify 0.3.11
|
||||
// Project: http://fabien-d.github.io/alertify.js/
|
||||
// Definitions by: John Jeffery <http://github.com/jjeffery>
|
||||
// Definitions by: John Jeffery <https://github.com/jjeffery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var alertify: alertify.IAlertifyStatic;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
const handler = (event: Alexa.RequestBody<Alexa.Request>, context: Alexa.Context, callback: () => void) => {
|
||||
let alexa = Alexa.handler(event, context);
|
||||
const alexa = Alexa.handler(event, context);
|
||||
alexa.resources = {};
|
||||
alexa.registerHandlers(handlers);
|
||||
alexa.execute();
|
||||
};
|
||||
|
||||
let handlers: Alexa.Handlers<Alexa.Request> = {
|
||||
const handlers: Alexa.Handlers<Alexa.Request> = {
|
||||
'LaunchRequest': function() {
|
||||
this.emit('SayHello');
|
||||
},
|
||||
|
||||
@@ -5,9 +5,9 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
expr = expr.subtract(3);
|
||||
expr = expr.add("x");
|
||||
expr.toString();
|
||||
let eq = new Equation(expr, 4);
|
||||
const eq = new Equation(expr, 4);
|
||||
eq.toString();
|
||||
let x = eq.solveFor("x");
|
||||
const x = eq.solveFor("x");
|
||||
x.toString();
|
||||
}
|
||||
{
|
||||
@@ -29,7 +29,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
x.toString();
|
||||
x = x.add("y");
|
||||
x.toString();
|
||||
let otherExp = new Expression("x").add(6);
|
||||
const otherExp = new Expression("x").add(6);
|
||||
x = x.add(otherExp);
|
||||
x.toString();
|
||||
|
||||
@@ -54,10 +54,10 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
exp = exp.add("y");
|
||||
exp = exp.add(3);
|
||||
exp.toString();
|
||||
let sum = exp.summation("x", 3, 6);
|
||||
const sum = exp.summation("x", 3, 6);
|
||||
sum.toString();
|
||||
exp = new Expression("x").add(2);
|
||||
let exp3 = exp.pow(3);
|
||||
const exp3 = exp.pow(3);
|
||||
"(" + exp.toString() + ")^3 = " + exp3.toString();
|
||||
|
||||
let expr = new Expression("x");
|
||||
@@ -66,14 +66,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
expr = expr.add("y");
|
||||
expr = expr.add(new Fraction(1, 3));
|
||||
expr.toString();
|
||||
let answer1 = expr.eval({ x: 2 });
|
||||
let answer2 = expr.eval({ x: 2, y: new Fraction(3, 4) });
|
||||
const answer1 = expr.eval({ x: 2 });
|
||||
const answer2 = expr.eval({ x: 2, y: new Fraction(3, 4) });
|
||||
answer1.toString();
|
||||
answer2.toString();
|
||||
expr = new Expression("x").add(2);
|
||||
expr.toString();
|
||||
let sub = new Expression("y").add(4);
|
||||
let answer = expr.eval({ x: sub });
|
||||
const sub = new Expression("y").add(4);
|
||||
const answer = expr.eval({ x: sub });
|
||||
answer.toString();
|
||||
exp = new Expression("x").add(2);
|
||||
exp.toString();
|
||||
@@ -91,23 +91,23 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
exp.toString();
|
||||
exp = exp.simplify();
|
||||
exp.toString();
|
||||
let z = new Expression("z");
|
||||
let eq1 = new Equation(z.subtract(4).divide(9), z.add(6));
|
||||
const z = new Expression("z");
|
||||
const eq1 = new Equation(z.subtract(4).divide(9), z.add(6));
|
||||
eq1.toString();
|
||||
let eq2 = new Equation(z.add(4).multiply(9), 6);
|
||||
const eq2 = new Equation(z.add(4).multiply(9), 6);
|
||||
eq2.toString();
|
||||
let eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4));
|
||||
const eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4));
|
||||
eq3.toString();
|
||||
}
|
||||
{
|
||||
let x1 = parse("1/5 * x + 2/15");
|
||||
let x2 = parse("1/7 * x + 4");
|
||||
const x1 = parse("1/5 * x + 2/15");
|
||||
const x2 = parse("1/7 * x + 4");
|
||||
let eq = new Equation(x1 as Expression, x2 as Expression);
|
||||
eq.toString();
|
||||
let answer = eq.solveFor("x");
|
||||
const answer = eq.solveFor("x");
|
||||
"x = " + answer.toString();
|
||||
let expr1 = parse("1/4 * x + 5/4");
|
||||
let expr2 = parse("3 * y - 12/5");
|
||||
const expr1 = parse("1/4 * x + 5/4");
|
||||
const expr2 = parse("3 * y - 12/5");
|
||||
eq = new Equation(expr1 as Expression, expr2 as Expression);
|
||||
eq.toString();
|
||||
let xAnswer = eq.solveFor("x");
|
||||
@@ -116,14 +116,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
"y = " + yAnswer.toString();
|
||||
let n1 = parse("x + 5") as Expression;
|
||||
let n2 = parse("x - 3/4") as Expression;
|
||||
let quad = new Equation(n1.multiply(n2), 0);
|
||||
const quad = new Equation(n1.multiply(n2), 0);
|
||||
quad.toString();
|
||||
let answers = quad.solveFor("x");
|
||||
"x = " + answers.toString();
|
||||
n1 = parse("x + 2") as Expression;
|
||||
n2 = parse("x + 3") as Expression;
|
||||
let n3 = parse("x + 4") as Expression;
|
||||
let cubic = new Equation(n1.multiply(n2).multiply(n3), 0);
|
||||
const n3 = parse("x + 4") as Expression;
|
||||
const cubic = new Equation(n1.multiply(n2).multiply(n3), 0);
|
||||
cubic.toString();
|
||||
answers = cubic.solveFor("x");
|
||||
"x = " + answers.toString();
|
||||
@@ -143,20 +143,20 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
exp.toString();
|
||||
}
|
||||
{
|
||||
let eq = parse("x^2 + 4 * x + 4 = 0") as Equation;
|
||||
const eq = parse("x^2 + 4 * x + 4 = 0") as Equation;
|
||||
eq.toString();
|
||||
let ans = eq.solveFor("x");
|
||||
const ans = eq.solveFor("x");
|
||||
"x = " + ans.toString();
|
||||
let a = new Expression("x").pow(2);
|
||||
let b = new Expression("x").multiply(new Fraction(5, 4));
|
||||
let c = new Fraction(-21, 4);
|
||||
let expr = a.add(b).add(c);
|
||||
let quad = new Equation(expr, 0);
|
||||
const a = new Expression("x").pow(2);
|
||||
const b = new Expression("x").multiply(new Fraction(5, 4));
|
||||
const c = new Fraction(-21, 4);
|
||||
const expr = a.add(b).add(c);
|
||||
const quad = new Equation(expr, 0);
|
||||
toTex(quad);
|
||||
let answers = quad.solveFor("x");
|
||||
const answers = quad.solveFor("x");
|
||||
toTex(answers);
|
||||
let lambda = new Expression("lambda").add(3).divide(4);
|
||||
let Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda);
|
||||
const lambda = new Expression("lambda").add(3).divide(4);
|
||||
const Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda);
|
||||
toTex(lambda);
|
||||
toTex(Phi);
|
||||
}
|
||||
|
||||
@@ -168,19 +168,24 @@ amplify.request("twitter-mentions", { user: "amplifyjs" });
|
||||
// Example:
|
||||
|
||||
const appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => {
|
||||
if (data.status === "success") {
|
||||
success(data.data);
|
||||
} else if (data.status === "fail" || data.status === "error") {
|
||||
error(data.message, data.status);
|
||||
} else {
|
||||
error(data.message, "fatal");
|
||||
switch (data.status) {
|
||||
case "success":
|
||||
success(data.data);
|
||||
break;
|
||||
case "fail":
|
||||
case "error":
|
||||
error(data.message, data.status);
|
||||
break;
|
||||
default:
|
||||
error(data.message, "fatal");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// a new decoder can be added to the amplifyDecoders interface
|
||||
declare module "amplify" {
|
||||
interface Decoders {
|
||||
appEnvelope: amplify.Decoder;
|
||||
appEnvelope: Decoder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,12 +218,17 @@ amplify.request.define("decoderSingleExample", "ajax", {
|
||||
url: "/myAjaxUrl",
|
||||
type: "POST",
|
||||
decoder(data, status, xhr, success, error) {
|
||||
if (data.status === "success") {
|
||||
success(data.data);
|
||||
} else if (data.status === "fail" || data.status === "error") {
|
||||
error(data.message, data.status);
|
||||
} else {
|
||||
error(data.message, "fatal");
|
||||
switch (data.status) {
|
||||
case "success":
|
||||
success(data.data);
|
||||
break;
|
||||
case "fail":
|
||||
case "error":
|
||||
error(data.message, data.status);
|
||||
break;
|
||||
default:
|
||||
error(data.message, "fatal");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-empty-interface": false
|
||||
// All are TODOs
|
||||
"no-empty-interface": false,
|
||||
"prefer-const": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,5 +37,5 @@ app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIServi
|
||||
blockUI.reset();
|
||||
blockUI.message("Hello Types");
|
||||
blockUI.done();
|
||||
let b: boolean = blockUI.isBlocking();
|
||||
const b: boolean = blockUI.isBlocking();
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -70,7 +70,7 @@ declare module 'angular' {
|
||||
* @param {angular.IRequestConfig} config - the Angular request config object.
|
||||
*
|
||||
*/
|
||||
requestFilter?(config: angular.IRequestConfig): (string | boolean);
|
||||
requestFilter?(config: IRequestConfig): (string | boolean);
|
||||
|
||||
/**
|
||||
* When the module is started it will inject the main block element
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngCookies module) 1.4
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Anthony Ciccarello <http://github.com/aciccarello>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Anthony Ciccarello <https://github.com/aciccarello>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+6
-6
@@ -89,13 +89,13 @@ declare module "angular" {
|
||||
handles?: string[];
|
||||
|
||||
// optional callback fired when drag is started
|
||||
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
start?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is resized
|
||||
resize?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
resize?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is finished dragging
|
||||
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
stop?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
};
|
||||
|
||||
// options to pass to draggable handler
|
||||
@@ -113,13 +113,13 @@ declare module "angular" {
|
||||
handle?: string;
|
||||
|
||||
// optional callback fired when drag is started
|
||||
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
start?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is moved,
|
||||
drag?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
drag?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is finished dragging
|
||||
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
stop?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ myApp.config((
|
||||
return c * t * t + b;
|
||||
},
|
||||
easeFnIndeterminate(t, b, c, d) {
|
||||
return c * Math.pow(2, 10 * (t / d - 1)) + b;
|
||||
return c * Math.pow(2, (t / d - 1) * 10) + b;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+28
-28
@@ -18,7 +18,7 @@ declare module 'angular' {
|
||||
interface IBottomSheetOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
scope?: IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
locals?: { [index: string]: any };
|
||||
@@ -28,12 +28,12 @@ declare module 'angular' {
|
||||
escapeToClose?: boolean;
|
||||
resolve?: ResolveObject;
|
||||
controllerAs?: string;
|
||||
parent?: ((scope: angular.IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node
|
||||
parent?: ((scope: IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
}
|
||||
|
||||
interface IBottomSheetService {
|
||||
show(options: IBottomSheetOptions): angular.IPromise<any>;
|
||||
show(options: IBottomSheetOptions): IPromise<any>;
|
||||
hide(response?: any): void;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ declare module 'angular' {
|
||||
templateUrl(templateUrl?: string): T;
|
||||
template(template?: string): T;
|
||||
targetEvent(targetEvent?: MouseEvent): T;
|
||||
scope(scope?: angular.IScope): T; // default: new child scope
|
||||
scope(scope?: IScope): T; // default: new child scope
|
||||
preserveScope(preserveScope?: boolean): T; // default: false
|
||||
disableParentScroll(disableParentScroll?: boolean): T; // default: true
|
||||
hasBackdrop(hasBackdrop?: boolean): T; // default: true
|
||||
@@ -98,7 +98,7 @@ declare module 'angular' {
|
||||
targetEvent?: MouseEvent;
|
||||
openFrom?: any;
|
||||
closeTo?: any;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
scope?: IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
disableParentScroll?: boolean; // default: true
|
||||
hasBackdrop?: boolean; // default: true
|
||||
@@ -111,24 +111,24 @@ declare module 'angular' {
|
||||
resolve?: ResolveObject;
|
||||
controllerAs?: string;
|
||||
parent?: string | Element | JQuery; // default: root node
|
||||
onShowing?(scope: angular.IScope, element: JQuery): void;
|
||||
onComplete?(scope: angular.IScope, element: JQuery): void;
|
||||
onRemoving?(element: JQuery, removePromise: angular.IPromise<any>): void;
|
||||
onShowing?(scope: IScope, element: JQuery): void;
|
||||
onComplete?(scope: IScope, element: JQuery): void;
|
||||
onRemoving?(element: JQuery, removePromise: IPromise<any>): void;
|
||||
skipHide?: boolean;
|
||||
multiple?: boolean;
|
||||
fullscreen?: boolean; // default: false
|
||||
}
|
||||
|
||||
interface IDialogService {
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): angular.IPromise<any>;
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): IPromise<any>;
|
||||
confirm(): IConfirmDialog;
|
||||
alert(): IAlertDialog;
|
||||
prompt(): IPromptDialog;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
hide(response?: any): IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
type IIcon = (id: string) => angular.IPromise<Element>; // id is a unique ID or URL
|
||||
type IIcon = (id: string) => IPromise<Element>; // id is a unique ID or URL
|
||||
|
||||
interface IIconProvider {
|
||||
icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24
|
||||
@@ -141,16 +141,16 @@ declare module 'angular' {
|
||||
type IMedia = (media: string) => boolean;
|
||||
|
||||
interface ISidenavObject {
|
||||
toggle(): angular.IPromise<void>;
|
||||
open(): angular.IPromise<void>;
|
||||
close(): angular.IPromise<void>;
|
||||
toggle(): IPromise<void>;
|
||||
open(): IPromise<void>;
|
||||
close(): IPromise<void>;
|
||||
isOpen(): boolean;
|
||||
isLockedOpen(): boolean;
|
||||
onClose(onClose: () => void): void;
|
||||
}
|
||||
|
||||
interface ISidenavService {
|
||||
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
|
||||
(component: string, enableWait: boolean): IPromise<ISidenavObject>;
|
||||
(component: string): ISidenavObject;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ declare module 'angular' {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
autoWrap?: boolean;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
scope?: IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
hideDelay?: number | false; // default (ms): 3000
|
||||
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
|
||||
@@ -189,8 +189,8 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IToastService {
|
||||
show(optionsOrPreset: IToastOptions | IToastPreset<any>): angular.IPromise<any>;
|
||||
showSimple(content: string): angular.IPromise<any>;
|
||||
show(optionsOrPreset: IToastOptions | IToastPreset<any>): IPromise<any>;
|
||||
showSimple(content: string): IPromise<any>;
|
||||
simple(): ISimpleToastPreset;
|
||||
build(): IToastPreset<any>;
|
||||
updateContent(newContent: string): void;
|
||||
@@ -306,7 +306,7 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IMenuService {
|
||||
hide(response?: any, options?: any): angular.IPromise<any>;
|
||||
hide(response?: any, options?: any): IPromise<any>;
|
||||
}
|
||||
|
||||
interface IColorPalette {
|
||||
@@ -366,19 +366,19 @@ declare module 'angular' {
|
||||
isAttached: boolean;
|
||||
panelContainer: JQuery;
|
||||
panelEl: JQuery;
|
||||
open(): angular.IPromise<any>;
|
||||
close(): angular.IPromise<any>;
|
||||
attach(): angular.IPromise<any>;
|
||||
detach(): angular.IPromise<any>;
|
||||
show(): angular.IPromise<any>;
|
||||
hide(): angular.IPromise<any>;
|
||||
open(): IPromise<any>;
|
||||
close(): IPromise<any>;
|
||||
attach(): IPromise<any>;
|
||||
detach(): IPromise<any>;
|
||||
show(): IPromise<any>;
|
||||
hide(): IPromise<any>;
|
||||
destroy(): void;
|
||||
addClass(newClass: string): void;
|
||||
removeClass(oldClass: string): void;
|
||||
toggleClass(toggleClass: string): void;
|
||||
updatePosition(position: IPanelPosition): void;
|
||||
registerInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
|
||||
removeInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
|
||||
registerInterceptor(type: string, callback: () => IPromise<any>): IPanelRef;
|
||||
removeInterceptor(type: string, callback: () => IPromise<any>): IPanelRef;
|
||||
removeAllInterceptors(type?: string): IPanelRef;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ declare module 'angular' {
|
||||
|
||||
interface IPanelService {
|
||||
create(opt_config: IPanelConfig): IPanelRef;
|
||||
open(opt_config: IPanelConfig): angular.IPromise<IPanelRef>;
|
||||
open(opt_config: IPanelConfig): IPromise<IPanelRef>;
|
||||
newPanelPosition(): IPanelPosition;
|
||||
newPanelAnimation(): IPanelAnimation;
|
||||
xPosition: {
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Tony Curtis <https://github.com/daltin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -27,9 +27,9 @@ declare module 'angular' {
|
||||
|
||||
interface OAuth {
|
||||
isAuthenticated(): boolean;
|
||||
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
|
||||
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
|
||||
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
|
||||
getAccessToken(data: Data, options?: any): IPromise<string>;
|
||||
getRefreshToken(data?: Data, options?: any): IPromise<string>;
|
||||
revokeToken(data?: Data, options?: any): IPromise<string>;
|
||||
}
|
||||
|
||||
interface OAuthTokenConfig {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
namespace pdfjsViewer {
|
||||
interface ConfigProvider extends angular.IServiceProvider {
|
||||
interface ConfigProvider extends IServiceProvider {
|
||||
setWorkerSrc(src: string): void;
|
||||
setCmapDir(dir: string): void;
|
||||
setImageDir(dir: string): void;
|
||||
|
||||
@@ -32,7 +32,7 @@ interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResou
|
||||
function MainController($resource: ng.resource.IResourceService): void {
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
let publishDescriptor: ng.resource.IActionDescriptor = {
|
||||
const publishDescriptor: ng.resource.IActionDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
@@ -40,7 +40,7 @@ function MainController($resource: ng.resource.IResourceService): void {
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
let articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
const articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : {
|
||||
method: 'POST'
|
||||
@@ -51,7 +51,7 @@ function MainController($resource: ng.resource.IResourceService): void {
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
let article: IArticleResource = articleResource.get({id: 1}, function success(): void {
|
||||
const article: IArticleResource = articleResource.get({id: 1}, function success(): void {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
|
||||
Vendored
+31
-31
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngResource module) 1.5
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Michael Jess <http://github.com/miffels>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Michael Jess <https://github.com/miffels>
|
||||
// Definitions: https://github.com/daptiv/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -74,10 +74,10 @@ declare module 'angular' {
|
||||
params?: any;
|
||||
url?: string;
|
||||
isArray?: boolean;
|
||||
transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[];
|
||||
transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[];
|
||||
transformRequest?: IHttpRequestTransformer | IHttpRequestTransformer[];
|
||||
transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[];
|
||||
headers?: any;
|
||||
cache?: boolean | angular.ICacheObject;
|
||||
cache?: boolean | ICacheObject;
|
||||
/**
|
||||
* Note: In contrast to $http.config, promises are not supported in $resource, because the same value
|
||||
* would be used for multiple requests. If you are looking for a way to cancel requests, you should
|
||||
@@ -118,15 +118,15 @@ declare module 'angular' {
|
||||
// it's gonna be considered data if the action method is POST, PUT or
|
||||
// PATCH (in other words, methods with body). Otherwise, it's going
|
||||
// to be considered as parameters to the request.
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
//
|
||||
// Only those methods with an HTTP body do have 'data' as first parameter:
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L463
|
||||
// More specifically, those methods are POST, PUT and PATCH:
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L432
|
||||
//
|
||||
// Also, static calls always return the IResource (or IResourceArray) retrieved
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
interface IResourceClass<T> {
|
||||
new(dataOrParams?: any): T & IResource<T>;
|
||||
get: IResourceMethod<T>;
|
||||
@@ -141,32 +141,32 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
// Instance calls always return the the promise of the request which retrieved the object
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
|
||||
interface IResource<T> {
|
||||
$get(): angular.IPromise<T>;
|
||||
$get(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$get(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$get(): IPromise<T>;
|
||||
$get(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$get(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$query(): angular.IPromise<IResourceArray<T>>;
|
||||
$query(params?: Object, success?: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
|
||||
$query(success: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
|
||||
$query(): IPromise<IResourceArray<T>>;
|
||||
$query(params?: Object, success?: Function, error?: Function): IPromise<IResourceArray<T>>;
|
||||
$query(success: Function, error?: Function): IPromise<IResourceArray<T>>;
|
||||
|
||||
$save(): angular.IPromise<T>;
|
||||
$save(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$save(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$save(): IPromise<T>;
|
||||
$save(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$save(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$remove(): angular.IPromise<T>;
|
||||
$remove(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$remove(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$remove(): IPromise<T>;
|
||||
$remove(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$remove(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$delete(): angular.IPromise<T>;
|
||||
$delete(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$delete(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$delete(): IPromise<T>;
|
||||
$delete(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$delete(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** The promise of the original server interaction that created this instance. */
|
||||
$promise: angular.IPromise<T>;
|
||||
$promise: IPromise<T>;
|
||||
$resolved: boolean;
|
||||
toJSON(): T;
|
||||
}
|
||||
@@ -178,18 +178,18 @@ declare module 'angular' {
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<IResourceArray<T>>;
|
||||
$promise: IPromise<IResourceArray<T>>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
|
||||
/** when creating a resource factory via IModule.factory */
|
||||
interface IResourceServiceFactoryFunction<T> {
|
||||
($resource: angular.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
|
||||
($resource: resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: resource.IResourceService): U;
|
||||
}
|
||||
|
||||
// IResourceServiceProvider used to configure global settings
|
||||
interface IResourceServiceProvider extends angular.IServiceProvider {
|
||||
interface IResourceServiceProvider extends IServiceProvider {
|
||||
defaults: IResourceOptions;
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ declare module 'angular' {
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
interface IModule {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
factory(name: string, resourceServiceFactoryFunction: resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
|
||||
namespace auto {
|
||||
@@ -210,7 +210,7 @@ declare module 'angular' {
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<T[]>;
|
||||
$promise: IPromise<T[]>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngSanitize module) 1.3
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/* tslint:disable:dt-header variable-name */
|
||||
// Type definitions for Angular JS 1.5 component router
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: David Reher <http://github.com/davidreher>
|
||||
// Definitions by: David Reher <https://github.com/davidreher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace angular {
|
||||
|
||||
@@ -339,12 +339,12 @@ namespace TestQ {
|
||||
result = $q.all<{a: number; b: string; }>({a: promiseAny, b: promiseAny});
|
||||
}
|
||||
{
|
||||
let result = $q.all({ num: $q.when(2), str: $q.when('test') });
|
||||
const result = $q.all({ num: $q.when(2), str: $q.when('test') });
|
||||
// TS should infer that num is a number and str is a string
|
||||
result.then(r => (r.num * 2) + r.str.indexOf('s'));
|
||||
}
|
||||
{
|
||||
let result = $q.all({ num: $q.when(2), str: 'test' });
|
||||
const result = $q.all({ num: $q.when(2), str: 'test' });
|
||||
// TS should infer that num is a number and str is a string
|
||||
result.then(r => (r.num * 2) + r.str.indexOf('s'));
|
||||
}
|
||||
@@ -378,7 +378,7 @@ namespace TestQ {
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $q.resolve<TResult>(tResult);
|
||||
result = $q.resolve<TResult>(promiseTResult);
|
||||
let result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
|
||||
const result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
|
||||
}
|
||||
|
||||
// $q.when
|
||||
@@ -388,7 +388,6 @@ namespace TestQ {
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
let other: angular.IPromise<TOther>;
|
||||
let resultOther: angular.IPromise<TResult | TOther>;
|
||||
|
||||
result = $q.when<TResult>(tResult);
|
||||
@@ -450,8 +449,8 @@ namespace TestDeferred {
|
||||
// deferred.resolve
|
||||
{
|
||||
let result: void;
|
||||
result = deferred.resolve() as void;
|
||||
result = deferred.resolve(tResult) as void;
|
||||
result = deferred.resolve();
|
||||
result = deferred.resolve(tResult);
|
||||
}
|
||||
|
||||
// deferred.reject
|
||||
@@ -488,7 +487,7 @@ namespace TestInjector {
|
||||
class Foobar {
|
||||
constructor($q) {}
|
||||
}
|
||||
let result: Foobar = $injector.instantiate(Foobar);
|
||||
const result: Foobar = $injector.instantiate(Foobar);
|
||||
}
|
||||
|
||||
// $injector.invoke
|
||||
@@ -496,14 +495,14 @@ namespace TestInjector {
|
||||
function foobar(v: boolean): number {
|
||||
return 7;
|
||||
}
|
||||
let result = $injector.invoke(foobar);
|
||||
const result = $injector.invoke(foobar);
|
||||
if (!(typeof result === 'number')) {
|
||||
// This fails to compile if 'result' is not exactly a number.
|
||||
let expectNever: never = result;
|
||||
const expectNever: never = result;
|
||||
}
|
||||
|
||||
let anyFunction: Function = foobar;
|
||||
let anyResult: string = $injector.invoke(anyFunction);
|
||||
const anyFunction: Function = foobar;
|
||||
const anyResult: string = $injector.invoke(anyFunction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1160,11 +1159,7 @@ function NgModelControllerTyping() {
|
||||
ngModel.$asyncValidators['uniqueUsername'] = (modelValue, viewValue) => {
|
||||
const value = modelValue || viewValue;
|
||||
return $http.get('/api/users/' + value).
|
||||
then(function resolved() {
|
||||
return $q.reject('exists');
|
||||
}, function rejected() {
|
||||
return true;
|
||||
});
|
||||
then(() => $q.reject('exists'), () => true);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Type definitions for Angular JS 1.6
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Georgii Dolzhykov <http://github.com/thorn0>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>
|
||||
// Georgii Dolzhykov <https://github.com/thorn0>
|
||||
// Caleb St-Denis <https://github.com/calebstdenis>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AngularFire 0.8.2
|
||||
// Project: http://angularfire.com
|
||||
// Definitions by: Dénes Harmath <http://github.com/thSoft>
|
||||
// Definitions by: Dénes Harmath <https://github.com/thSoft>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import { Annyang, CommandOption } from 'annyang';
|
||||
|
||||
declare let annyang: Annyang;
|
||||
declare let console: any;
|
||||
|
||||
// Tests based on API documentation at https://github.com/TalAter/annyang/blob/master/docs/README.md
|
||||
|
||||
function testStartListening() {
|
||||
annyang.start({ autoRestart: false }); // $ExpectType void
|
||||
annyang.start({ autoRestart: false, continuous: false }); // $ExpectType void
|
||||
}
|
||||
|
||||
function testAddComments() {
|
||||
let helloFunction = (): string => {
|
||||
return 'hello';
|
||||
};
|
||||
|
||||
let commands: CommandOption = {'hello :name': helloFunction, howdy: helloFunction};
|
||||
let commands2: CommandOption = {hi: helloFunction};
|
||||
|
||||
annyang.addCommands(commands); // $ExpectType void
|
||||
annyang.addCommands(commands2); // $ExpectType void
|
||||
annyang.removeCommands(); // $ExpectType void
|
||||
annyang.addCommands(commands); // $ExpectType void
|
||||
annyang.removeCommands('hello'); // $ExpectType void
|
||||
annyang.removeCommands(['howdy', 'hi']); // $ExpectType void
|
||||
}
|
||||
|
||||
let notConnected = () => { console.error('network connection error'); };
|
||||
|
||||
function testAddCallback() {
|
||||
annyang.addCallback('error', () => console.error('There was an error!') ); // $ExpectType void
|
||||
|
||||
// $ExpectType void
|
||||
annyang.addCallback('resultMatch', (userSaid, commandText, phrases) => {
|
||||
console.log(userSaid);
|
||||
console.log(commandText);
|
||||
console.log(phrases);
|
||||
});
|
||||
|
||||
annyang.addCallback('errorNetwork', notConnected, annyang); // $ExpectType void
|
||||
}
|
||||
|
||||
function testRemoveCallback() {
|
||||
let start = () => { console.log('start'); };
|
||||
let end = () => { console.log('end'); };
|
||||
|
||||
annyang.addCallback('start', start); // $ExpectType void
|
||||
annyang.addCallback('end', end); // $ExpectType void
|
||||
|
||||
annyang.removeCallback(); // $ExpectType void
|
||||
|
||||
annyang.removeCallback('end'); // $ExpectType void
|
||||
|
||||
annyang.removeCallback('start', start); // $ExpectType void
|
||||
|
||||
annyang.removeCallback(undefined, start); // $ExpectType void
|
||||
}
|
||||
|
||||
function testTrigger() {
|
||||
annyang.trigger('Time for some thrilling heroics');
|
||||
|
||||
// $ExpectType void
|
||||
annyang.trigger(
|
||||
['Time for some thrilling heroics', 'Time for some thrilling aerobics']
|
||||
);
|
||||
}
|
||||
|
||||
function testIsListening() {
|
||||
annyang.isListening(); // $ExpectType boolean
|
||||
}
|
||||
Vendored
+230
@@ -0,0 +1,230 @@
|
||||
// Type definitions for annyang 2.6
|
||||
// Project: https://www.talater.com/annyang/
|
||||
// Definitions by: Hisham Al-Shurafa <https://github.com/hisham>
|
||||
// Lukas Klinzing <https://github.com/theluk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Options for function `start`
|
||||
*
|
||||
* @export
|
||||
* @interface StartOptions
|
||||
*/
|
||||
export interface StartOptions {
|
||||
/**
|
||||
* Should annyang restart itself if it is closed indirectly, because of silence or window conflicts?
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
autoRestart?: boolean;
|
||||
/**
|
||||
* Allow forcing continuous mode on or off. Annyang is pretty smart about this, so only set this if you know what you're doing.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
continuous?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A command option that supports custom regular expressions
|
||||
*
|
||||
* @export
|
||||
* @interface CommandOptionRegex
|
||||
*/
|
||||
export interface CommandOptionRegex {
|
||||
/**
|
||||
* @type {RegExp}
|
||||
*/
|
||||
regexp: RegExp;
|
||||
/**
|
||||
* @type {() => any}
|
||||
*/
|
||||
callback(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commands that annyang should listen to
|
||||
*
|
||||
* #### Examples:
|
||||
* ````javascript
|
||||
* {'hello :name': helloFunction, 'howdy': helloFunction};
|
||||
* {'hi': helloFunction};
|
||||
* ````
|
||||
* @export
|
||||
* @interface CommandOption
|
||||
*/
|
||||
export interface CommandOption {
|
||||
[command: string]: CommandOptionRegex | (() => void);
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported Events that will be triggered to listeners, you attach using `annyang.addCallback()`
|
||||
*
|
||||
* `start` - Fired as soon as the browser's Speech Recognition engine starts listening
|
||||
* `error` - Fired when the browser's Speech Recogntion engine returns an error, this generic error callback will be followed by more accurate error callbacks (both will fire if both are defined)
|
||||
* `errorNetwork` - Fired when Speech Recognition fails because of a network error
|
||||
* `errorPermissionBlocked` - Fired when the browser blocks the permission request to use Speech Recognition.
|
||||
* `errorPermissionDenied` - Fired when the user blocks the permission request to use Speech Recognition.
|
||||
* `end` - Fired when the browser's Speech Recognition engine stops
|
||||
* `result` - Fired as soon as some speech was identified. This generic callback will be followed by either the `resultMatch` or `resultNoMatch` callbacks.
|
||||
* Callback functions registered to this event will include an array of possible phrases the user said as the first argument
|
||||
* `resultMatch` - Fired when annyang was able to match between what the user said and a registered command
|
||||
* Callback functions registered to this event will include three arguments in the following order:
|
||||
* * The phrase the user said that matched a command
|
||||
* * The command that was matched
|
||||
* * An array of possible alternative phrases the user might've said
|
||||
* `resultNoMatch` - Fired when what the user said didn't match any of the registered commands.
|
||||
* Callback functions registered to this event will include an array of possible phrases the user might've said as the first argument
|
||||
*/
|
||||
export type Events =
|
||||
'start' |
|
||||
'soundstart' |
|
||||
'error' |
|
||||
'end' |
|
||||
'result' |
|
||||
'resultMatch' |
|
||||
'resultNoMatch' |
|
||||
'errorNetwork' |
|
||||
'errorPermissionBlocked' |
|
||||
'errorPermissionDenied';
|
||||
|
||||
export interface Annyang {
|
||||
/**
|
||||
* Start listening.
|
||||
* It's a good idea to call this after adding some commands first, but not mandatory.
|
||||
*
|
||||
* @param {StartOptions} options
|
||||
*/
|
||||
start(options?: StartOptions): void;
|
||||
|
||||
/**
|
||||
* Stop listening, and turn off mic.
|
||||
*
|
||||
*/
|
||||
abort(): void;
|
||||
|
||||
/**
|
||||
* Pause listening. annyang will stop responding to commands (until the resume or start methods are called), without turning off the browser's SpeechRecognition engine or the mic.
|
||||
*
|
||||
*/
|
||||
pause(): void;
|
||||
|
||||
/**
|
||||
* Resumes listening and restores command callback execution when a result matches.
|
||||
* If SpeechRecognition was aborted (stopped), start it.
|
||||
*
|
||||
*/
|
||||
resume(): void;
|
||||
|
||||
/**
|
||||
* Turn on output of debug messages to the console. Ugly, but super-handy!
|
||||
*
|
||||
* @export
|
||||
* @param {boolean} [newState=true] Turn on/off debug messages
|
||||
*/
|
||||
debug(newState?: boolean): void;
|
||||
|
||||
/**
|
||||
* Set the language the user will speak in. If this method is not called, defaults to 'en-US'.
|
||||
*
|
||||
* @param {string} lang
|
||||
* @see [Languages](https://github.com/TalAter/annyang/blob/master/docs/FAQ.md#what-languages-are-supported)
|
||||
*/
|
||||
setLanguage(lang: string): void;
|
||||
|
||||
/**
|
||||
* Add commands that annyang will respond to. Similar in syntax to init(), but doesn't remove existing commands.
|
||||
*
|
||||
* #### Examples:
|
||||
* ````javascript
|
||||
* var commands = {'hello :name': helloFunction, 'howdy': helloFunction};
|
||||
* var commands2 = {'hi': helloFunction};
|
||||
*
|
||||
* annyang.addCommands(commands);
|
||||
* annyang.addCommands(commands2);
|
||||
* // annyang will now listen to all three commands
|
||||
* ````
|
||||
*
|
||||
* @param {CommandOption} commands
|
||||
*/
|
||||
addCommands(commands: CommandOption): void;
|
||||
|
||||
/**
|
||||
* Removes all existing commands or a specific command
|
||||
* #### Examples:
|
||||
* ````javascript
|
||||
* var commands : annyang.CommandOption = {'hello': helloFunction, 'howdy': helloFunction, 'hi': helloFunction};
|
||||
*
|
||||
* // Don't respond to hello
|
||||
* annyang.removeCommands('hello');
|
||||
*
|
||||
* // Remove all existing commands
|
||||
* annyang.removeCommands();
|
||||
* ````
|
||||
* @param {string} command
|
||||
*/
|
||||
removeCommands(command?: string): void;
|
||||
|
||||
/**
|
||||
* Removes a list of commands
|
||||
* #### Examples:
|
||||
* ````javascript
|
||||
* var commands : annyang.CommandOption = {'hello': helloFunction, 'howdy': helloFunction, 'hi': helloFunction};
|
||||
* // Add some commands
|
||||
* annyang.addCommands(commands);
|
||||
* // Don't respond to howdy or hi
|
||||
* annyang.removeCommands(['howdy', 'hi']);
|
||||
* ````
|
||||
*
|
||||
* @param {string[]} command
|
||||
*/
|
||||
removeCommands(command: string[]): void;
|
||||
|
||||
/**
|
||||
* @param {Events} event
|
||||
* @param {(userSaid : string, commandText : string, results : string[]) => void} callback
|
||||
* @param {*} [context]
|
||||
*/
|
||||
addCallback(event: Events, callback: (userSaid?: string, commandText?: string, results?: string[]) => void, context?: any): void;
|
||||
|
||||
/**
|
||||
* @param {Events} [event]
|
||||
* @param {Function} [callback]
|
||||
*/
|
||||
removeCallback(event?: Events, callback?: (userSaid: string, commandText: string, results: string[]) => void): void;
|
||||
|
||||
/**
|
||||
* Returns true if speech recognition is currently on.
|
||||
* Returns false if speech recognition is off or annyang is paused.
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isListening(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the instance of the browser's SpeechRecognition object used by annyang.
|
||||
* Useful in case you want direct access to the browser's Speech Recognition engine.
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
getSpeechRecognizer(): any;
|
||||
|
||||
/**
|
||||
* Simulate speech being recognized. This will trigger the same events and behavior as when the Speech Recognition
|
||||
* detects speech.
|
||||
*
|
||||
* Can accept either a string containing a single sentence, or an array containing multiple sentences to be checked
|
||||
* in order until one of them matches a command (similar to the way Speech Recognition Alternatives are parsed)
|
||||
*
|
||||
* #### Examples:
|
||||
* ````javascript
|
||||
* annyang.trigger('Time for some thrilling heroics');
|
||||
* annyang.trigger(
|
||||
* ['Time for some thrilling heroics', 'Time for some thrilling aerobics']
|
||||
* );
|
||||
* ````
|
||||
*
|
||||
* @param {string} command
|
||||
*/
|
||||
trigger(command: string | string[]): void;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"annyang-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -6,7 +6,7 @@ declare function it(desc: string, fn: () => void): void;
|
||||
|
||||
describe("ApplePaySession", () => {
|
||||
it("the constants are defined", () => {
|
||||
let status = 0;
|
||||
const status = 0;
|
||||
switch (status) {
|
||||
case ApplePaySession.STATUS_FAILURE:
|
||||
case ApplePaySession.STATUS_INVALID_BILLING_POSTAL_ADDRESS:
|
||||
@@ -43,8 +43,8 @@ describe("ApplePaySession", () => {
|
||||
it("can call static methods", () => {
|
||||
const merchantIdentifier = "MyMerchantId";
|
||||
|
||||
let canMakePayments: boolean = ApplePaySession.canMakePayments();
|
||||
let supported: boolean = ApplePaySession.supportsVersion(2);
|
||||
const canMakePayments: boolean = ApplePaySession.canMakePayments();
|
||||
const supported: boolean = ApplePaySession.supportsVersion(2);
|
||||
|
||||
ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier)
|
||||
.then((status: boolean) => {
|
||||
@@ -168,7 +168,7 @@ describe("ApplePaySession", () => {
|
||||
});
|
||||
describe("ApplePayPaymentRequest", () => {
|
||||
it("can create a new instance", () => {
|
||||
let paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
|
||||
const paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
|
||||
applicationData: "ApplicationData",
|
||||
countryCode: "GB",
|
||||
currencyCode: "GBP",
|
||||
@@ -181,8 +181,8 @@ describe("ApplePayPaymentRequest", () => {
|
||||
"amex",
|
||||
"discover",
|
||||
"jcb",
|
||||
"masterCard",
|
||||
"privateLabel",
|
||||
"masterCard",
|
||||
"privateLabel",
|
||||
"visa"
|
||||
],
|
||||
total: {
|
||||
|
||||
Vendored
+13
-13
@@ -10,7 +10,7 @@ declare class ApplePaySession extends EventTarget {
|
||||
/**
|
||||
* Creates a new instance of the ApplePaySession class.
|
||||
* @param version - The version of the ApplePay JS API you are using.
|
||||
* @param paymentRequest - An ApplePayPaymentRequest object that contains the information that is displayed on the Apple Pay payment sheet.
|
||||
* @param paymentRequest - An ApplePayPaymentRequest object that contains the information that is displayed on the Apple Pay payment sheet.
|
||||
*/
|
||||
constructor(version: number, paymentRequest: ApplePayJS.ApplePayPaymentRequest);
|
||||
|
||||
@@ -95,8 +95,8 @@ declare class ApplePaySession extends EventTarget {
|
||||
|
||||
/**
|
||||
* Call after a payment method has been selected.
|
||||
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
|
||||
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
|
||||
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
|
||||
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
|
||||
*/
|
||||
completePaymentMethodSelection(newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void;
|
||||
|
||||
@@ -104,8 +104,8 @@ declare class ApplePaySession extends EventTarget {
|
||||
* Call after a shipping contact has been selected.
|
||||
* @param status - The status of the shipping contact update.
|
||||
* @param newShippingMethods - A sequence of ApplePayShippingMethod dictionaries.
|
||||
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
|
||||
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
|
||||
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
|
||||
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
|
||||
*/
|
||||
completeShippingContactSelection(
|
||||
status: number,
|
||||
@@ -116,8 +116,8 @@ declare class ApplePaySession extends EventTarget {
|
||||
/**
|
||||
* Call after the shipping method has been selected.
|
||||
* @param status - The status of the shipping method update.
|
||||
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
|
||||
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
|
||||
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
|
||||
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
|
||||
*/
|
||||
completeShippingMethodSelection(status: number, newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void;
|
||||
|
||||
@@ -204,7 +204,7 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
/**
|
||||
* The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
|
||||
* The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
|
||||
*/
|
||||
abstract class ApplePayPaymentAuthorizedEvent extends Event {
|
||||
/**
|
||||
@@ -279,7 +279,7 @@ declare namespace ApplePayJS {
|
||||
|
||||
/**
|
||||
* A string, suitable for display, that is the name of the payment network backing the card.
|
||||
* The value is one of the supported networks specified in the supportedNetworks property of the ApplePayPaymentRequest.
|
||||
* The value is one of the supported networks specified in the supportedNetworks property of the ApplePayPaymentRequest.
|
||||
*/
|
||||
network: string;
|
||||
|
||||
@@ -295,7 +295,7 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
/**
|
||||
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
|
||||
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
|
||||
*/
|
||||
abstract class ApplePayPaymentMethodSelectedEvent extends Event {
|
||||
/**
|
||||
@@ -426,7 +426,7 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
/**
|
||||
* The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
|
||||
* The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
|
||||
*/
|
||||
abstract class ApplePayShippingContactSelectedEvent extends Event {
|
||||
/**
|
||||
@@ -461,7 +461,7 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
/**
|
||||
* The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
|
||||
* The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
|
||||
*/
|
||||
abstract class ApplePayShippingMethodSelectedEvent extends Event {
|
||||
/**
|
||||
@@ -471,7 +471,7 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
/**
|
||||
* The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
|
||||
* The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
|
||||
*/
|
||||
abstract class ApplePayValidateMerchantEvent extends Event {
|
||||
/**
|
||||
|
||||
@@ -123,7 +123,7 @@ context.addTelemetryInitializer(envelope => { });
|
||||
|
||||
// a sample from: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#example
|
||||
context.addTelemetryInitializer(envelope => {
|
||||
let telemetryItem = envelope.data.baseData;
|
||||
const telemetryItem = envelope.data.baseData;
|
||||
if (envelope.name === Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType) {
|
||||
telemetryItem.url = "URL CENSORED";
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": [ false ],
|
||||
// All are TODOs
|
||||
"interface-name": false,
|
||||
"no-internal-module": false,
|
||||
"no-single-declare-module": false
|
||||
"no-mergeable-namespace": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-unnecessary-qualifier": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for argparse v1.0.3
|
||||
// Project: https://github.com/nodeca/argparse
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
|
||||
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import * as ascii2mathml from 'ascii2mathml';
|
||||
|
||||
let fn = ascii2mathml({}); // $ExpectType any
|
||||
fn(''); // $ExpectType string
|
||||
ascii2mathml('', {}); // $ExpectType string
|
||||
|
||||
// $ExpectType string
|
||||
ascii2mathml('', {
|
||||
decimalMark: '.',
|
||||
colSep: ',',
|
||||
rowSep: ';',
|
||||
display: 'inline',
|
||||
dir: 'ltr',
|
||||
bare: false,
|
||||
standalone: false,
|
||||
annotate: false
|
||||
});
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for ascii2mathml 0.5
|
||||
// Project: https://github.com/runarberg/ascii2mathml
|
||||
// Definitions by: Muhammad Ragib Hasin <https://github.com/RagibHasin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = A2MML;
|
||||
|
||||
declare var A2MML: ascii2mathml;
|
||||
|
||||
interface Options {
|
||||
decimalMark?: string;
|
||||
colSep?: string;
|
||||
rowSep?: string;
|
||||
display?: 'inline' | 'block';
|
||||
dir?: 'ltr' | 'rtl';
|
||||
bare?: boolean;
|
||||
standalone?: boolean;
|
||||
annotate?: boolean;
|
||||
}
|
||||
|
||||
interface ascii2mathml {
|
||||
/**
|
||||
* Generates a function with default options set to convert
|
||||
* ASCIIMath expression to MathML markup.
|
||||
* @param options Options
|
||||
*/
|
||||
(options: Options): ascii2mathml;
|
||||
|
||||
/**
|
||||
* Converts ASCIIMath expression to MathML markup.
|
||||
* @param asciimath {string} ASCIIMath expression
|
||||
* @param options Options
|
||||
*/
|
||||
(asciimath: string, options?: Options): string;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ascii2mathml-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AskmethatRating, AskmethatRatingSteps } from "askmethat-rating";
|
||||
|
||||
let options = {
|
||||
const options = {
|
||||
backgroundColor: "#e5e500",
|
||||
hoverColor: "#ffff66",
|
||||
fontClass: "fa fa-star",
|
||||
@@ -11,8 +11,8 @@ let options = {
|
||||
inputName: "AskmethatRating"
|
||||
};
|
||||
|
||||
let div = document.createElement("div");
|
||||
let amcRating = new AskmethatRating(div, 2 , options);
|
||||
const div = document.createElement("div");
|
||||
const amcRating = new AskmethatRating(div, 2 , options);
|
||||
|
||||
options.readonly = true;
|
||||
amcRating.defaultOptions = options;
|
||||
|
||||
@@ -4,7 +4,7 @@ import Auth0Lock from 'auth0-lock';
|
||||
const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID";
|
||||
const DOMAIN = "YOUR_DOMAIN_AT.auth0.com";
|
||||
|
||||
var lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN);
|
||||
const lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN);
|
||||
|
||||
lock.show();
|
||||
lock.hide();
|
||||
@@ -12,7 +12,7 @@ lock.logout(() => {});
|
||||
|
||||
// Show supports UI arguments
|
||||
|
||||
var showOptions : Auth0LockShowOptions = {
|
||||
const showOptions : Auth0LockShowOptions = {
|
||||
allowedConnections: [ "twitter", "facebook" ],
|
||||
allowSignUp: true,
|
||||
allowForgotPassword: false,
|
||||
@@ -63,7 +63,7 @@ lock.on("authenticated", function(authResult : any) {
|
||||
|
||||
// test theme
|
||||
|
||||
var themeOptions : Auth0LockConstructorOptions = {
|
||||
const themeOptions : Auth0LockConstructorOptions = {
|
||||
theme: {
|
||||
authButtons: {
|
||||
fooProvider: {
|
||||
@@ -86,7 +86,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions);
|
||||
|
||||
// test empty theme
|
||||
|
||||
var themeOptionsEmpty : Auth0LockConstructorOptions = {
|
||||
const themeOptionsEmpty : Auth0LockConstructorOptions = {
|
||||
theme: { }
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions);
|
||||
|
||||
// test authentication
|
||||
|
||||
var authOptions : Auth0LockConstructorOptions = {
|
||||
const authOptions : Auth0LockConstructorOptions = {
|
||||
auth: {
|
||||
params: { state: "foo" },
|
||||
redirect: true,
|
||||
@@ -108,7 +108,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, authOptions);
|
||||
|
||||
// test multi-variant example
|
||||
|
||||
var multiVariantOptions : Auth0LockConstructorOptions = {
|
||||
const multiVariantOptions : Auth0LockConstructorOptions = {
|
||||
container: "myContainer",
|
||||
closable: false,
|
||||
languageDictionary: {
|
||||
@@ -122,7 +122,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, multiVariantOptions);
|
||||
|
||||
// test text-field additional sign up field
|
||||
|
||||
var textFieldOptions : Auth0LockConstructorOptions = {
|
||||
const textFieldOptions : Auth0LockConstructorOptions = {
|
||||
additionalSignUpFields: [{
|
||||
name: "address",
|
||||
placeholder: "enter your address",
|
||||
@@ -142,7 +142,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, textFieldOptions);
|
||||
|
||||
// test select-field additional sign up field
|
||||
|
||||
var selectFieldOptions : Auth0LockConstructorOptions = {
|
||||
const selectFieldOptions : Auth0LockConstructorOptions = {
|
||||
additionalSignUpFields: [{
|
||||
type: "select",
|
||||
name: "location",
|
||||
@@ -162,7 +162,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptions);
|
||||
|
||||
// test select-field additional sign up field with callbacks for
|
||||
|
||||
var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
|
||||
const selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
|
||||
additionalSignUpFields: [{
|
||||
type: "select",
|
||||
name: "location",
|
||||
@@ -171,7 +171,7 @@ var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
|
||||
// obtain options, in case of error you call cb with the error in the
|
||||
// first arg instead of null
|
||||
|
||||
let options = [
|
||||
const options = [
|
||||
{value: "us", label: "United States"},
|
||||
{value: "fr", label: "France"},
|
||||
{value: "ar", label: "Argentina"}
|
||||
@@ -184,7 +184,7 @@ var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = {
|
||||
// obtain prefill, in case of error you call cb with the error in the
|
||||
// first arg instead of null
|
||||
|
||||
let prefill = "us";
|
||||
const prefill = "us";
|
||||
|
||||
cb(null, prefill);
|
||||
}
|
||||
@@ -195,13 +195,13 @@ new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks);
|
||||
|
||||
// test Avatar options
|
||||
|
||||
var avatarOptions : Auth0LockConstructorOptions = {
|
||||
const avatarOptions : Auth0LockConstructorOptions = {
|
||||
avatar: {
|
||||
url: (email : string, cb : Auth0LockAvatarUrlCallback) => {
|
||||
// obtain url for email, in case of error you call cb with the error in
|
||||
// the first arg instead of null
|
||||
|
||||
let url = "url";
|
||||
const url = "url";
|
||||
|
||||
cb(null, url);
|
||||
},
|
||||
@@ -209,7 +209,7 @@ var avatarOptions : Auth0LockConstructorOptions = {
|
||||
// obtain displayName for email, in case of error you call cb with the
|
||||
// error in the first arg instead of null
|
||||
|
||||
let displayName = "displayName";
|
||||
const displayName = "displayName";
|
||||
|
||||
cb(null, displayName);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ var avatarOptions : Auth0LockConstructorOptions = {
|
||||
|
||||
new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions);
|
||||
|
||||
var authResult : AuthResult = {
|
||||
const authResult : AuthResult = {
|
||||
accessToken: 'fake_access_token',
|
||||
idToken: 'fake_id_token',
|
||||
idTokenPayload: {
|
||||
|
||||
Vendored
+1
@@ -360,6 +360,7 @@ export class ManagementClient {
|
||||
|
||||
// Users
|
||||
getUsers(params?: GetUsersData): Promise<User[]>;
|
||||
getUsers(cb: (err: Error, users: User[]) => void): void;
|
||||
getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void;
|
||||
|
||||
getUser(params: ObjectWithId): Promise<User>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as autosni from "auto-sni";
|
||||
let a = autosni({
|
||||
const a = autosni({
|
||||
agreeTos: true,
|
||||
email: '',
|
||||
domains: ['']
|
||||
|
||||
@@ -11,7 +11,7 @@ ast.loc.start;
|
||||
const output = generate(ast, { /* options */ }, code);
|
||||
|
||||
// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-generator
|
||||
let result = generate(ast, {
|
||||
const result = generate(ast, {
|
||||
retainLines: false,
|
||||
compact: "auto",
|
||||
concise: false,
|
||||
|
||||
@@ -29,7 +29,7 @@ const ast = babylon.parse(code);
|
||||
|
||||
traverse(ast, {
|
||||
enter(path) {
|
||||
let node = path.node;
|
||||
const node = path.node;
|
||||
if (t.isIdentifier(node) && node.name === "n") {
|
||||
node.name = "x";
|
||||
}
|
||||
@@ -85,10 +85,10 @@ const v1: Visitor = {
|
||||
// ...
|
||||
}
|
||||
|
||||
let id1 = path.scope.generateUidIdentifier("uid");
|
||||
const id1 = path.scope.generateUidIdentifier("uid");
|
||||
id1.type;
|
||||
id1.name;
|
||||
let id2 = path.scope.generateUidIdentifier("uid");
|
||||
const id2 = path.scope.generateUidIdentifier("uid");
|
||||
id2.type;
|
||||
id2.name;
|
||||
|
||||
|
||||
Vendored
+27
-27
@@ -8,7 +8,7 @@
|
||||
import * as t from 'babel-types';
|
||||
export type Node = t.Node;
|
||||
|
||||
export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath<Node>): void;
|
||||
export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void;
|
||||
|
||||
export interface TraverseOptions extends Visitor {
|
||||
scope?: Scope;
|
||||
@@ -16,8 +16,8 @@ export interface TraverseOptions extends Visitor {
|
||||
}
|
||||
|
||||
export class Scope {
|
||||
constructor(path: NodePath<Node>, parentScope?: Scope);
|
||||
path: NodePath<Node>;
|
||||
constructor(path: NodePath, parentScope?: Scope);
|
||||
path: NodePath;
|
||||
block: Node;
|
||||
parentBlock: Node;
|
||||
parent: Scope;
|
||||
@@ -61,13 +61,13 @@ export class Scope {
|
||||
|
||||
toArray(node: Node, i?: number): Node;
|
||||
|
||||
registerDeclaration(path: NodePath<Node>): void;
|
||||
registerDeclaration(path: NodePath): void;
|
||||
|
||||
buildUndefinedNode(): Node;
|
||||
|
||||
registerConstantViolation(path: NodePath<Node>): void;
|
||||
registerConstantViolation(path: NodePath): void;
|
||||
|
||||
registerBinding(kind: string, path: NodePath<Node>, bindingPath?: NodePath<Node>): void;
|
||||
registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void;
|
||||
|
||||
addGlobal(node: Node): void;
|
||||
|
||||
@@ -121,16 +121,16 @@ export class Scope {
|
||||
}
|
||||
|
||||
export class Binding {
|
||||
constructor(opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath<Node>; kind: 'var' | 'let' | 'const'; });
|
||||
constructor(opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; kind: 'var' | 'let' | 'const'; });
|
||||
identifier: t.Identifier;
|
||||
scope: Scope;
|
||||
path: NodePath<Node>;
|
||||
path: NodePath;
|
||||
kind: 'var' | 'let' | 'const' | 'module';
|
||||
referenced: boolean;
|
||||
references: number;
|
||||
referencePaths: Array<NodePath<Node>>;
|
||||
referencePaths: NodePath[];
|
||||
constant: boolean;
|
||||
constantViolations: Array<NodePath<Node>>;
|
||||
constantViolations: NodePath[];
|
||||
}
|
||||
|
||||
export interface Visitor extends VisitNodeObject<Node> {
|
||||
@@ -328,7 +328,7 @@ export class NodePath<T = Node> {
|
||||
state: any;
|
||||
opts: object;
|
||||
skipKeys: object;
|
||||
parentPath: NodePath<Node>;
|
||||
parentPath: NodePath;
|
||||
context: TraversalContext;
|
||||
container: object | object[];
|
||||
listKey: string;
|
||||
@@ -362,15 +362,15 @@ export class NodePath<T = Node> {
|
||||
* Call the provided `callback` with the `NodePath`s of all the parents.
|
||||
* When the `callback` returns a truthy value, we return that node path.
|
||||
*/
|
||||
findParent(callback: (path: NodePath<Node>) => boolean): NodePath<Node>;
|
||||
findParent(callback: (path: NodePath) => boolean): NodePath;
|
||||
|
||||
find(callback: (path: NodePath<Node>) => boolean): NodePath<Node>;
|
||||
find(callback: (path: NodePath) => boolean): NodePath;
|
||||
|
||||
/** Get the parent function of the current path. */
|
||||
getFunctionParent(): NodePath<Node>;
|
||||
getFunctionParent(): NodePath;
|
||||
|
||||
/** Walk up the tree until we hit a parent node path in a list. */
|
||||
getStatementParent(): NodePath<Node>;
|
||||
getStatementParent(): NodePath;
|
||||
|
||||
/**
|
||||
* Get the deepest common ancestor and then from it, get the earliest relationship path
|
||||
@@ -379,20 +379,20 @@ export class NodePath<T = Node> {
|
||||
* Earliest is defined as being "before" all the other nodes in terms of list container
|
||||
* position and visiting key.
|
||||
*/
|
||||
getEarliestCommonAncestorFrom(paths: Array<NodePath<Node>>): Array<NodePath<Node>>;
|
||||
getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath[];
|
||||
|
||||
/** Get the earliest path in the tree where the provided `paths` intersect. */
|
||||
getDeepestCommonAncestorFrom(
|
||||
paths: Array<NodePath<Node>>,
|
||||
filter?: (deepest: Node, i: number, ancestries: Array<NodePath<Node>>) => NodePath<Node>
|
||||
): NodePath<Node>;
|
||||
paths: NodePath[],
|
||||
filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath
|
||||
): NodePath;
|
||||
|
||||
/**
|
||||
* Build an array of node paths containing the entire ancestry of the current node path.
|
||||
*
|
||||
* NOTE: The current node path is included in this.
|
||||
*/
|
||||
getAncestry(): Array<NodePath<Node>>;
|
||||
getAncestry(): NodePath[];
|
||||
|
||||
inType(...candidateTypes: string[]): boolean;
|
||||
|
||||
@@ -404,7 +404,7 @@ export class NodePath<T = Node> {
|
||||
|
||||
couldBeBaseType(name: string): boolean;
|
||||
|
||||
baseTypeStrictlyMatches(right: NodePath<Node>): boolean;
|
||||
baseTypeStrictlyMatches(right: NodePath): boolean;
|
||||
|
||||
isGenericType(genericName: string): boolean;
|
||||
|
||||
@@ -428,7 +428,7 @@ export class NodePath<T = Node> {
|
||||
replaceWithSourceString(replacement: any): void;
|
||||
|
||||
/** Replace the current node with another. */
|
||||
replaceWith(replacement: Node | NodePath<Node>): void;
|
||||
replaceWith(replacement: Node | NodePath): void;
|
||||
|
||||
/**
|
||||
* This method takes an array of statements nodes and then explodes it
|
||||
@@ -573,13 +573,13 @@ export class NodePath<T = Node> {
|
||||
hoist(scope: Scope): void;
|
||||
|
||||
// ------------------------- family -------------------------
|
||||
getOpposite(): NodePath<Node>;
|
||||
getOpposite(): NodePath;
|
||||
|
||||
getCompletionRecords(): Array<NodePath<Node>>;
|
||||
getCompletionRecords(): NodePath[];
|
||||
|
||||
getSibling(key: string): NodePath<Node>;
|
||||
getSibling(key: string): NodePath;
|
||||
|
||||
get(key: string, context?: boolean | TraversalContext): NodePath<Node>;
|
||||
get(key: string, context?: boolean | TraversalContext): NodePath;
|
||||
|
||||
getBindingIdentifiers(duplicates?: boolean): Node[];
|
||||
|
||||
@@ -960,7 +960,7 @@ export class Hub {
|
||||
}
|
||||
|
||||
export interface TraversalContext {
|
||||
parentPath: NodePath<Node>;
|
||||
parentPath: NodePath;
|
||||
scope: Scope;
|
||||
state: any;
|
||||
opts: any;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
import traverse from "babel-traverse";
|
||||
import * as t from "babel-types";
|
||||
|
||||
let ast: t.Node;
|
||||
declare const ast: t.Node;
|
||||
|
||||
traverse(ast, {
|
||||
enter(path) {
|
||||
let node = path.node;
|
||||
const node = path.node;
|
||||
if (t.isIdentifier(node, { name: "n" })) {
|
||||
node.name = "x";
|
||||
}
|
||||
@@ -31,7 +31,7 @@ const exp: t.Expression = t.nullLiteral();
|
||||
// https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-plugin-transform-react-inline-elements/src/index.js#L61
|
||||
traverse(ast, {
|
||||
JSXElement(path, file) {
|
||||
const { node } = path;
|
||||
const { node } = path;
|
||||
const open = node.openingElement;
|
||||
|
||||
// init
|
||||
|
||||
@@ -6,7 +6,7 @@ const code = `function square(n) {
|
||||
return n * n;
|
||||
}`;
|
||||
|
||||
let node = babylon.parse(code);
|
||||
const node = babylon.parse(code);
|
||||
assert(node.type === "File");
|
||||
assert(node.start === 0);
|
||||
assert(node.end === 38);
|
||||
|
||||
@@ -56,11 +56,11 @@ const pipesConfigFullEmpty: Bagpipes.Config = {
|
||||
userViewsDirs: []
|
||||
};
|
||||
|
||||
let pipesA = Bagpipes.create(perDefsMixed, {
|
||||
const pipesA = Bagpipes.create(perDefsMixed, {
|
||||
connectMiddlewareDirs: ['some_dir', 'ssssss'],
|
||||
swaggerNodeRunner: {}
|
||||
});
|
||||
let pipeA = pipesA.getPipe('HelloWorld');
|
||||
const pipeA = pipesA.getPipe('HelloWorld');
|
||||
|
||||
// log the output to standard out
|
||||
pipeA.fit((context, cb) => {
|
||||
@@ -81,7 +81,7 @@ const pipeErrTest = pipesEnty.pipes['any'].fit((context, cb) => {
|
||||
pipesEnty.play(pipeErrTest, {});
|
||||
|
||||
const fittingsC = ["xxxx", "aaa"].map((name) => {
|
||||
let fittingDef = {} as Bagpipes.PipeDefMap;
|
||||
const fittingDef = {} as Bagpipes.PipeDefMap;
|
||||
fittingDef[name] = 'nothing';
|
||||
return fittingDef;
|
||||
});
|
||||
@@ -95,6 +95,6 @@ bagpipesD.play(bagpipesD.getPipe('objPipe'), {});
|
||||
// Test full create
|
||||
const userFittingsDirs = ['./fixtures/fittings'];
|
||||
const pipeWithString = ['emit'];
|
||||
let contextPlain = {};
|
||||
const contextPlain = {};
|
||||
const bagpipesWithPipeAndFittings = Bagpipes.create({ myCustomPipe: pipeWithString }, { userFittingsDirs });
|
||||
bagpipesWithPipeAndFittings.play(bagpipesWithPipeAndFittings.getPipe('myCustomPipe'), contextPlain);
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace BMapTests {
|
||||
//document: http://lbsyun.baidu.com/index.php?title=jspopular
|
||||
public createMap(container: string | HTMLElement) {
|
||||
navigator.geolocation.getCurrentPosition((position: Position) => {
|
||||
let point = new BMap.Point(position.coords.longitude, position.coords.latitude);
|
||||
let map = new BMap.Map(container);
|
||||
const point = new BMap.Point(position.coords.longitude, position.coords.latitude);
|
||||
const map = new BMap.Map(container);
|
||||
map.centerAndZoom(point, 15);
|
||||
}, console.log, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace BMapTests {
|
||||
map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT }));
|
||||
}
|
||||
public addMarker(map: BMap.Map, point: BMap.Point) {
|
||||
var marker = new BMap.Marker(point);
|
||||
const marker = new BMap.Marker(point);
|
||||
map.addOverlay(marker);
|
||||
marker.setAnimation(BMAP_ANIMATION_BOUNCE);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for batch-stream 0.1.2
|
||||
// Project: https://github.com/segmentio/batch-stream
|
||||
// Definitions by: Nicholas Penree <http://github.com/drudge>
|
||||
// Definitions by: Nicholas Penree <https://github.com/drudge>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
@@ -182,7 +182,7 @@ x.floor();
|
||||
y = new BigNumber(-1.3);
|
||||
y.floor();
|
||||
|
||||
0.1 > (0.3 - 0.2);
|
||||
0.1 > (0.3 - 0.2); // tslint:disable-line binary-expression-operand-order
|
||||
x = new BigNumber(0.1);
|
||||
x.greaterThan(BigNumber(0.3).minus(0.2));
|
||||
BigNumber(0).gt(x);
|
||||
|
||||
@@ -45,7 +45,7 @@ Bleno.on('stateChange', (state: string) => {
|
||||
}
|
||||
});
|
||||
|
||||
let characteristic = new EchoCharacteristic();
|
||||
const characteristic = new EchoCharacteristic();
|
||||
Bleno.on('advertisingStart', (error: string) => {
|
||||
if (!error) {
|
||||
Bleno.setServices(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { BloomFilter } from 'bloomfilter';
|
||||
function test_bloomfilter() {
|
||||
const m: number = 10;
|
||||
const k: number = 2;
|
||||
const m = 10;
|
||||
const k = 2;
|
||||
|
||||
const bloomFilter = new BloomFilter(m, k);
|
||||
const array: Int32Array[] = bloomFilter.buckets;
|
||||
|
||||
@@ -182,10 +182,10 @@ exports.down = (knex: Knex) => {
|
||||
|
||||
{
|
||||
class Site extends bookshelf.Model<Site> {
|
||||
get tableName() { return 'sites'; }
|
||||
photo(): Photo {
|
||||
return this.morphOne(Photo, 'imageable');
|
||||
}
|
||||
get tableName() { return 'sites'; }
|
||||
photo(): Photo {
|
||||
return this.morphOne(Photo, 'imageable');
|
||||
}
|
||||
}
|
||||
|
||||
class Post extends bookshelf.Model<Post> {
|
||||
|
||||
Vendored
+9
-5
@@ -1,6 +1,6 @@
|
||||
// Type definitions for bookshelfjs v0.9.3
|
||||
// Project: http://bookshelfjs.org/
|
||||
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>, Vesa Poikajärvi <https://github.com/vesse>
|
||||
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>, Vesa Poikajärvi <https://github.com/vesse>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -84,6 +84,10 @@ declare namespace Bookshelf {
|
||||
values(): any[];
|
||||
}
|
||||
|
||||
interface ModelSubclass {
|
||||
new(): Model<any>;
|
||||
}
|
||||
|
||||
class Model<T extends Model<any>> extends ModelBase<T> {
|
||||
static collection<T extends Model<any>>(models?: T[], options?: CollectionOptions<T>): Collection<T>;
|
||||
static count(column?: string, options?: SyncOptions): BlueBird<number>;
|
||||
@@ -106,8 +110,8 @@ declare namespace Bookshelf {
|
||||
load(relations: string | string[], options?: LoadOptions): BlueBird<T>;
|
||||
morphMany<R extends Model<any>>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): Collection<R>;
|
||||
morphOne<R extends Model<any>>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): R;
|
||||
morphTo(name: string, columnNames?: string[], ...target: typeof Model[]): T;
|
||||
morphTo(name: string, ...target: typeof Model[]): T;
|
||||
morphTo(name: string, columnNames?: string[], ...target: ModelSubclass[]): T;
|
||||
morphTo(name: string, ...target: ModelSubclass[]): T;
|
||||
orderBy(column: string, order?: SortOrder): T;
|
||||
|
||||
// Declaration order matters otherwise TypeScript gets confused between query() and query(...query: string[])
|
||||
@@ -120,7 +124,7 @@ declare namespace Bookshelf {
|
||||
resetQuery(): T;
|
||||
save(key?: string, val?: any, options?: SaveOptions): BlueBird<T>;
|
||||
save(attrs?: { [key: string]: any }, options?: SaveOptions): BlueBird<T>;
|
||||
through<R extends Model<any>>(interim: typeof Model, throughForeignKey?: string, otherKey?: string): R;
|
||||
through<R extends Model<any>>(interim: ModelSubclass, throughForeignKey?: string, otherKey?: string): R;
|
||||
where(properties: { [key: string]: any }): T;
|
||||
where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T;
|
||||
|
||||
@@ -255,7 +259,7 @@ declare namespace Bookshelf {
|
||||
query(query: { [key: string]: any }): Collection<T>;
|
||||
|
||||
resetQuery(): Collection<T>;
|
||||
through<R extends Model<any>>(interim: typeof Model, throughForeignKey?: string, otherKey?: string): Collection<R>;
|
||||
through<R extends Model<any>>(interim: ModelSubclass, throughForeignKey?: string, otherKey?: string): Collection<R>;
|
||||
updatePivot(attributes: any, options?: PivotOptions): BlueBird<number>;
|
||||
withPivot(columns: string[]): Collection<T>;
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -1,8 +1,8 @@
|
||||
// Type definitions for boom 4.3
|
||||
// Project: http://github.com/hapijs/boom
|
||||
// Definitions by: Igor Rogatty <http://github.com/rogatty>
|
||||
// AJP <http://github.com/AJamesPhillips>
|
||||
// Jinesh Shah <http://github.com/jineshshah36>
|
||||
// Project: https://github.com/hapijs/boom
|
||||
// Definitions by: Igor Rogatty <https://github.com/rogatty>
|
||||
// AJP <https://github.com/AJamesPhillips>
|
||||
// Jinesh Shah <https://github.com/jineshshah36>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for boom 3.2
|
||||
// Project: http://github.com/hapijs/boom
|
||||
// Definitions by: Igor Rogatty <http://github.com/rogatty>
|
||||
// Project: https://github.com/hapijs/boom
|
||||
// Definitions by: Igor Rogatty <https://github.com/rogatty>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
@@ -118,7 +118,7 @@ function test_timeZone() {
|
||||
|
||||
function test_widgetParent() {
|
||||
let nullW: null = null;
|
||||
let str: string = "myId";
|
||||
let str = "myId";
|
||||
let jquery = $("#element");
|
||||
|
||||
$("#picker").datetimepicker({
|
||||
|
||||
+1
-1
@@ -589,7 +589,7 @@ export interface UpdateEvent extends JQueryEventObject {
|
||||
viewDate: moment.Moment;
|
||||
}
|
||||
|
||||
export type EventName = "dp.show" | "dp.hide" | "dp.error";
|
||||
export type EventName = "dp.show" | "dp.hide" | "dp.error";
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Bounce.js v0.8.2
|
||||
// Project: http://github.com/tictail/bounce.js
|
||||
// Definitions by: Cherry <http://github.com/cherrry>
|
||||
// Project: https://github.com/tictail/bounce.js
|
||||
// Definitions by: Cherry <https://github.com/cherrry>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Change Log
|
||||
License
|
||||
=======
|
||||
|
||||
Box2DWeb-2.1.d.ts Copyright (c) 2012 Josh Baldwin http://github.com/jbaldwin/box2dweb.d.ts
|
||||
Box2DWeb-2.1.d.ts Copyright (c) 2012 Josh Baldwin https://github.com/jbaldwin/box2dweb.d.ts
|
||||
There are a few competing javascript Box2D ports.
|
||||
This definitions file is for Box2dWeb.js ->
|
||||
http://code.google.com/p/box2dweb/
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Box2DWeb-2.1.d.ts Copyright (c) 2012-2013 Josh Baldwin http://github.com/jbaldwin/box2dweb.d.ts
|
||||
* Box2DWeb-2.1.d.ts Copyright (c) 2012-2013 Josh Baldwin https://github.com/jbaldwin/box2dweb.d.ts
|
||||
* There are a few competing javascript Box2D ports.
|
||||
* This definitions file is for Box2dWeb.js ->
|
||||
* http://code.google.com/p/box2dweb/
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for browser-sync
|
||||
// Project: http://www.browsersync.io/
|
||||
// Definitions by: Asana <https://asana.com>, Joe Skeen <http://github.com/joeskeen>
|
||||
// Definitions by: Asana <https://asana.com>, Joe Skeen <https://github.com/joeskeen>
|
||||
// Thomas "Thasmo" Deinhamer <https://thasmo.com/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import Logger = require('bunyan');
|
||||
|
||||
let ringBufferOptions: Logger.RingBufferOptions = {
|
||||
const ringBufferOptions: Logger.RingBufferOptions = {
|
||||
limit: 100
|
||||
};
|
||||
let ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions);
|
||||
const ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions);
|
||||
ringBuffer.write("hello");
|
||||
|
||||
let level: number;
|
||||
@@ -20,7 +20,7 @@ level = Logger.resolveLevel(Logger.WARN);
|
||||
level = Logger.resolveLevel(Logger.ERROR);
|
||||
level = Logger.resolveLevel(Logger.FATAL);
|
||||
|
||||
let options: Logger.LoggerOptions = {
|
||||
const options: Logger.LoggerOptions = {
|
||||
name: 'test-logger',
|
||||
serializers: Logger.stdSerializers,
|
||||
streams: [{
|
||||
@@ -51,9 +51,9 @@ let options: Logger.LoggerOptions = {
|
||||
}]
|
||||
};
|
||||
|
||||
let log = Logger.createLogger(options);
|
||||
const log = Logger.createLogger(options);
|
||||
|
||||
let customSerializer = (anything: any) => {
|
||||
const customSerializer = (anything: any) => {
|
||||
return { obj: anything };
|
||||
};
|
||||
|
||||
@@ -67,7 +67,7 @@ log.addSerializers(
|
||||
}
|
||||
);
|
||||
|
||||
let levels: number[] = log.levels();
|
||||
const levels: number[] = log.levels();
|
||||
level = log.levels(0);
|
||||
log.levels('foo');
|
||||
|
||||
@@ -75,9 +75,9 @@ log.levels(0, Logger.INFO);
|
||||
log.levels(0, 'info');
|
||||
log.levels('foo', Logger.WARN);
|
||||
|
||||
let buffer = new Buffer(0);
|
||||
let error = new Error('');
|
||||
let object = {
|
||||
const buffer = new Buffer(0);
|
||||
const error = new Error('');
|
||||
const object = {
|
||||
test: 123
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ log.fatal(error);
|
||||
log.fatal(object);
|
||||
log.fatal('Hello, %s', 'world!');
|
||||
|
||||
let recursive: any = {
|
||||
const recursive: any = {
|
||||
hello: 'world',
|
||||
whats: {}
|
||||
};
|
||||
|
||||
Vendored
+2
-2
@@ -1,8 +1,8 @@
|
||||
// Type definitions for bytebuffer.js 5.0.0
|
||||
// Project: https://github.com/dcodeIO/bytebuffer.js
|
||||
// Definitions by: Denis Cappellin <http://github.com/cappellin>
|
||||
// Definitions by: Denis Cappellin <https://github.com/cappellin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions by: SINTEF-9012 <http://github.com/SINTEF-9012>
|
||||
// Definitions by: SINTEF-9012 <https://github.com/SINTEF-9012>
|
||||
|
||||
import Long = require("long");
|
||||
|
||||
|
||||
+100
-100
@@ -3,7 +3,7 @@
|
||||
//////////////////
|
||||
|
||||
function chart_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
bindto: "#myContainer",
|
||||
size: {
|
||||
@@ -30,19 +30,19 @@ function chart_examples() {
|
||||
onresized: () => { /* code*/ }
|
||||
});
|
||||
|
||||
let chart2 = c3.generate({
|
||||
const chart2 = c3.generate({
|
||||
bindto: document.getElementById("myContainer"),
|
||||
data: {}
|
||||
});
|
||||
|
||||
let chart3 = c3.generate({
|
||||
const chart3 = c3.generate({
|
||||
bindto: d3.select("#myContainer"),
|
||||
data: {}
|
||||
});
|
||||
}
|
||||
|
||||
function data_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
url: "/data/c3_test.csv",
|
||||
json: [
|
||||
@@ -126,7 +126,7 @@ function data_examples() {
|
||||
}
|
||||
});
|
||||
|
||||
let chart2 = c3.generate({
|
||||
const chart2 = c3.generate({
|
||||
data: {
|
||||
labels: { format: (v, id, i, j) => { /* code */ } },
|
||||
hide: ["data1"]
|
||||
@@ -135,7 +135,7 @@ function data_examples() {
|
||||
}
|
||||
|
||||
function axis_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
axis: {
|
||||
rotated: true,
|
||||
@@ -207,7 +207,7 @@ function axis_examples() {
|
||||
}
|
||||
});
|
||||
|
||||
let chart2 = c3.generate({
|
||||
const chart2 = c3.generate({
|
||||
data: {},
|
||||
axis: {
|
||||
x: {
|
||||
@@ -241,7 +241,7 @@ function axis_examples() {
|
||||
}
|
||||
|
||||
function grid_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
grid: {
|
||||
x: {
|
||||
@@ -265,7 +265,7 @@ function grid_examples() {
|
||||
}
|
||||
|
||||
function region_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
regions: [
|
||||
{ axis: "x", start: 1, end: 4, class: "region-1-4" },
|
||||
@@ -274,7 +274,7 @@ function region_examples() {
|
||||
}
|
||||
|
||||
function legend_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
legend: {
|
||||
show: true,
|
||||
@@ -294,7 +294,7 @@ function legend_examples() {
|
||||
}
|
||||
});
|
||||
|
||||
let chart2 = c3.generate({
|
||||
const chart2 = c3.generate({
|
||||
data: {},
|
||||
legend: {
|
||||
hide: "data1",
|
||||
@@ -307,7 +307,7 @@ function legend_examples() {
|
||||
}
|
||||
});
|
||||
|
||||
let chart3 = c3.generate({
|
||||
const chart3 = c3.generate({
|
||||
data: {},
|
||||
legend: {
|
||||
hide: ["data1", "data2"]
|
||||
@@ -316,7 +316,7 @@ function legend_examples() {
|
||||
}
|
||||
|
||||
function subchart_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
subchart: {
|
||||
show: true,
|
||||
@@ -329,7 +329,7 @@ function subchart_examples() {
|
||||
}
|
||||
|
||||
function zoom_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
zoom: {
|
||||
enabled: false,
|
||||
@@ -343,7 +343,7 @@ function zoom_examples() {
|
||||
}
|
||||
|
||||
function point_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
point: {
|
||||
show: false,
|
||||
@@ -362,7 +362,7 @@ function point_examples() {
|
||||
}
|
||||
|
||||
function line_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
line: {
|
||||
connectNull: true,
|
||||
@@ -374,7 +374,7 @@ function line_examples() {
|
||||
}
|
||||
|
||||
function area_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
area: {
|
||||
zerobased: false
|
||||
@@ -383,7 +383,7 @@ function area_examples() {
|
||||
}
|
||||
|
||||
function bar_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
bar: {
|
||||
width: 10,
|
||||
@@ -391,7 +391,7 @@ function bar_examples() {
|
||||
}
|
||||
});
|
||||
|
||||
let chart2 = c3.generate({
|
||||
const chart2 = c3.generate({
|
||||
data: {},
|
||||
bar: {
|
||||
width: {
|
||||
@@ -403,7 +403,7 @@ function bar_examples() {
|
||||
}
|
||||
|
||||
function pie_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
pie: {
|
||||
label: {
|
||||
@@ -419,7 +419,7 @@ function pie_examples() {
|
||||
}
|
||||
|
||||
function donut_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
donut: {
|
||||
label: {
|
||||
@@ -437,7 +437,7 @@ function donut_examples() {
|
||||
}
|
||||
|
||||
function gauge_examples() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {},
|
||||
gauge: {
|
||||
label: {
|
||||
@@ -460,7 +460,7 @@ function gauge_examples() {
|
||||
/////////////////
|
||||
|
||||
function simple_multiple() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -481,7 +481,7 @@ function simple_multiple() {
|
||||
}
|
||||
|
||||
function timeseries() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
xFormat: "%Y%m%d", // 'xFormat' can be used as custom format of 'x'
|
||||
@@ -503,7 +503,7 @@ function timeseries() {
|
||||
}
|
||||
|
||||
function chart_spline() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -515,7 +515,7 @@ function chart_spline() {
|
||||
}
|
||||
|
||||
function simple_xy() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -528,7 +528,7 @@ function simple_xy() {
|
||||
}
|
||||
|
||||
function simple_xy_multiple() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
xs: {
|
||||
data1: "x1",
|
||||
@@ -545,7 +545,7 @@ function simple_xy_multiple() {
|
||||
}
|
||||
|
||||
function simple_regions() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -560,7 +560,7 @@ function simple_regions() {
|
||||
}
|
||||
|
||||
function chart_step() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 300, 350, 300, 0, 0, 100],
|
||||
@@ -575,7 +575,7 @@ function chart_step() {
|
||||
}
|
||||
|
||||
function area_chart() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 300, 350, 300, 0, 0, 0],
|
||||
@@ -590,7 +590,7 @@ function area_chart() {
|
||||
}
|
||||
|
||||
function chart_area_stacked() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 300, 350, 300, 0, 0, 120],
|
||||
@@ -607,7 +607,7 @@ function chart_area_stacked() {
|
||||
}
|
||||
|
||||
function chart_bar() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -627,7 +627,7 @@ function chart_bar() {
|
||||
}
|
||||
|
||||
function chart_bar_stacked() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", -30, 200, 200, 400, -150, 250],
|
||||
@@ -648,7 +648,7 @@ function chart_bar_stacked() {
|
||||
}
|
||||
|
||||
function chart_scatter() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
xs: {
|
||||
setosa: "setosa_x",
|
||||
@@ -682,7 +682,7 @@ function chart_scatter() {
|
||||
}
|
||||
|
||||
function chart_pie() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
// iris data from R
|
||||
columns: [
|
||||
@@ -698,7 +698,7 @@ function chart_pie() {
|
||||
}
|
||||
|
||||
function chart_donut() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30],
|
||||
@@ -716,7 +716,7 @@ function chart_donut() {
|
||||
}
|
||||
|
||||
function gauge_chart() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data", 91.4]
|
||||
@@ -753,7 +753,7 @@ function gauge_chart() {
|
||||
}
|
||||
|
||||
function chart_combination() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 20, 50, 40, 60, 50],
|
||||
@@ -781,7 +781,7 @@ function chart_combination() {
|
||||
////////////////////
|
||||
|
||||
function categorized() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250, 50, 100, 250]
|
||||
@@ -797,7 +797,7 @@ function categorized() {
|
||||
}
|
||||
|
||||
function axes_rotated() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -814,7 +814,7 @@ function axes_rotated() {
|
||||
}
|
||||
|
||||
function axes_y2() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -834,7 +834,7 @@ function axes_y2() {
|
||||
}
|
||||
|
||||
function axes_x_tick_format() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -855,7 +855,7 @@ function axes_x_tick_format() {
|
||||
}
|
||||
|
||||
function axes_x_tick_count() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -876,7 +876,7 @@ function axes_x_tick_count() {
|
||||
}
|
||||
|
||||
function axes_x_tick_values() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -897,7 +897,7 @@ function axes_x_tick_values() {
|
||||
}
|
||||
|
||||
function axes_x_tick_culling() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250]
|
||||
@@ -919,7 +919,7 @@ function axes_x_tick_culling() {
|
||||
}
|
||||
|
||||
function axes_x_tick_fit() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -940,7 +940,7 @@ function axes_x_tick_fit() {
|
||||
}
|
||||
|
||||
function axes_x_localtime() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
xFormat: "%Y",
|
||||
@@ -966,7 +966,7 @@ function axes_x_localtime() {
|
||||
}
|
||||
|
||||
function axes_x_tick_rotate() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -990,7 +990,7 @@ function axes_x_tick_rotate() {
|
||||
}
|
||||
|
||||
function axes_y_tick_format() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 2500]
|
||||
@@ -1008,7 +1008,7 @@ function axes_y_tick_format() {
|
||||
}
|
||||
|
||||
function axes_y_padding() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1032,7 +1032,7 @@ function axes_y_padding() {
|
||||
}
|
||||
|
||||
function axes_y_range() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250]
|
||||
@@ -1050,7 +1050,7 @@ function axes_y_range() {
|
||||
}
|
||||
|
||||
function axes_label() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1076,7 +1076,7 @@ function axes_label() {
|
||||
}
|
||||
|
||||
function axes_label_position() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1134,7 +1134,7 @@ function axes_label_position() {
|
||||
///////////////////
|
||||
|
||||
function data_columned() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 20, 50, 40, 60, 50],
|
||||
@@ -1146,7 +1146,7 @@ function data_columned() {
|
||||
}
|
||||
|
||||
function data_rowed() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
rows: [
|
||||
["data1", "data2", "data3"],
|
||||
@@ -1210,7 +1210,7 @@ function data_json() {
|
||||
}
|
||||
|
||||
function data_url() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
url: "/data/c3_test.csv"
|
||||
}
|
||||
@@ -1227,7 +1227,7 @@ function data_url() {
|
||||
}
|
||||
|
||||
function data_stringx() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -1294,7 +1294,7 @@ function data_stringx() {
|
||||
}
|
||||
|
||||
function data_load() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
url: "/data/c3_test.csv",
|
||||
type: "line"
|
||||
@@ -1397,7 +1397,7 @@ function data_load() {
|
||||
}
|
||||
|
||||
function data_name() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1412,7 +1412,7 @@ function data_name() {
|
||||
}
|
||||
|
||||
function data_color() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 20, 50, 40, 60, 50],
|
||||
@@ -1434,7 +1434,7 @@ function data_color() {
|
||||
}
|
||||
|
||||
function data_order() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 130, 200, 320, 400, 530, 750],
|
||||
@@ -1478,7 +1478,7 @@ function data_order() {
|
||||
}
|
||||
|
||||
function data_label() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, -200, -100, 400, 150, 250],
|
||||
@@ -1500,7 +1500,7 @@ function data_label() {
|
||||
}
|
||||
|
||||
function data_label_format() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, -200, -100, 400, 150, 250],
|
||||
@@ -1532,7 +1532,7 @@ function data_label_format() {
|
||||
///////////////////
|
||||
|
||||
function options_gridline() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250, 120, 200]
|
||||
@@ -1550,7 +1550,7 @@ function options_gridline() {
|
||||
}
|
||||
|
||||
function grid_x_lines() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250]
|
||||
@@ -1569,7 +1569,7 @@ function grid_x_lines() {
|
||||
}
|
||||
|
||||
function grid_y_lines() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1601,7 +1601,7 @@ function grid_y_lines() {
|
||||
///////////////////
|
||||
|
||||
function region() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250, 400],
|
||||
@@ -1631,7 +1631,7 @@ function region() {
|
||||
}
|
||||
|
||||
function region_timeseries() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "date",
|
||||
columns: [
|
||||
@@ -1657,7 +1657,7 @@ function region_timeseries() {
|
||||
/////////////////////
|
||||
|
||||
function options_subchart() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250]
|
||||
@@ -1670,7 +1670,7 @@ function options_subchart() {
|
||||
}
|
||||
|
||||
function interaction_zoom() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 150, 250, 150, 200, 170, 240, 100, 150, 250, 150, 200, 170, 240, 30, 200, 100, 400, 150, 250, 150,
|
||||
@@ -1688,7 +1688,7 @@ function interaction_zoom() {
|
||||
/////////////////////
|
||||
|
||||
function options_legend() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250]
|
||||
@@ -1701,7 +1701,7 @@ function options_legend() {
|
||||
}
|
||||
|
||||
function legend_position() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1737,7 +1737,7 @@ function legend_position() {
|
||||
}
|
||||
|
||||
function legend_custom() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 100],
|
||||
@@ -1781,7 +1781,7 @@ function legend_custom() {
|
||||
/////////////////////
|
||||
|
||||
function tooltip_show() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1795,7 +1795,7 @@ function tooltip_show() {
|
||||
}
|
||||
|
||||
function tooltip_grouped() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1810,7 +1810,7 @@ function tooltip_grouped() {
|
||||
}
|
||||
|
||||
function tooltip_format() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30000, 20000, 10000, 40000, 15000, 250000],
|
||||
@@ -1837,7 +1837,7 @@ function tooltip_format() {
|
||||
format: {
|
||||
title: (d: any) => "Data " + d,
|
||||
value: (value: any, ratio: any, id: any) => {
|
||||
let format = id === "data1" ? d3.format(",") : d3.format("$");
|
||||
const format = id === "data1" ? d3.format(",") : d3.format("$");
|
||||
return format(value);
|
||||
}
|
||||
// value: d3.format(",") // apply this format to both y and y2
|
||||
@@ -1851,7 +1851,7 @@ function tooltip_format() {
|
||||
////////////////////////
|
||||
|
||||
function options_size() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
size: {
|
||||
height: 240,
|
||||
width: 480
|
||||
@@ -1865,7 +1865,7 @@ function options_size() {
|
||||
}
|
||||
|
||||
function options_padding() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
padding: {
|
||||
top: 40,
|
||||
right: 100,
|
||||
@@ -1881,7 +1881,7 @@ function options_padding() {
|
||||
}
|
||||
|
||||
function options_color() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1900,7 +1900,7 @@ function options_color() {
|
||||
}
|
||||
|
||||
function transition_duration() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
url: "/data/c3_test.csv"
|
||||
},
|
||||
@@ -1953,7 +1953,7 @@ function transition_duration() {
|
||||
/////////////////////////////
|
||||
|
||||
function point_show() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -1971,7 +1971,7 @@ function point_show() {
|
||||
////////////////////////////
|
||||
|
||||
function pie_label_format() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30],
|
||||
@@ -1994,7 +1994,7 @@ function pie_label_format() {
|
||||
/////////////////////
|
||||
|
||||
function api_flow() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
x: "x",
|
||||
columns: [
|
||||
@@ -2064,7 +2064,7 @@ function api_flow() {
|
||||
}
|
||||
|
||||
function api_data_name() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2087,7 +2087,7 @@ function api_data_name() {
|
||||
}
|
||||
|
||||
function api_data_color() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 20, 50, 40, 60, 50],
|
||||
@@ -2122,7 +2122,7 @@ function api_data_color() {
|
||||
}
|
||||
|
||||
function api_axis_label() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2154,7 +2154,7 @@ function api_axis_label() {
|
||||
}
|
||||
|
||||
function api_axis_range() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2210,7 +2210,7 @@ function api_axis_range() {
|
||||
}
|
||||
|
||||
function api_resize() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2233,7 +2233,7 @@ function api_resize() {
|
||||
}
|
||||
|
||||
function api_grid_x() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
bindto: "#chart",
|
||||
data: {
|
||||
columns: [
|
||||
@@ -2276,7 +2276,7 @@ function api_grid_x() {
|
||||
/////////////////////
|
||||
|
||||
function transform_line() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2304,7 +2304,7 @@ function transform_line() {
|
||||
}
|
||||
|
||||
function transform_spline() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2332,7 +2332,7 @@ function transform_spline() {
|
||||
}
|
||||
|
||||
function transform_bar() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2360,7 +2360,7 @@ function transform_bar() {
|
||||
}
|
||||
|
||||
function transform_area() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2388,7 +2388,7 @@ function transform_area() {
|
||||
}
|
||||
|
||||
function transform_areaspline() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2416,7 +2416,7 @@ function transform_areaspline() {
|
||||
}
|
||||
|
||||
function transform_scatter() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
xs: {
|
||||
setosa: "setosa_x",
|
||||
@@ -2462,7 +2462,7 @@ function transform_scatter() {
|
||||
}
|
||||
|
||||
function transform_pie() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2485,7 +2485,7 @@ function transform_pie() {
|
||||
}
|
||||
|
||||
function transform_donut() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 30, 200, 100, 400, 150, 250],
|
||||
@@ -2516,7 +2516,7 @@ function transform_donut() {
|
||||
/////////////////////
|
||||
|
||||
function style_region() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["sample", 30, 200, 100, 400, 150, 250]
|
||||
@@ -2530,7 +2530,7 @@ function style_region() {
|
||||
}
|
||||
|
||||
function style_grid() {
|
||||
let chart = c3.generate({
|
||||
const chart = c3.generate({
|
||||
data: {
|
||||
columns: [
|
||||
["data1", 100, 200, 1000, 900, 500]
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for nodejs-driver v0.8.2
|
||||
// Project: https://github.com/datastax/nodejs-driver
|
||||
// Definitions by: Marc Fisher <http://github.com/Svjard>
|
||||
// Definitions by: Marc Fisher <https://github.com/Svjard>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for catbox 7.1
|
||||
// Project: https://github.com/hapijs/catbox
|
||||
// Definitions by: Jason Swearingen <http://github.com/jasonswearingen>, AJP <https://github.com/AJamesPhillips>
|
||||
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen>, AJP <https://github.com/AJamesPhillips>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ chai.use(ChaiArrays);
|
||||
chai.should();
|
||||
|
||||
const arr: any[] = [1, 2, 3];
|
||||
const str: string = 'abcdef';
|
||||
const str = 'abcdef';
|
||||
|
||||
const otherArr: number[] = [1, 2, 3];
|
||||
const anotherArr: number[] = [2, 4];
|
||||
|
||||
@@ -13,7 +13,7 @@ if (!global.Promise) {
|
||||
chai.request.addPromises(when.promise);
|
||||
}
|
||||
|
||||
let app: http.Server;
|
||||
declare const app: http.Server;
|
||||
|
||||
chai.request(app).get('/');
|
||||
chai.request('http://localhost:8080').get('/');
|
||||
@@ -55,7 +55,7 @@ chai.request(app)
|
||||
.then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200))
|
||||
.catch((err: any) => { throw err; });
|
||||
|
||||
let agent = chai.request.agent(app);
|
||||
const agent = chai.request.agent(app);
|
||||
|
||||
agent
|
||||
.post('/session')
|
||||
@@ -69,7 +69,7 @@ agent
|
||||
});
|
||||
|
||||
function test1() {
|
||||
let req = chai.request(app).get('/');
|
||||
const req = chai.request(app).get('/');
|
||||
req.then((res: ChaiHttp.Response) => {
|
||||
chai.expect(res).to.have.status(200);
|
||||
chai.expect(res).to.have.header('content-type', 'text/plain');
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Chart, ChartData } from 'chart.js';
|
||||
// import chartjs = require('chart.js');
|
||||
// => chartjs.Chart
|
||||
|
||||
let chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
type: 'bar',
|
||||
data: <ChartData> {
|
||||
labels: ['group 1'],
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Test file for chayns typings
|
||||
|
||||
chayns.register({
|
||||
strictMode: false,
|
||||
appName: 'chayns-typings-test'
|
||||
});
|
||||
|
||||
chayns.ready.then(data => {
|
||||
return data;
|
||||
}).catch(err => {
|
||||
return err;
|
||||
});
|
||||
|
||||
chayns.dialog.alert('chayns-typings', 'Test chayns-typings!');
|
||||
Vendored
+938
@@ -0,0 +1,938 @@
|
||||
// Type definitions for chayns 3.1
|
||||
// Project: https://github.com/TobitSoftware/chayns-js
|
||||
// Definitions by: Henning Kuehl <https://github.com/HenningKuehl>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/**
|
||||
* Definition file for chayns v3.1
|
||||
*/
|
||||
declare namespace chayns {
|
||||
/**
|
||||
* Getting Started
|
||||
* chayns
|
||||
*
|
||||
*/
|
||||
let ready: Promise<any>;
|
||||
|
||||
function register(config: RegisterConfig): void;
|
||||
|
||||
/**
|
||||
* Basic Functions
|
||||
* chayns
|
||||
*/
|
||||
function login(parameters?: string[]): Promise<any>;
|
||||
|
||||
function getUser(config: GetUserConfig): Promise<User>;
|
||||
|
||||
function getUacGroups(siteId: number, updateCache?: boolean): Promise<UacGroup[]>;
|
||||
|
||||
function startInteractionIdentification(config: InteractionIdentificationConfig): Promise<any>;
|
||||
|
||||
function stopInteractionIdentification(): Promise<any>;
|
||||
|
||||
function allowRefreshScroll(): Promise<any>;
|
||||
|
||||
function disallowRefreshScroll(): Promise<any>;
|
||||
|
||||
function showTitleImage(): Promise<any>;
|
||||
|
||||
function hideTitleImage(): Promise<any>;
|
||||
|
||||
function setOnActivateCallback(callback: (tappEvent: number) => any): Promise<any>;
|
||||
|
||||
function setNetworkChangeCallback(callback: (result: NetworkChangeResult) => any, ongoing: boolean): Promise<any>;
|
||||
|
||||
function setNfcCallback(callback: (rfid: string) => any): Promise<any>;
|
||||
|
||||
function removeNfcCallback(): Promise<any>;
|
||||
|
||||
function startNfcDetection(callback: (result: NfcDetectionResult) => any, interval: number, vibrate: boolean): Promise<any>;
|
||||
|
||||
function stopNfcDetection(): Promise<any>;
|
||||
|
||||
function scanQRCode(cameryType?: number, timeout?: number): Promise<any>; // TODO interface for promise result
|
||||
|
||||
function createQRCode(text: string): Promise<string>;
|
||||
|
||||
function showFinetradingQRCode(): Promise<any>;
|
||||
|
||||
function selectTapp(tapp: SelectTappConfig, parameter?: string[]): Promise<any>;
|
||||
|
||||
function openUrl(config: OpenUrlConfig): void;
|
||||
|
||||
function closeUrl(): void;
|
||||
|
||||
function openUrlInBrowser(url: string): void;
|
||||
|
||||
function getGeoLocation(): Promise<GeoLocationResult>;
|
||||
|
||||
function getLocationBeacons(forceReload: boolean): Promise<LocationBeacon[]>;
|
||||
|
||||
function getBeaconHistory(subNumber?: number): Promise<BeaconHistory[]>;
|
||||
|
||||
function getBaseColor(color?: string, colorMode?: number): string;
|
||||
|
||||
function share(config: ShareConfig): Promise<any>; // TODO interface for promise result
|
||||
|
||||
function getAvailableSharingServices(): Promise<number[]>;
|
||||
|
||||
function navigateBack(): Promise<any>;
|
||||
|
||||
function updateNavigation(tappId?: number, config?: UpdateNavigationConfig): Promise<any>;
|
||||
|
||||
function enableDisplayTimeout(): Promise<any>;
|
||||
|
||||
function disableDisplayTimeout(): Promise<any>;
|
||||
|
||||
function setSpeechToText(callback: (result: SpeechToTextResult) => any, title?: string): Promise<any>;
|
||||
|
||||
function createTappShortcut(name: string, imageUrl: string): Promise<any>;
|
||||
|
||||
function setSubTapp(config: SubTappConfig): void;
|
||||
|
||||
function removeSubTapp(config: RemoveSubTappConfig): void;
|
||||
|
||||
function vibrate(ms: number[]): Promise<any>;
|
||||
|
||||
function setHeight(config: SetHeightConfig): Promise<any>;
|
||||
|
||||
function scrollToY(position: number): Promise<any>;
|
||||
|
||||
function addToWallet(passbook: string): Promise<any>; // TODO check passbock parameter
|
||||
|
||||
function addScrollListener(callback: (data: any) => any, throttle?: number): Promise<any>; // TODO interface for callback data
|
||||
|
||||
function setScreenOrientation(orientation: number): Promise<any>;
|
||||
|
||||
function findSite(name: string, skip?: number, take?: number): Promise<Site[]>;
|
||||
|
||||
/**
|
||||
* UI Functions
|
||||
* Waitcursor
|
||||
* chayns
|
||||
*/
|
||||
function showWaitCursor(text?: string, timeout?: number): Promise<any>;
|
||||
|
||||
function hideWaitCursor(): Promise<any>;
|
||||
|
||||
/**
|
||||
* UI Functions
|
||||
* Floating Button
|
||||
* chayns
|
||||
*/
|
||||
function showFloatingButton(config: FloatingConfig, callback: () => any): void;
|
||||
|
||||
function hideFloatingButton(): void;
|
||||
|
||||
/**
|
||||
* Media Functions
|
||||
* Image
|
||||
* chayns
|
||||
*/
|
||||
function openImage(urls: string[], start?: number): Promise<any>;
|
||||
|
||||
function uploadImage(): Promise<string>;
|
||||
|
||||
/**
|
||||
* Media Functions
|
||||
* Miscellaneous
|
||||
* chayns
|
||||
*/
|
||||
function openVideo(url: string): Promise<any>;
|
||||
|
||||
function saveAppointment(config: SaveAppointmentConfig): Promise<any>;
|
||||
|
||||
function playSound(url: string, playOnMute?: boolean): Promise<any>;
|
||||
|
||||
function addErrorListener(logFn: (error: any) => Promise<{}>, appName: string): void;
|
||||
|
||||
function getGlobalData(): GlobalData;
|
||||
|
||||
/**
|
||||
* chayns.smartShop
|
||||
*/
|
||||
let smartShop: any;
|
||||
|
||||
/**
|
||||
* Basic Functions
|
||||
* chayns.intercom
|
||||
*/
|
||||
namespace intercom {
|
||||
function sendMessageToUser(userId: number, config: IntercomConfig): Promise<any>; // TODO set interface for promise result
|
||||
|
||||
function sendMessageToGroup(groupId: number, config: IntercomConfig): Promise<any>; // TODO set interface for promise result
|
||||
|
||||
function sendMessageToPage(config: IntercomConfig): Promise<any>; // TODO set interface for promise result
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic Functions
|
||||
* chayns.passKit
|
||||
*/
|
||||
namespace passKit {
|
||||
function getInstalled(): Promise<any>; // TODO interface for promise result
|
||||
|
||||
function isInstalled(identifier: string): Promise<any>; // TODO interface for promise result
|
||||
}
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env
|
||||
*/
|
||||
namespace env {
|
||||
let _parameters: any;
|
||||
|
||||
let parameters: any;
|
||||
|
||||
let isBrowser: boolean;
|
||||
|
||||
let isChaynsWeb: boolean;
|
||||
|
||||
let isChaynsWebDesktop: boolean;
|
||||
|
||||
let isChaynsWebMobile: boolean;
|
||||
|
||||
let isDesktop: boolean;
|
||||
|
||||
let isMobile: boolean;
|
||||
|
||||
let isApp: boolean;
|
||||
|
||||
let isIOS: boolean;
|
||||
|
||||
let isAndroid: boolean;
|
||||
|
||||
let isTablet: boolean;
|
||||
|
||||
let isWP: boolean;
|
||||
|
||||
let appVersion: number;
|
||||
|
||||
let os: string;
|
||||
|
||||
let apiVersion: number;
|
||||
|
||||
let debugMode: boolean;
|
||||
|
||||
let isChaynsParent: boolean;
|
||||
|
||||
let isChaynsWebLight: boolean;
|
||||
|
||||
let isInFacebookFrame: boolean;
|
||||
|
||||
let isInFrame: boolean;
|
||||
|
||||
let isWidget: boolean;
|
||||
|
||||
let language: string;
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env.user
|
||||
*/
|
||||
namespace user {
|
||||
let tobitAccessToken: string;
|
||||
|
||||
let facebookAccessToken: string;
|
||||
|
||||
let facebookId: string;
|
||||
|
||||
let id: number;
|
||||
|
||||
let name: string;
|
||||
|
||||
let personId: string;
|
||||
|
||||
let isAuthenticated: boolean;
|
||||
|
||||
let language: string;
|
||||
|
||||
let groups: UserGroup[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env.site
|
||||
*/
|
||||
namespace site {
|
||||
let color: string;
|
||||
|
||||
let colorMode: number;
|
||||
|
||||
let colorScheme: number;
|
||||
|
||||
let domain: string;
|
||||
|
||||
let facebookAppId: string;
|
||||
|
||||
let facebookPageId: string;
|
||||
|
||||
let id: string;
|
||||
|
||||
let isAdEnabled: boolean;
|
||||
|
||||
let isArEnabled: boolean;
|
||||
|
||||
let language: string;
|
||||
|
||||
let locationId: number;
|
||||
|
||||
let locationPersonId: string;
|
||||
|
||||
let tapps: SiteTapp[];
|
||||
|
||||
let title: string;
|
||||
|
||||
let url: string;
|
||||
|
||||
let version: string;
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env.site.tapp
|
||||
*/
|
||||
namespace tapp {
|
||||
let customUrl: string;
|
||||
|
||||
let id: number;
|
||||
|
||||
let internalName: string;
|
||||
|
||||
let isExclusiveView: boolean;
|
||||
|
||||
let isKioskMode: boolean;
|
||||
|
||||
let isSubTapp: boolean;
|
||||
|
||||
let showName: string;
|
||||
|
||||
let sortId: number;
|
||||
|
||||
let userGroupIds: number[];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env.app
|
||||
*/
|
||||
namespace app {
|
||||
let flavor: string;
|
||||
|
||||
let languageId: string;
|
||||
|
||||
let model: string;
|
||||
|
||||
let name: string;
|
||||
|
||||
let uid: string;
|
||||
|
||||
let version: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env.device
|
||||
*/
|
||||
namespace device {
|
||||
let fontScale: any;
|
||||
|
||||
let imei: string;
|
||||
|
||||
let languageId: string;
|
||||
|
||||
let model: string;
|
||||
|
||||
let systemName: string;
|
||||
|
||||
let systemVersion: number;
|
||||
|
||||
let uid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Environmental Variables
|
||||
* chayns.env.browser
|
||||
*/
|
||||
namespace browser {
|
||||
let name: string;
|
||||
|
||||
let version: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UI Functions
|
||||
* chayns.dialog
|
||||
*/
|
||||
namespace dialog {
|
||||
enum buttonType {
|
||||
CANCEL = -1,
|
||||
NEGATIVE = 0,
|
||||
POSITIVE = 1
|
||||
}
|
||||
|
||||
enum buttonText {
|
||||
CANCEL = 'Abbrechen',
|
||||
NO = 'Nein',
|
||||
OK = 'OK',
|
||||
YES = 'Ja'
|
||||
}
|
||||
|
||||
enum dateType {
|
||||
DATE,
|
||||
TIME,
|
||||
DATE_TIME
|
||||
}
|
||||
|
||||
enum inputType {
|
||||
DEFAULT = 0,
|
||||
PASSWORD = 1
|
||||
}
|
||||
|
||||
function alert(title: string, message?: string): Promise<buttonType>;
|
||||
|
||||
function confirm(title: string, message?: string, buttons?: DialogButton[]): Promise<buttonType>;
|
||||
|
||||
function date(config: DialogDateConfig): Promise<DialogDateResult>;
|
||||
|
||||
function select(config: DialogSelectConfig): Promise<DialogSelectResult>;
|
||||
|
||||
function input(config: DialogInputConfig): Promise<DialogInputResult>;
|
||||
|
||||
function facebook(options: DialogFacebookOptions): Promise<DialogFacebookResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* chayns.ui
|
||||
*/
|
||||
namespace ui {
|
||||
/**
|
||||
* UI Functions
|
||||
* chayns.ui.modeSwitch
|
||||
*/
|
||||
namespace modeSwitch {
|
||||
function init(config: ModeSwitchConfig): void;
|
||||
|
||||
function addItem(item: ModeSwitchItem, index?: number): void;
|
||||
|
||||
function changeMode(item: number | ModeSwitchItem): void;
|
||||
|
||||
function remove(): void;
|
||||
|
||||
function add(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Media Functions
|
||||
* chayns.ui.gallery
|
||||
*/
|
||||
namespace gallery {
|
||||
function create(id: string, urls: string[]): void;
|
||||
|
||||
function setUrls(id: string, urls: string[]): void;
|
||||
|
||||
function getUrls(id: string): string[];
|
||||
|
||||
function addUrl(id: string, url: string): void;
|
||||
|
||||
function removeUrl(id: string, url: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* chayns.ui.tooltip
|
||||
*/
|
||||
namespace tooltip {
|
||||
function init(config: UiTooltipInitConfig, rootElement: any): Promise<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
* chayns.ui.slider
|
||||
*/
|
||||
namespace slider {
|
||||
function refreshTrack(): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility Functions
|
||||
* chayns.utils
|
||||
*/
|
||||
namespace utils {
|
||||
/**
|
||||
* Utility Functions
|
||||
* Check Types
|
||||
* chayns.utils
|
||||
*/
|
||||
function isHex(parameter: any, shorthand: boolean): boolean;
|
||||
|
||||
function isArray(parameter: any): boolean;
|
||||
|
||||
function isBLEAdress(parameter: any): boolean;
|
||||
|
||||
function isBlank(parameter: any): boolean;
|
||||
|
||||
function isDate(parameter: any): boolean;
|
||||
|
||||
function isDefined(parameter: any): boolean;
|
||||
|
||||
function isFormData(parameter: any): boolean;
|
||||
|
||||
function isFunction(parameter: any): boolean;
|
||||
|
||||
function isGUID(parameter: any): boolean;
|
||||
|
||||
function isMacAdress(parameter: any): boolean;
|
||||
|
||||
function isNumber(parameter: any): boolean;
|
||||
|
||||
function isObject(parameter: any): boolean;
|
||||
|
||||
function isPromise(parameter: any): boolean;
|
||||
|
||||
function isString(parameter: any): boolean;
|
||||
|
||||
function isUUID(parameter: any): boolean;
|
||||
|
||||
function isUndefined(parameter: any): boolean;
|
||||
|
||||
function isDeferred(parameter: any): boolean;
|
||||
|
||||
function isJwt(parameter: any): boolean;
|
||||
|
||||
function isUrl(parameter: any): boolean;
|
||||
|
||||
/**
|
||||
* Utility Functions
|
||||
* Miscellaneous
|
||||
* chayns.utils
|
||||
*/
|
||||
function getJwtPayload(token: string): JwtPaylod;
|
||||
|
||||
function mod(number: number, modulo: number): number;
|
||||
|
||||
function trim(test: string): string;
|
||||
|
||||
function replacePlaceholder(text: string, parameters: any[]): string; // TODO set interface for parameters
|
||||
|
||||
function mixColor(color1: string, color2: string, saturation: number): string;
|
||||
|
||||
function isPresent(parameter: any): boolean;
|
||||
|
||||
function setLevel(level: number): void;
|
||||
|
||||
/**
|
||||
* Utility Functions
|
||||
* Local Storage
|
||||
* chayns.utils.ls
|
||||
*/
|
||||
namespace ls {
|
||||
function set(key: string, value: string): void;
|
||||
|
||||
function get(key: string): string;
|
||||
|
||||
function remove(key: string): void;
|
||||
|
||||
function removeAll(): void;
|
||||
}
|
||||
|
||||
namespace lang {
|
||||
function init(config: any): void;
|
||||
|
||||
function renderTextStrings(): void;
|
||||
|
||||
function get(textString: string): string;
|
||||
|
||||
function translateDomStrings(): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* chayns.storage
|
||||
*/
|
||||
namespace storage {
|
||||
enum accessMode {
|
||||
PUBLIC,
|
||||
PROTECTED,
|
||||
PRIVATE
|
||||
}
|
||||
|
||||
function set(key: string, value: any, accessMode?: accessMode, tappIds?: number[]): Promise<any>;
|
||||
|
||||
function get(key: string, accessMode?: accessMode): any;
|
||||
|
||||
function remove(key: string, accessMode?: accessMode): Promise<any>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting Started
|
||||
* chayns
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.register()
|
||||
interface RegisterConfig {
|
||||
strictMode?: boolean;
|
||||
appName?: string;
|
||||
cssPrefix?: string;
|
||||
callbackPrefix?: string;
|
||||
initialHeight?: number;
|
||||
autoResize?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic Functions
|
||||
* chayns
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.getUser()
|
||||
interface GetUserConfig {
|
||||
accessToken?: string;
|
||||
userId?: number;
|
||||
fbId?: string;
|
||||
personId?: string;
|
||||
}
|
||||
|
||||
interface User {
|
||||
FacebookID: string;
|
||||
FirstName: string;
|
||||
LastName: string;
|
||||
PersonID: string;
|
||||
UserFullName: string;
|
||||
UserID: number;
|
||||
}
|
||||
|
||||
// chayns.getUacGroups()
|
||||
interface UacGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
showName: string;
|
||||
}
|
||||
|
||||
// chayns.startInteractionIdentification()
|
||||
interface InteractionIdentificationConfig {
|
||||
duration: number;
|
||||
delay?: number;
|
||||
callback: any;
|
||||
resetOnInteraction?: boolean;
|
||||
foregroundColor: string;
|
||||
backgroundColor?: string;
|
||||
}
|
||||
|
||||
// chayns.setNetworkChangeCallback()
|
||||
interface NetworkChangeResult {
|
||||
isConnected: boolean;
|
||||
type: number;
|
||||
}
|
||||
|
||||
// chayns.startNfcDetection()
|
||||
interface NfcDetectionResult {
|
||||
connected: boolean;
|
||||
rfid: string;
|
||||
}
|
||||
|
||||
// chayns.selectTapp()
|
||||
interface SelectTappConfig {
|
||||
id?: number;
|
||||
internalName?: string;
|
||||
showName?: string;
|
||||
position?: number;
|
||||
}
|
||||
|
||||
// chayns.openUrl()
|
||||
interface OpenUrlConfig {
|
||||
url: string;
|
||||
title?: string;
|
||||
exclusiveView?: boolean;
|
||||
darkenBackground?: boolean;
|
||||
fullSize?: boolean;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
// chayns.getGeoLocation()
|
||||
interface GeoLocationResult {
|
||||
longitude: number;
|
||||
latitude: number;
|
||||
}
|
||||
|
||||
// chayns.getLocationBeacons()
|
||||
interface LocationBeacon {
|
||||
id: number;
|
||||
pushMessage: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
}
|
||||
|
||||
// chayns.getBeaconHistory()
|
||||
interface BeaconHistory {
|
||||
id: number;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
// chayns.share()
|
||||
interface ShareConfig {
|
||||
title?: string;
|
||||
text: string;
|
||||
imageUrl?: string;
|
||||
sharingApp: number;
|
||||
sharingAndroidApp?: string;
|
||||
}
|
||||
|
||||
// chayns.updateNavigation()
|
||||
interface UpdateNavigationConfig {
|
||||
stateOnly?: boolean;
|
||||
updateTapp?: boolean;
|
||||
}
|
||||
|
||||
// chayns.setSpeecToText()
|
||||
interface SpeechToTextResult {
|
||||
languageCode: string;
|
||||
text: string[];
|
||||
}
|
||||
|
||||
// chayns.setSubTapp()
|
||||
interface SubTappConfig {
|
||||
tappID: number;
|
||||
name: string;
|
||||
color: string;
|
||||
colorText?: string;
|
||||
sortID: number;
|
||||
icon: string;
|
||||
callbackURL?(result: any): any;
|
||||
url: string;
|
||||
buttonName: string;
|
||||
isExclusiveView?: boolean;
|
||||
replaceParent?: boolean;
|
||||
boldText?: boolean;
|
||||
}
|
||||
|
||||
// chayns.removeSubTapp()
|
||||
interface RemoveSubTappConfig {
|
||||
tappID: number;
|
||||
close: boolean;
|
||||
remove: boolean;
|
||||
}
|
||||
|
||||
// chayns.setHeight()
|
||||
interface SetHeightConfig {
|
||||
height: number;
|
||||
growOnly?: boolean;
|
||||
full?: boolean;
|
||||
fullViewport?: boolean;
|
||||
}
|
||||
|
||||
// chayns.findSite()
|
||||
interface Site {
|
||||
appstoreName: string;
|
||||
facebookId: string;
|
||||
siteId: string;
|
||||
locationId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic Functions
|
||||
* chayns.intercom
|
||||
* interfaces
|
||||
*/
|
||||
interface IntercomConfig {
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UI Functions
|
||||
* chayns.dialog
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.dialog.confirm()
|
||||
interface DialogButton {
|
||||
text: string;
|
||||
buttonType: chayns.dialog.buttonType;
|
||||
}
|
||||
|
||||
// chayns.dialog.date()
|
||||
interface DialogDateConfig {
|
||||
dateType: chayns.dialog.dateType;
|
||||
preSelect?: Date;
|
||||
minDate?: Date;
|
||||
maxDate?: Date;
|
||||
}
|
||||
|
||||
interface DialogDateResult {
|
||||
timestamp: number;
|
||||
buttonType: chayns.dialog.buttonType;
|
||||
}
|
||||
|
||||
// chayns.dialog.select()
|
||||
interface DialogSelectConfig {
|
||||
title: string;
|
||||
message?: string;
|
||||
quickfind?: boolean;
|
||||
multiselect?: boolean;
|
||||
buttons?: any[]; // TODO interface for buttons
|
||||
list: DialogSelectConfigItem[];
|
||||
}
|
||||
|
||||
interface DialogSelectConfigItem {
|
||||
name: string;
|
||||
value?: string;
|
||||
image?: string;
|
||||
isSelected?: boolean;
|
||||
}
|
||||
|
||||
interface DialogSelectResult {
|
||||
buttonType: chayns.dialog.buttonType;
|
||||
selection: DialogSelectResultItem[];
|
||||
}
|
||||
|
||||
interface DialogSelectResultItem {
|
||||
name: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
// chayns.dialog.input()
|
||||
interface DialogInputConfig {
|
||||
title: string;
|
||||
message?: string;
|
||||
placeholderText?: string;
|
||||
text?: string;
|
||||
buttons?: DialogButton[];
|
||||
}
|
||||
|
||||
interface DialogInputResult {
|
||||
buttonType: chayns.dialog.buttonType;
|
||||
text: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* UI Functions
|
||||
* chayns.ui.modeswitch
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.ui.modeswitch.init()
|
||||
interface ModeSwitchConfig {
|
||||
items: ModeSwitchItem[];
|
||||
callback(result: ModeSwitchItem): void;
|
||||
headline?: string;
|
||||
preventclose?: boolean;
|
||||
}
|
||||
|
||||
interface ModeSwitchItem {
|
||||
name: string;
|
||||
value: number;
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* UI Functions
|
||||
* Floating Button
|
||||
* chayns
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.showFloatingButton()
|
||||
interface FloatingConfig {
|
||||
text?: string;
|
||||
color?: string;
|
||||
colorText?: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Media Functions
|
||||
* Miscellaneous
|
||||
* chayns
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.saveAppointment()
|
||||
interface SaveAppointmentConfig {
|
||||
name: string;
|
||||
location: string;
|
||||
description: string;
|
||||
start: Date;
|
||||
end: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility Functions
|
||||
* Miscellaneous
|
||||
* chayns.utils
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.utils.getJwtPayload()
|
||||
interface JwtPaylod {
|
||||
FacebookUserID: string;
|
||||
FirstName: string;
|
||||
LastName: string;
|
||||
PersonID: string;
|
||||
LocationID: number;
|
||||
TobitUserID: number;
|
||||
LoginType: number;
|
||||
isAdmin: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enviroment Variables
|
||||
* User
|
||||
* interfaces
|
||||
*/
|
||||
// chayns.env.user.groups
|
||||
interface UserGroup {
|
||||
id: number;
|
||||
isActive?: boolean;
|
||||
isSystemGroup?: boolean;
|
||||
name: string;
|
||||
showName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enviroment Variables
|
||||
* Site
|
||||
* interfaces
|
||||
*/
|
||||
interface SiteTapp {
|
||||
customUrl: string;
|
||||
id: number;
|
||||
internalName: string;
|
||||
isExclusiveView: boolean;
|
||||
isKioskMode: boolean;
|
||||
isSubTapp: boolean;
|
||||
showName: string;
|
||||
sortId: number;
|
||||
userGroupIds: number[];
|
||||
}
|
||||
|
||||
interface GlobalData {
|
||||
_result: any;
|
||||
}
|
||||
|
||||
interface DialogFacebookOptions {
|
||||
title: string;
|
||||
message?: string;
|
||||
quickfind?: number;
|
||||
multiselect?: number;
|
||||
button?: DialogFacebookButton[];
|
||||
preSelected: number[]; // TODO: Verify type
|
||||
}
|
||||
|
||||
interface DialogFacebookButton {
|
||||
text: string;
|
||||
value: number; // TODO: Verify type
|
||||
}
|
||||
|
||||
interface DialogFacebookResult {
|
||||
buttonType: number;
|
||||
selection: DialogFacebookResultSelection[];
|
||||
}
|
||||
|
||||
interface DialogFacebookResultSelection {
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
id: string;
|
||||
gender: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface UiTooltipInitConfig {
|
||||
tooltipClass: string;
|
||||
preventAnimation: boolean;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chayns-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-4
@@ -1,5 +1,3 @@
|
||||
export type ClassNamesFn = (
|
||||
...args: Array<string | string[] | Record<string, boolean | undefined | null>>
|
||||
) => string;
|
||||
import * as cn from "./index";
|
||||
|
||||
export function bind(styles: Record<string, string>): ClassNamesFn;
|
||||
export function bind(styles: Record<string, string>): typeof cn;
|
||||
|
||||
@@ -35,3 +35,6 @@ const styles = {
|
||||
|
||||
const cx = cn.bind(styles);
|
||||
const className = cx('foo', ['bar'], { baz: true }); // => "abc def xyz"
|
||||
|
||||
// falsey values are just ignored
|
||||
cx(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as express from "express";
|
||||
import * as session from "client-sessions";
|
||||
import express = require("express");
|
||||
import session = require("client-sessions");
|
||||
|
||||
const secret = "yolo";
|
||||
const app = express();
|
||||
|
||||
Vendored
+19
-14
@@ -1,6 +1,7 @@
|
||||
// Type definitions for CodeMirror
|
||||
// Project: https://github.com/marijnh/CodeMirror
|
||||
// Definitions by: mihailik <https://github.com/mihailik>
|
||||
// nrbernard <https://github.com/nrbernard>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = CodeMirror;
|
||||
@@ -104,6 +105,19 @@ declare namespace CodeMirror {
|
||||
|
||||
type DOMEvent = 'mousedown' | 'dblclick' | 'touchstart' | 'contextmenu' | 'keydown' | 'keypress' | 'keyup' | 'cut' | 'copy' | 'paste' | 'dragstart' | 'dragenter' | 'dragover' | 'dragleave' | 'drop';
|
||||
|
||||
interface Token {
|
||||
/** The character(on the given line) at which the token starts. */
|
||||
start: number;
|
||||
/** The character at which the token ends. */
|
||||
end: number;
|
||||
/** The token's string. */
|
||||
string: string;
|
||||
/** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */
|
||||
type: string | null;
|
||||
/** The mode's state at the end of this token. */
|
||||
state: any;
|
||||
}
|
||||
|
||||
interface Editor {
|
||||
|
||||
/** Tells you whether the editor currently has focus. */
|
||||
@@ -289,20 +303,11 @@ declare namespace CodeMirror {
|
||||
you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */
|
||||
refresh(): void;
|
||||
|
||||
|
||||
/** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */
|
||||
getTokenAt(pos: CodeMirror.Position): {
|
||||
/** The character(on the given line) at which the token starts. */
|
||||
start: number;
|
||||
/** The character at which the token ends. */
|
||||
end: number;
|
||||
/** The token's string. */
|
||||
string: string;
|
||||
/** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */
|
||||
type: string | null;
|
||||
/** The mode's state at the end of this token. */
|
||||
state: any;
|
||||
};
|
||||
getTokenAt(pos: CodeMirror.Position): Token;
|
||||
|
||||
/** This is similar to getTokenAt, but collects all tokens for a given line into an array. */
|
||||
getLineTokens(line: number, precise?: boolean): Token[];
|
||||
|
||||
/** Returns the mode's parser state, if any, at the end of the given line number.
|
||||
If no line number is given, the state at the end of the document is returned.
|
||||
@@ -410,7 +415,7 @@ declare namespace CodeMirror {
|
||||
/** Fires when one of the DOM events fires. */
|
||||
on(eventName: DOMEvent, handler: (instance: CodeMirror.Editor, event: Event) => void ): void;
|
||||
off(eventName: DOMEvent, handler: (instance: CodeMirror.Editor, event: Event) => void ): void;
|
||||
|
||||
|
||||
/** Expose the state object, so that the Editor.state.completionActive property is reachable*/
|
||||
state: any;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as color from 'color-convert';
|
||||
import * as conv from 'color-convert/conversions';
|
||||
|
||||
let hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]);
|
||||
let hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]);
|
||||
let aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]);
|
||||
const hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]);
|
||||
const hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]);
|
||||
const aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]);
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for commander 2.9
|
||||
// Project: https://github.com/visionmedia/commander.js
|
||||
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <http://github.com/mdezem>, vvakame <http://github.com/vvakame>
|
||||
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
@@ -26,18 +26,18 @@ function logNode(node: commonmark.Node) {
|
||||
const parser = new commonmark.Parser({ smart: true, time: true });
|
||||
const node = parser.parse('# a piece of _markdown_');
|
||||
|
||||
let w = node.walker();
|
||||
let step = w.next();
|
||||
const w = node.walker();
|
||||
const step = w.next();
|
||||
if (step.entering) {
|
||||
logNode(step.node);
|
||||
}
|
||||
|
||||
let xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true });
|
||||
let xml = xmlRenderer.render(node);
|
||||
const xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true });
|
||||
const xml = xmlRenderer.render(node);
|
||||
console.log(xml);
|
||||
|
||||
let htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true });
|
||||
let html = htmlRenderer.render(node);
|
||||
const htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true });
|
||||
const html = htmlRenderer.render(node);
|
||||
console.log(html);
|
||||
|
||||
function basic_usage() {
|
||||
|
||||
@@ -3,7 +3,7 @@ import concat = require("concat-stream");
|
||||
import { Readable } from "stream";
|
||||
|
||||
class MyReadable extends Readable {
|
||||
i: number = 1;
|
||||
i = 1;
|
||||
_read() {
|
||||
if (this.i <= 100) {
|
||||
this.push(this.i.toString());
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import contentType = require('content-type');
|
||||
import express = require('express');
|
||||
/// <reference types="node" />
|
||||
|
||||
let obj = contentType.parse('image/svg+xml; charset=utf-8');
|
||||
import * as contentType from 'content-type';
|
||||
import * as http from 'http';
|
||||
|
||||
console.log(obj.type); // => 'image/svg+xml'
|
||||
console.log(obj.parameters.charset); // => 'utf-8'
|
||||
const mediaType = contentType.parse('image/svg+xml; charset=utf-8');
|
||||
mediaType; // $ExpectType ParsedMediaType
|
||||
mediaType.type; // $ExpectType string
|
||||
mediaType.parameters; // $ExpectType { [key: string]: string; }
|
||||
|
||||
let req: express.Request;
|
||||
obj = contentType.parse(req);
|
||||
http.createServer((req, res) => {
|
||||
contentType.parse(req);
|
||||
contentType.parse(res);
|
||||
});
|
||||
|
||||
let res: express.Response;
|
||||
obj = contentType.parse(res);
|
||||
|
||||
let str: string = contentType.format({type: 'image/svg+xml'});
|
||||
|
||||
let media: contentType.MediaType;
|
||||
contentType.format(media);
|
||||
// $ExpectType string
|
||||
contentType.format({type: 'image/svg+xml'});
|
||||
contentType.format({type: 'image/svg+xml', parameters: {charset: 'utf-8'}});
|
||||
contentType.format(mediaType);
|
||||
|
||||
Vendored
+17
-12
@@ -1,21 +1,26 @@
|
||||
// Type definitions for content-type 1.1
|
||||
// Project: https://www.npmjs.com/package/content-type
|
||||
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
import * as express from 'express';
|
||||
export function parse(input: RequestLike | ResponseLike | string): ParsedMediaType;
|
||||
export function format(obj: MediaType): string;
|
||||
|
||||
declare var ct: ct.StaticFunctions;
|
||||
export = ct;
|
||||
export interface ParsedMediaType {
|
||||
type: string;
|
||||
parameters: {[key: string]: string};
|
||||
}
|
||||
|
||||
declare namespace ct {
|
||||
interface StaticFunctions {
|
||||
parse(input: express.Request | express.Response | string): MediaType;
|
||||
format(obj: MediaType): string;
|
||||
}
|
||||
export interface MediaType {
|
||||
type: string;
|
||||
parameters?: {[key: string]: string};
|
||||
}
|
||||
|
||||
interface MediaType {
|
||||
type: string;
|
||||
parameters?: any;
|
||||
}
|
||||
export interface RequestLike {
|
||||
headers: {[header: string]: string | string[]};
|
||||
}
|
||||
|
||||
export interface ResponseLike {
|
||||
getHeader(name: string): number | string | string[] | undefined;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"content-type-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ function test(topic: string, callback: (t: Test) => any) {
|
||||
test("asynchronously propagating state with local-context-domains", function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var namespace = cls.createNamespace('namespace');
|
||||
const namespace = cls.createNamespace('namespace');
|
||||
// t.ok(process.namespaces.namespace, "namespace has been created");
|
||||
|
||||
namespace.run(function () {
|
||||
@@ -39,7 +39,7 @@ test("minimized test case that caused #6011 patch to fail", function (t) {
|
||||
// when the flaw was in the patch, commenting out this line would fix things:
|
||||
process.nextTick(function () { console.log('!'); });
|
||||
|
||||
var n = cls.createNamespace("test");
|
||||
const n = cls.createNamespace("test");
|
||||
t.ok(!n.get('state'), "state should not yet be visible");
|
||||
|
||||
n.run(function () {
|
||||
@@ -59,7 +59,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("handler registered in context, emit out of context", function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var n = cls.createNamespace('in')
|
||||
const n = cls.createNamespace('in')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -78,7 +78,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("once handler registered in context", function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var n = cls.createNamespace('inOnce')
|
||||
const n = cls.createNamespace('inOnce')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -97,7 +97,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("handler registered out of context, emit in context", function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var n = cls.createNamespace('out')
|
||||
const n = cls.createNamespace('out')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -117,7 +117,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("once handler registered out of context", function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var n = cls.createNamespace('outOnce')
|
||||
const n = cls.createNamespace('outOnce')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -137,7 +137,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("handler registered out of context, emit out of context", function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var n = cls.createNamespace('out')
|
||||
const n = cls.createNamespace('out')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -155,12 +155,12 @@ test("event emitters bound to CLS context", function (t) {
|
||||
});
|
||||
|
||||
t.test("once handler registered out of context on Readable", function (t) {
|
||||
var Readable = require('stream').Readable;
|
||||
const Readable = require('stream').Readable;
|
||||
|
||||
if (Readable) {
|
||||
t.plan(12);
|
||||
|
||||
var n = cls.createNamespace('outOnceReadable')
|
||||
const n = cls.createNamespace('outOnceReadable')
|
||||
, re = new Readable()
|
||||
;
|
||||
|
||||
@@ -203,7 +203,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("emitter with newListener that removes handler", function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var n = cls.createNamespace('newListener')
|
||||
const n = cls.createNamespace('newListener')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -239,12 +239,12 @@ test("event emitters bound to CLS context", function (t) {
|
||||
});
|
||||
|
||||
t.test("handler registered in context on Readable", function (t) {
|
||||
var Readable = require('stream').Readable;
|
||||
const Readable = require('stream').Readable;
|
||||
|
||||
if (Readable) {
|
||||
t.plan(12);
|
||||
|
||||
var n = cls.createNamespace('outOnReadable')
|
||||
const n = cls.createNamespace('outOnReadable')
|
||||
, re = new Readable()
|
||||
;
|
||||
|
||||
@@ -288,7 +288,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("handler added but used entirely out of context", function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var n = cls.createNamespace('none')
|
||||
const n = cls.createNamespace('none')
|
||||
, ee = new EventEmitter()
|
||||
;
|
||||
|
||||
@@ -309,12 +309,12 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("handler added but no listeners registered", function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var http = require('http')
|
||||
const http = require('http')
|
||||
, n = cls.createNamespace('no_listener')
|
||||
;
|
||||
|
||||
// only fails on Node < 0.10
|
||||
var server = http.createServer(function (req: any, res: any) {
|
||||
const server = http.createServer(function (req: any, res: any) {
|
||||
n.bindEmitter(req);
|
||||
|
||||
t.doesNotThrow(function () {
|
||||
@@ -342,7 +342,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("listener with parameters added but not bound to context", function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var ee = new EventEmitter()
|
||||
const ee = new EventEmitter()
|
||||
, n = cls.createNamespace('param_list')
|
||||
;
|
||||
|
||||
@@ -361,7 +361,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("listener that throws doesn't leave removeListener wrapped", function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var ee = new EventEmitter()
|
||||
const ee = new EventEmitter()
|
||||
, n = cls.createNamespace('kaboom')
|
||||
;
|
||||
|
||||
@@ -385,7 +385,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
t.test("emitter bound to multiple namespaces handles them correctly", function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var ee = new EventEmitter()
|
||||
const ee = new EventEmitter()
|
||||
, ns1 = cls.createNamespace('1')
|
||||
, ns2 = cls.createNamespace('2')
|
||||
;
|
||||
@@ -430,7 +430,7 @@ test("event emitters bound to CLS context", function (t) {
|
||||
|
||||
// multiple contexts in use
|
||||
test("simple tracer built on contexts", function (t) {
|
||||
var tracer = cls.createNamespace('tracer');
|
||||
const tracer = cls.createNamespace('tracer');
|
||||
|
||||
class Trace {
|
||||
harvester: any;
|
||||
@@ -438,7 +438,7 @@ test("simple tracer built on contexts", function (t) {
|
||||
this.harvester = harvester;
|
||||
}
|
||||
runHandler(callback: any) {
|
||||
var wrapped = tracer.bind(function () {
|
||||
const wrapped = tracer.bind(function () {
|
||||
callback();
|
||||
this.harvester.emit('finished', tracer.get('transaction'));
|
||||
}.bind(this));
|
||||
@@ -448,8 +448,8 @@ test("simple tracer built on contexts", function (t) {
|
||||
|
||||
t.plan(6);
|
||||
|
||||
var harvester = new EventEmitter();
|
||||
var trace = new Trace(harvester);
|
||||
const harvester = new EventEmitter();
|
||||
const trace = new Trace(harvester);
|
||||
|
||||
harvester.on('finished', function (transaction: any) {
|
||||
t.ok(transaction, "transaction should have been passed in");
|
||||
|
||||
@@ -35,7 +35,7 @@ convict.addFormats({
|
||||
}
|
||||
});
|
||||
|
||||
let conf = convict({
|
||||
const conf = convict({
|
||||
env: {
|
||||
doc: 'The applicaton environment.',
|
||||
format: ['production', 'development', 'test'],
|
||||
@@ -98,8 +98,8 @@ let conf = convict({
|
||||
|
||||
// load environment dependent configuration
|
||||
|
||||
let env = conf.get('env');
|
||||
let dbip = conf.get('db.ip');
|
||||
const env = conf.get('env');
|
||||
const dbip = conf.get('db.ip');
|
||||
conf.loadFile('./config/' + env + '.json');
|
||||
conf.loadFile(['./configs/always.json', './configs/sometimes.json']);
|
||||
|
||||
@@ -119,7 +119,7 @@ conf
|
||||
.validate({ allowed: 'warn' })
|
||||
.toString();
|
||||
|
||||
let port: number = conf.default('port');
|
||||
const port: number = conf.default('port');
|
||||
|
||||
if (conf.has('key')) {
|
||||
conf.set('the.awesome', true);
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for copy-webpack-plugin v4.0.0
|
||||
// Project: https://github.com/kevlened/copy-webpack-plugin
|
||||
// Definitions by: flying-sheep <http://github.com/flying-sheep>
|
||||
// Definitions by: flying-sheep <https://github.com/flying-sheep>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin } from 'webpack'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// signature of window.open() added by InAppBrowser plugin
|
||||
// is similar to native window.open signature, so the compiler can's
|
||||
// select proper overload, but we cast result to InAppBrowser manually.
|
||||
const iab = <InAppBrowser> window.open('google.com', '_self');
|
||||
const iab = window.open('google.com', '_self');
|
||||
|
||||
iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
|
||||
iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); });
|
||||
|
||||
@@ -31,7 +31,7 @@ import { readonly } from 'core-decorators';
|
||||
|
||||
class Meal {
|
||||
@readonly
|
||||
entree: string = 'steak';
|
||||
entree = 'steak';
|
||||
}
|
||||
|
||||
const dinner = new Meal();
|
||||
@@ -155,7 +155,7 @@ class Meal2 {
|
||||
entree = 'steak';
|
||||
|
||||
@nonenumerable
|
||||
cost: number = 4.44;
|
||||
cost = 4.44;
|
||||
}
|
||||
|
||||
const dinner2 = new Meal2();
|
||||
@@ -175,7 +175,7 @@ import { nonconfigurable } from 'core-decorators';
|
||||
|
||||
class Meal3 {
|
||||
@nonconfigurable
|
||||
entree: string = 'steak';
|
||||
entree = 'steak';
|
||||
}
|
||||
|
||||
const dinner3 = new Meal3();
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for core-js 0.9
|
||||
// Project: https://github.com/zloirock/core-js/
|
||||
// Definitions by: Ron Buckton <http://github.com/rbuckton>, Michel Felipe <http://github.com/mfdeveloper>
|
||||
// Definitions by: Ron Buckton <https://github.com/rbuckton>, Michel Felipe <https://github.com/mfdeveloper>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import fs = require('fs');
|
||||
|
||||
/////////////////////////////
|
||||
// From CSV String
|
||||
const csvStr: string = `1,2,3
|
||||
const csvStr = `1,2,3
|
||||
4,5,6
|
||||
7,8,9`;
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ let num: number;
|
||||
let date: Date;
|
||||
|
||||
let numOrUndefined: number | undefined;
|
||||
let strOrUndefined: string | undefined;
|
||||
let numericOrUndefined: NumCoercible | undefined;
|
||||
let dateOrUndefined: Date | undefined;
|
||||
let strOrUndefined: string | undefined;
|
||||
let numericOrUndefined: NumCoercible | undefined;
|
||||
let dateOrUndefined: Date | undefined;
|
||||
let numOrUndefinedExtent: [number, number] | [undefined, undefined];
|
||||
let strOrUndefinedExtent: [string, string] | [undefined, undefined];
|
||||
let numericOrUndefinedExtent: [NumCoercible, NumCoercible] | [undefined, undefined];
|
||||
|
||||
@@ -85,7 +85,6 @@ brush = brush.on('end', null);
|
||||
|
||||
// re-apply
|
||||
brush.on('end', function(d, i, g) {
|
||||
const that: SVGGElement = this;
|
||||
const datum: BrushDatum = d;
|
||||
const index: number = i;
|
||||
const group: SVGGElement[] | ArrayLike<SVGGElement> = g;
|
||||
|
||||
@@ -11,13 +11,13 @@ import { ascending } from 'd3-array';
|
||||
|
||||
// Preparatory steps --------------------------------------------------------------
|
||||
|
||||
let keyValueObj = {
|
||||
const keyValueObj = {
|
||||
a: 'test',
|
||||
b: 123,
|
||||
c: [true, true, false]
|
||||
};
|
||||
|
||||
let keyValueObj2 = {
|
||||
const keyValueObj2 = {
|
||||
a: 'test',
|
||||
b: 'same',
|
||||
c: 'type'
|
||||
@@ -29,7 +29,6 @@ let stringKVArray: Array<{ key: string, value: string }>;
|
||||
let anyKVArray: Array<{ key: string, value: any }>;
|
||||
|
||||
let num: number;
|
||||
let str: string;
|
||||
let booleanFlag: boolean;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -137,9 +136,9 @@ testObjKVArray = testObjMap.entries();
|
||||
// each() --------------------------------------------------------------
|
||||
|
||||
testObjMap.each((value, key, map) => {
|
||||
let v: TestObject = value;
|
||||
let k: string = key;
|
||||
let m: d3Collection.Map<TestObject> = map;
|
||||
const v: TestObject = value;
|
||||
const k: string = key;
|
||||
const m: d3Collection.Map<TestObject> = map;
|
||||
console.log(v.val);
|
||||
});
|
||||
|
||||
@@ -169,9 +168,9 @@ basicSet = d3Collection.set(['foo', 'bar', 42]); // last element is coerced
|
||||
|
||||
// from array without accessor
|
||||
basicSet = d3Collection.set(testObjArray, (value, index, array) => {
|
||||
let v: TestObject = value;
|
||||
let i: number = index;
|
||||
let a: TestObject[] = array;
|
||||
const v: TestObject = value;
|
||||
const i: number = index;
|
||||
const a: TestObject[] = array;
|
||||
return v.name;
|
||||
});
|
||||
|
||||
@@ -208,9 +207,9 @@ stringArray = basicSet.values();
|
||||
// each() --------------------------------------------------------------
|
||||
|
||||
basicSet.each((value, valueRepeat, set) => {
|
||||
let v: string = value;
|
||||
let vr: string = valueRepeat;
|
||||
let s: d3Collection.Set = set;
|
||||
const v: string = value;
|
||||
const vr: string = valueRepeat;
|
||||
const s: d3Collection.Set = set;
|
||||
console.log(v);
|
||||
});
|
||||
|
||||
@@ -233,7 +232,7 @@ interface Yield {
|
||||
site: string;
|
||||
}
|
||||
|
||||
let raw: Yield[] = [
|
||||
const raw: Yield[] = [
|
||||
{ yield: 27.00, variety: 'Manchuria', year: 1931, site: 'University Farm' },
|
||||
{ yield: 48.87, variety: 'Manchuria', year: 1931, site: 'Waseca' },
|
||||
{ yield: 27.43, variety: 'Manchuria', year: 1931, site: 'Morris' },
|
||||
@@ -279,8 +278,8 @@ nestL1Rollup = nestL1Rollup
|
||||
|
||||
nestL2 = nestL2
|
||||
.sortValues((a, b) => {
|
||||
let val1: Yield = a; // data type Yield
|
||||
let val2: Yield = b; // data type Yield
|
||||
const val1: Yield = a; // data type Yield
|
||||
const val2: Yield = b; // data type Yield
|
||||
return a.yield - b.yield;
|
||||
});
|
||||
|
||||
@@ -288,7 +287,7 @@ nestL2 = nestL2
|
||||
|
||||
nestL1Rollup = nestL1Rollup
|
||||
.rollup(values => {
|
||||
let vs: Yield[] = values; // correct data array type
|
||||
const vs: Yield[] = values; // correct data array type
|
||||
return vs.length;
|
||||
});
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ interface CustomDatum {
|
||||
|
||||
// Get contour generator -------------------------------------------------------
|
||||
|
||||
let contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity();
|
||||
const contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity();
|
||||
let contDensCustom: d3Contour.ContourDensity<CustomDatum> = d3Contour.contourDensity<CustomDatum>();
|
||||
|
||||
// Configure contour generator =================================================
|
||||
|
||||
@@ -16,8 +16,6 @@ interface Datum {
|
||||
}
|
||||
|
||||
let dispatch: d3Dispatch.Dispatch<HTMLElement>;
|
||||
let copy: d3Dispatch.Dispatch<HTMLElement>;
|
||||
let copy2: d3Dispatch.Dispatch<SVGElement>;
|
||||
|
||||
// Signature Tests ----------------------------------------
|
||||
|
||||
@@ -50,5 +48,5 @@ dispatch.apply('bar', document.body, [{ a: 3, b: 'test' }, 1]);
|
||||
dispatch.on('bar', null);
|
||||
|
||||
// Copy dispatch -----------------------------------------------
|
||||
copy = dispatch.copy();
|
||||
// copy2 = dispatch.copy(); // test fails type mismatch of underlying event target
|
||||
const copy: d3Dispatch.Dispatch<HTMLElement> = dispatch.copy();
|
||||
// const copy2: d3Dispatch.Dispatch<SVGElement> = dispatch.copy(); // test fails type mismatch of underlying event target
|
||||
|
||||
@@ -12,13 +12,13 @@ import * as d3Dsv from 'd3-dsv';
|
||||
// Preperatory Steps
|
||||
// ------------------------------------------------------------------------------------------
|
||||
|
||||
const csvTestString: string = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
|
||||
const tsvTestString: string = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
|
||||
const pipedTestString: string = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
|
||||
const csvTestString = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
|
||||
const tsvTestString = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
|
||||
const pipedTestString = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
|
||||
|
||||
const csvTestStringWithHeader: string = 'Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
|
||||
const tsvTestStringWithHeader: string = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
|
||||
const pipedTestStringWithHeader: string = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
|
||||
const csvTestStringWithHeader = 'Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
|
||||
const tsvTestStringWithHeader = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
|
||||
const pipedTestStringWithHeader = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
|
||||
|
||||
interface ParsedTestObject {
|
||||
year: Date;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import * as d3Ease from 'd3-ease';
|
||||
|
||||
const t_in: number = 0.5;
|
||||
const t_in = 0.5;
|
||||
let t_out: number;
|
||||
|
||||
t_out = d3Ease.easeLinear(t_in);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user