mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Merge branch 'master' of https://github.com/RecuencoJones/DefinitelyTyped into feature/update-localforage-typings
This commit is contained in:
@@ -35,3 +35,4 @@ node_modules
|
||||
|
||||
.sublimets
|
||||
.settings/launch.json
|
||||
yarn.lock
|
||||
|
||||
+2
-1
@@ -401,6 +401,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii)
|
||||
* [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000)
|
||||
* [:link:](ejs/ejs.d.ts) [ejs.js](http://ejs.co) by [Ben Liddicott](https://github.com/benliddicott/DefinitelyTyped)
|
||||
* [:link:](ejson/ejson.d.ts) [ejson](https://www.npmjs.com/package/ejson) by [Shantanu Bhadoria](https://github.com/shantanubhadoria)
|
||||
* [:link:](elasticsearch/elasticsearch.d.ts) [elasticsearch](https://www.elastic.co) by [Casper Skydt](https://github.com/CasperSkydt/DefinitelyTyped), [Blake Smith](https://github.com/bfsmith/DefinitelyTyped)
|
||||
* [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan)
|
||||
* [:link:](github-electron/github-electron.d.ts) [Electron](http://electron.atom.io) by [jedmao](https://github.com/jedmao), [rhysd](https://rhysd.github.io), [Milan Burda](https://github.com/miniak)
|
||||
@@ -1189,7 +1190,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](ng-stomp/ng-stomp.d.ts) [ngStomp](https://github.com/beevelop/ng-stomp) by [Lukasz Potapczuk](https://github.com/lpotapczuk)
|
||||
* [:link:](ngstorage/ngstorage.d.ts) [ngstorage](https://github.com/gsklee/ngStorage) by [Jakub Pistek](https://github.com/kubiq)
|
||||
* [:link:](nightmare/nightmare.d.ts) [Nightmare](https://github.com/segmentio/nightmare) by [horiuchi](https://github.com/horiuchi)
|
||||
* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider)
|
||||
* [:link:](noble/noble.d.ts) [noble](https://github.com/sandeepmistry/noble) by [Seon-Wook Park](https://github.com/swook), [Hans Bakker](https://github.com/wind-rider), [Shantanu Bhadoria](https://github.com/shantanubhadoria)
|
||||
* [:link:](nock/nock.d.ts) [nock](https://github.com/pgte/nock) by [bonnici](https://github.com/bonnici)
|
||||
* [:link:](node-imap/imap.d.ts) [node imap](https://github.com/mscdex/node-imap) by [Steve Fenton](https://github.com/Steve-Fenton)
|
||||
* [:link:](oauth2-server/oauth2-server.d.ts) [Node OAuth2 Server](https://github.com/thomseddon/node-oauth2-server) by [Robbie Van Gorkom](https://github.com/vangorra)
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
case 1. Add a new type definition.
|
||||
- [ ] checked compilation succeeds with `--target es6` and `--noImplicitAny` options.
|
||||
- [ ] has correct [naming convention](http://definitelytyped.org/guides/contributing.html#naming-the-file)
|
||||
- [ ] has a [test file](http://definitelytyped.org/guides/contributing.html#tests) with the suffix of `-tests.ts` or `-tests.tsx`.
|
||||
Please fill in this template.
|
||||
|
||||
case 2. Improvement to existing type definition.
|
||||
- documentation or source code reference which provides context for the suggested changes. url http://api.jquery.com/html .
|
||||
- it has been reviewed by a DefinitelyTyped member.
|
||||
- [ ] Prefer to make your PR against the `types-2.0` branch.
|
||||
- [ ] The package does not provide its own types, and you can not add them.
|
||||
- [ ] Test the change in your own code.
|
||||
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped#make-a-pull-request).
|
||||
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped#common-mistakes).
|
||||
|
||||
If adding a new definition:
|
||||
- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
|
||||
- [ ] Run `tsc` without errors.
|
||||
- [ ] Include the required [files](https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package) and header.
|
||||
|
||||
If changing an existing definition:
|
||||
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
|
||||
- [ ] Increase the version number in the header if appropriate.
|
||||
|
||||
@@ -4,36 +4,229 @@
|
||||
|
||||
> The repository for *high quality* TypeScript type definitions.
|
||||
|
||||
For more information see the [definitelytyped.org](http://definitelytyped.org) website.
|
||||
Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date.
|
||||
|
||||
## Usage
|
||||
|
||||
Include a line like this:
|
||||
## What are declaration files?
|
||||
|
||||
```typescript
|
||||
/// <reference path="jquery.d.ts" />
|
||||
See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
|
||||
|
||||
|
||||
## How do I get them?
|
||||
|
||||
### npm
|
||||
|
||||
This is the preferred method. This is only available for TypeScript 2.0+ users. For example:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @types/node
|
||||
```
|
||||
|
||||
## Contributions
|
||||
The types should then be automatically included by the compiler.
|
||||
See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
|
||||
|
||||
For an NPM package "foo", typings for it will be at "@types/foo".
|
||||
If you can't find your package, look for it on [TypeSearch](https://microsoft.github.io/TypeSearch/).
|
||||
|
||||
If you still can't find it, check if it [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own typings.
|
||||
This is usually provided in a `"types"` or `"typings"` field in the `package.json`,
|
||||
or just look for any ".d.ts" files in the package and manually include them with a `/// <reference path="" />`.
|
||||
|
||||
|
||||
### Other methods
|
||||
|
||||
These can be used by TypeScript 1.0.
|
||||
|
||||
* [Typings](https://github.com/typings/typings)
|
||||
* [NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)
|
||||
* Manually download from the `master` branch of this repository
|
||||
|
||||
You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
|
||||
|
||||
|
||||
## How can I contribute?
|
||||
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
|
||||
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) on how to contribute to DefinitelyTyped.
|
||||
### Test
|
||||
|
||||
## How to get the definitions
|
||||
Before you share your improvement with the world, use it yourself.
|
||||
|
||||
* Directly from the GitHub repos
|
||||
* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped)
|
||||
* [Typings - TypeScript Definition Manager](https://github.com/typings/typings)
|
||||
#### Test editing an exiting package
|
||||
|
||||
## List of definitions
|
||||
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
|
||||
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`,
|
||||
or copy them from there and paste inside of `declarations.d.ts` and follow the steps below.
|
||||
|
||||
* See [CONTRIBUTORS.md](CONTRIBUTORS.md)
|
||||
|
||||
## Requested definitions
|
||||
#### Test a new package
|
||||
|
||||
* Add a new file `declarations.d.ts` to your project.
|
||||
* Add it to the compilation, through `"includes"` or `"files"` in your [tsconfig](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html),
|
||||
or through a `/// <reference path="" />` declaration in your code.
|
||||
* Inside `declarations.d.ts`, write `declare module "foo" { }`, then write the module declaration inside.
|
||||
* Test that your code works.
|
||||
* *Then*, once you've tested your definitions, make a PR contributing the definition.
|
||||
|
||||
|
||||
### Make a pull request
|
||||
|
||||
Once you've tested your package, you can share it on DefinitelyTyped.
|
||||
|
||||
First, [fork](https://guides.github.com/activities/forking/) this repository.
|
||||
Then inside your repository:
|
||||
|
||||
* `git checkout types-2.0`
|
||||
|
||||
New work should generally be done on the `types-2.0` branch.
|
||||
If you want your changes to be available to `typings` users, then you may edit `master` instead.
|
||||
|
||||
|
||||
#### Edit an existing package
|
||||
|
||||
* `cd my-package-to-edit`
|
||||
* Make changes. Remember to edit tests.
|
||||
* You may also want to add yourself to "Definitions by" section of the package header.
|
||||
* `npm install -g typescript@2.0` and run `tsc`.
|
||||
|
||||
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
|
||||
If it doesn't, you can do so yourself in the comment associated with the PR.
|
||||
|
||||
|
||||
#### Create a new package
|
||||
|
||||
If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped.
|
||||
|
||||
If you are adding typings for an NPM package, create a directory with the same name.
|
||||
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
|
||||
(You can use `npm info foo` to check for the existence of the `foo` package.)
|
||||
|
||||
Your package should have this structure:
|
||||
|
||||
| File | Purpose |
|
||||
| --- | --- |
|
||||
| index.d.ts | This contains the typings for the package. |
|
||||
| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. |
|
||||
| tsconfig.json | This allows you to run `tsc` within the package. |
|
||||
|
||||
`index.d.ts` should start with a header looking like:
|
||||
|
||||
```ts
|
||||
// Type definitions for foo 1.2
|
||||
// Project: https://github.com/baz/foo
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
```
|
||||
|
||||
The `Project` link does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.
|
||||
|
||||
`tsconfig.json` should look like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"foo-tests.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
These should be identical accross projects except that `foo-tests` will be replaced with the name of your test file,
|
||||
and you may also add the `"jsx"` compiler option if your library needs it.
|
||||
|
||||
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
|
||||
|
||||
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/base64-js).
|
||||
|
||||
#### Common mistakes
|
||||
|
||||
* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
|
||||
* Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces.
|
||||
* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object.
|
||||
* `interface IFoo {}`: Don't add `I` to the front of an interface name.
|
||||
* `interface Foo { new(): Foo; }`:
|
||||
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }
|
||||
* `const Class: { new(): IClass; }`:
|
||||
Prefer to use a class declaration `class Class { constructor(); }` instead of a new-able constant.
|
||||
* `namespace foo {}`:
|
||||
Do not add a namespace just so that the `import * as foo` syntax will work.
|
||||
If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax.
|
||||
See more explanation [here](https://stackoverflow.com/questions/39415661/why-cant-i-import-a-class-or-function-with-import-as-x-from-y).
|
||||
* `getMeAT<T>(): T`:
|
||||
If a type parameter does not appear in the types of any parameters, you don't really have a generic function, you just have a disguised type assertion.
|
||||
Prefer to use a real type assertion, e.g. `getMeAT() as number`.
|
||||
Example where a type parameter is acceptable: `function id<T>(value: T): T;`.
|
||||
Example where it is not acceptable: `function parseJson<T>(json: string): T;`.
|
||||
Exception: `new Map<string, number>()` is OK.
|
||||
|
||||
|
||||
#### Removing a package
|
||||
|
||||
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion.
|
||||
Make a PR doing the following:
|
||||
* Delete the directory.
|
||||
* Add a new entry to `notNeededPackages.json`.
|
||||
- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (May be identical to "typingsPackageName".)
|
||||
- `typingsPackageName`: This is the name of the directory you just deleted.
|
||||
- `sourceRepoURL`: This should point to the repository that contains the typings.
|
||||
- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version.
|
||||
* Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types.
|
||||
To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
#### What exactly is the relationship between this repository and the `@types` packages on NPM?
|
||||
|
||||
The `types-2.0` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
This usually happens within an hour of changes being merged.
|
||||
|
||||
Changes to the `master` branch are also manually merged into the `types-2.0` branch, but this takes longer.
|
||||
|
||||
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
|
||||
|
||||
If the module you're referencing is an external module (uses `export`), use an import.
|
||||
If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
|
||||
|
||||
#### What do I do about older versions of typings?
|
||||
|
||||
Currently we don't support this, though it is [planned](https://github.com/Microsoft/types-publisher/issues/3).
|
||||
If you're adding a new major version of a library, you can copy `index.d.ts` to `foo-v2.3.d.ts` and edit `index.d.ts` to be the new version.
|
||||
|
||||
#### I notice some packages having a `package.json` here.
|
||||
|
||||
Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it.
|
||||
A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/pikaday/package.json).
|
||||
We do not allow other fields, such as `"description"`, to be defined manually.
|
||||
Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json.
|
||||
|
||||
#### I notice some `tsconfig.json` are missing `"noImplicitAny": true` or `"strictNullChecks": true`.
|
||||
|
||||
Then they are wrong. You can help by submitting a pull request to fix them.
|
||||
|
||||
#### Definitions in types-2.0 seem written differently than in master.
|
||||
|
||||
If you're targeting types-2.0, write it like the types-2.0 definitions.
|
||||
If you're targeting master, we may change it to the new style when merging from master to types-2.0.
|
||||
|
||||
#### Can I request a definition?
|
||||
|
||||
Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT license.
|
||||
|
||||
+12
@@ -160,6 +160,7 @@ declare namespace angular.material {
|
||||
hideDelay(delay: number): T;
|
||||
position(position: string): T;
|
||||
parent(parent?: string|Element|JQuery): T; // default: root node
|
||||
toastClass(toastClass: string): T;
|
||||
}
|
||||
|
||||
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
|
||||
@@ -338,6 +339,7 @@ declare namespace angular.material {
|
||||
onRemoving?: Function;
|
||||
onDomRemoved?: Function;
|
||||
origin?: string|JQuery|Element;
|
||||
onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any);
|
||||
}
|
||||
|
||||
interface IPanelRef {
|
||||
@@ -410,5 +412,15 @@ declare namespace angular.material {
|
||||
interceptorTypes: {
|
||||
CLOSE: string,
|
||||
};
|
||||
closeReasons: {
|
||||
CLICK_OUTSIDE: string,
|
||||
ESCAPE: string,
|
||||
};
|
||||
absPosition: {
|
||||
TOP: string,
|
||||
RIGHT: string,
|
||||
BOTTOM: string,
|
||||
LEFT: string,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1829,8 +1829,8 @@ declare namespace protractor {
|
||||
function wrapDriver(webdriver: webdriver.WebDriver, opt_baseUrl?: string, opt_rootElement?: string): Protractor;
|
||||
}
|
||||
|
||||
interface cssSelectorHelper {
|
||||
(cssLocator: string): protractor.ElementFinder;
|
||||
interface selectorHelper {
|
||||
(cssLocator: string | Function | HTMLElement | Document | Array<any>): protractor.ElementFinder;
|
||||
}
|
||||
|
||||
interface cssArraySelectorHelper {
|
||||
@@ -1841,7 +1841,7 @@ declare var browser: protractor.IBrowser;
|
||||
declare var by: protractor.IProtractorLocatorStrategy;
|
||||
declare var By: protractor.IProtractorLocatorStrategy;
|
||||
declare var element: protractor.Element;
|
||||
declare var $: cssSelectorHelper;
|
||||
declare var $: selectorHelper;
|
||||
declare var $$: cssArraySelectorHelper;
|
||||
|
||||
declare module 'protractor' {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="./angular-ui-router-default.d.ts" />
|
||||
|
||||
angular.module("test", [
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('concrete', {
|
||||
// no abstract or default
|
||||
})
|
||||
.state('string', {
|
||||
abstract: true,
|
||||
default: 'concrete'
|
||||
})
|
||||
.state('func_str', {
|
||||
abstract: true,
|
||||
default: function($rootScope): string { return $rootScope.test; }
|
||||
})
|
||||
.state('func_promise', {
|
||||
abstract: true,
|
||||
default: function($q: ng.IQService): ng.IPromise<string> {
|
||||
return $q.when("concrete");
|
||||
}
|
||||
})
|
||||
.state('injection_str', {
|
||||
abstract: true,
|
||||
default: ["$rootScope", function($rootScope) {
|
||||
return $rootScope.test;
|
||||
}]
|
||||
})
|
||||
.state('injection_promise', {
|
||||
abstract: true,
|
||||
default: ["$q", function($q: ng.IQService) {
|
||||
return $q.when("concrete");
|
||||
}]
|
||||
})
|
||||
;
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
// Type definitions for angular-ui-router-default 0.5+
|
||||
// Project: https://github.com/nonplus/angular-ui-router-default
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
|
||||
|
||||
declare namespace angular.ui {
|
||||
export type StateDefaultSpecifier = string
|
||||
| ((...args: any[]) => string)
|
||||
| ((...args: any[]) => ng.IPromise<string>)
|
||||
| (string | ((...args: any[]) => string))[]
|
||||
| (string | ((...args: any[]) => ng.IPromise<string>))[];
|
||||
interface IState {
|
||||
default?: StateDefaultSpecifier
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path="./angular-ui-router-uib-modal.d.ts" />
|
||||
|
||||
angular.module("test", [
|
||||
"ui.bootstrap",
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('contacts', {
|
||||
// no modal
|
||||
resolve: {
|
||||
a: function() {
|
||||
return "a";
|
||||
},
|
||||
b: function() {
|
||||
return ["a", "b"];
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('contacts.contact', {
|
||||
// boolean modal
|
||||
modal: true
|
||||
})
|
||||
.state('contacts.contact.edit', {
|
||||
// string[] modal
|
||||
modal: ["a", "b"]
|
||||
})
|
||||
;
|
||||
});
|
||||
@@ -0,0 +1,12 @@
|
||||
// Type definitions for angular-ui-uib-modal 0.11+ (ui.router module)
|
||||
// Project: https://github.com/nonplus/angular-ui-router-uib-modal
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
|
||||
|
||||
declare namespace angular.ui {
|
||||
interface IState {
|
||||
modal?: boolean | string[];
|
||||
}
|
||||
}
|
||||
@@ -192,8 +192,25 @@ mod.controller({
|
||||
MyCtrl2: function() {},
|
||||
MyCtrl3: ['$fooService', function($fooService: any) { }]
|
||||
});
|
||||
mod.directive('name', <any>function ($scope: ng.IScope) { })
|
||||
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
|
||||
mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
|
||||
return (scope, el, attrs) => {
|
||||
let foo = 'none';
|
||||
el.click(e => {
|
||||
foo = e.type;
|
||||
$rootScope.$apply();
|
||||
});
|
||||
scope.$watch(() => foo, () => el.text(foo));
|
||||
};
|
||||
});
|
||||
mod.directive('myDirectiveB', ['$rootScope', function ($rootScope: ng.IRootScopeService) {
|
||||
return {
|
||||
link(scope, el, attrs) {
|
||||
el.click(e => {
|
||||
el.hide();
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
mod.directive({
|
||||
myFooDir: () => ({
|
||||
template: 'my-foo-dir.tpl.html'
|
||||
@@ -279,8 +296,14 @@ namespace TestQ {
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
interface TValue {
|
||||
e: number;
|
||||
f: boolean;
|
||||
}
|
||||
var tResult: TResult;
|
||||
var promiseTResult: angular.IPromise<TResult>;
|
||||
var tValue: TValue;
|
||||
var promiseTValue: angular.IPromise<TValue>;
|
||||
|
||||
var $q: angular.IQService;
|
||||
var promiseAny: angular.IPromise<any>;
|
||||
@@ -349,6 +372,22 @@ namespace TestQ {
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $q.when<TResult>(tResult);
|
||||
result = $q.when<TResult>(promiseTResult);
|
||||
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any, (any) => any);
|
||||
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult);
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult, (any) => any);
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult, (any) => any, (any) => any);
|
||||
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any);
|
||||
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
|
||||
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult);
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => any);
|
||||
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -1041,6 +1041,7 @@ declare namespace angular {
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
when<TResult, T>(value: IPromise<T>|T, successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*/
|
||||
@@ -1769,7 +1770,7 @@ declare namespace angular {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
interface IDirectiveFactory {
|
||||
(...args: any[]): IDirective;
|
||||
(...args: any[]): IDirective | IDirectiveLinkFn;
|
||||
}
|
||||
|
||||
interface IDirectiveLinkFn {
|
||||
@@ -1777,8 +1778,8 @@ declare namespace angular {
|
||||
scope: IScope,
|
||||
instanceElement: JQuery,
|
||||
instanceAttributes: IAttributes,
|
||||
controller: {},
|
||||
transclude: ITranscludeFunction
|
||||
controller?: IController | IController[] | {[key: string]: IController},
|
||||
transclude?: ITranscludeFunction
|
||||
): void;
|
||||
}
|
||||
|
||||
@@ -1806,7 +1807,6 @@ declare namespace angular {
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* @deprecated
|
||||
* Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before
|
||||
* the controller constructor is called, this use is now deprecated. Please place initialization code that
|
||||
* relies upon bindings inside a $onInit method on the controller, instead.
|
||||
|
||||
@@ -11,4 +11,13 @@ var readStream = FS.createReadStream('./archiver.d.ts');
|
||||
|
||||
archiver.pipe(writeStream);
|
||||
archiver.append(readStream, {name: 'archiver.d.ts'});
|
||||
archiver.finalize();
|
||||
archiver.finalize();
|
||||
|
||||
|
||||
archiver.directory('./path', './someOtherPath');
|
||||
archiver.directory('./path', { name: "testName"} );
|
||||
|
||||
archiver.directory('./', "", {});
|
||||
archiver.directory('./', {name: 'test'}, {});
|
||||
|
||||
archiver.bulk({ mappaing: {} });
|
||||
Vendored
+5
@@ -25,6 +25,11 @@ declare module "archiver" {
|
||||
interface Archiver extends STREAM.Transform {
|
||||
pipe(writeStream: FS.WriteStream): void;
|
||||
append(source: FS.ReadStream | Buffer | string, name: nameInterface): void;
|
||||
|
||||
directory(dirpath: string, destpath: nameInterface | string): void;
|
||||
directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void;
|
||||
|
||||
bulk(mappings: any): void;
|
||||
finalize(): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/// <reference path="async-polling.d.ts" />
|
||||
|
||||
import * as AsyncPolling from "async-polling";
|
||||
|
||||
// Tests based on examples in https://github.com/cGuille/async-polling#readme
|
||||
|
||||
AsyncPolling(end => {
|
||||
end();
|
||||
}, 3000).run();
|
||||
|
||||
function someAsynchroneProcess(callback: (error?: Error, response?: any) => any): any {
|
||||
callback();
|
||||
}
|
||||
|
||||
let polling = AsyncPolling(end => {
|
||||
someAsynchroneProcess(function (error, response) {
|
||||
if (error) {
|
||||
end(error);
|
||||
return;
|
||||
}
|
||||
|
||||
end(null, response);
|
||||
});
|
||||
}, 3000);
|
||||
polling.on("error", (error: Error) => {});
|
||||
polling.on("result", (result: any) => {});
|
||||
polling.run();
|
||||
polling.stop();
|
||||
|
||||
AsyncPolling(function(end) {
|
||||
this.stop();
|
||||
end();
|
||||
}, 3000).run();
|
||||
|
||||
let i = 0;
|
||||
|
||||
polling = AsyncPolling(function(end) {
|
||||
++i;
|
||||
if (i === 3) {
|
||||
return end(new Error("i is " + i));
|
||||
}
|
||||
if (i >= 5) {
|
||||
this.stop();
|
||||
return end(null, `#${i} stop`);
|
||||
}
|
||||
end(null, `#${i} wait a second...`);
|
||||
}, 1000);
|
||||
|
||||
const eventNames: AsyncPolling.EventName[] = ["run", "start", "end", "schedule", "stop"];
|
||||
eventNames.forEach(eventName => {
|
||||
polling.on(eventName, () => {
|
||||
console.log("lifecycle:", eventName);
|
||||
});
|
||||
});
|
||||
|
||||
polling.on("result", (result: any) => {
|
||||
console.log("result:", result);
|
||||
});
|
||||
|
||||
polling.on("error", (error: Error) => {
|
||||
console.error("error:", error);
|
||||
});
|
||||
|
||||
polling.run();
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for AsyncPolling
|
||||
// Project: https://github.com/cGuille/async-polling
|
||||
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "async-polling" {
|
||||
module AsyncPolling {
|
||||
export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop";
|
||||
}
|
||||
|
||||
function AsyncPolling<Result>(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): {
|
||||
run: () => any;
|
||||
stop: () => any;
|
||||
on: (eventName: AsyncPolling.EventName, listener: Function) => any;
|
||||
}
|
||||
|
||||
export = AsyncPolling;
|
||||
}
|
||||
@@ -435,3 +435,357 @@ async.dir(function (name, callback) {
|
||||
callback(null, { hello: name });
|
||||
}, 1000);
|
||||
}, "world");
|
||||
|
||||
// each
|
||||
|
||||
async.each<number>({
|
||||
"a": 1,
|
||||
"b": 2
|
||||
}, function(val: number, next: ErrorCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.each: ${val}`);
|
||||
|
||||
next();
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err?: Error): void {
|
||||
|
||||
console.log("async.each: done.");
|
||||
|
||||
});
|
||||
|
||||
async.eachSeries<number>({
|
||||
"a": 1,
|
||||
"b": 2
|
||||
}, function(val: number, next: ErrorCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.eachSeries: ${val}`);
|
||||
|
||||
next();
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err?: Error): void {
|
||||
|
||||
console.log("async.eachSeries: done.");
|
||||
|
||||
});
|
||||
|
||||
async.eachLimit<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3,
|
||||
"d": 4,
|
||||
"e": 5,
|
||||
"f": 6
|
||||
}, 2, function(val: number, next: ErrorCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.eachLimit: ${val}`);
|
||||
|
||||
next();
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err?: Error): void {
|
||||
|
||||
console.log("async.eachLimit: done.");
|
||||
|
||||
});
|
||||
|
||||
// forEachOf/eachOf
|
||||
|
||||
async.eachOf<number>({
|
||||
"a": 1,
|
||||
"b": 2
|
||||
}, function(val: number, key: string, next: ErrorCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.forEachOf/eachOf: ${key} = ${val}`);
|
||||
|
||||
next();
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err?: Error): void {
|
||||
|
||||
console.log("async.forEachOf/eachOf: done.");
|
||||
|
||||
});
|
||||
|
||||
async.forEachOfSeries<number>({
|
||||
"a": 1,
|
||||
"b": 2
|
||||
}, function(val: number, key: string, next: ErrorCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.forEachOfSeries: ${key} = ${val}`);
|
||||
|
||||
next();
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err?: Error): void {
|
||||
|
||||
console.log("async.forEachOfSeries: done.");
|
||||
|
||||
});
|
||||
|
||||
async.forEachOfLimit<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3,
|
||||
"d": 4,
|
||||
"e": 5,
|
||||
"f": 6
|
||||
}, 2, function(val: number, key: string, next: ErrorCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.forEachOfLimit: ${key} = ${val}`);
|
||||
|
||||
next();
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err?: Error): void {
|
||||
|
||||
console.log("async.forEachOfLimit: done.");
|
||||
|
||||
});
|
||||
|
||||
// map
|
||||
|
||||
async.map<number, string>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(val: number, next: AsyncResultCallback<string>): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.map: ${val}`);
|
||||
|
||||
next(null, val.toString());
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
|
||||
console.log("async.map: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
async.mapSeries<number, string>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(val: number, next: AsyncResultCallback<string>): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.mapSeries: ${val}`);
|
||||
|
||||
next(null, val.toString());
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
|
||||
console.log("async.mapSeries: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
async.mapLimit<number, string>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3,
|
||||
"d": 4,
|
||||
"e": 5,
|
||||
"f": 6
|
||||
}, 2, function(val: number, next: AsyncResultCallback<string>): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.mapLimit: ${val}`);
|
||||
|
||||
next(null, val.toString());
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
|
||||
console.log("async.mapLimit: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
// mapValues
|
||||
|
||||
async.mapValues<number, string>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.mapValues: ${key} = ${val}`);
|
||||
|
||||
next(null, val.toString());
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
|
||||
console.log("async.mapValues: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
async.mapValuesSeries<number, string>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(val: number, key: string, next: AsyncResultCallback<string>): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.mapValuesSeries: ${key} = ${val}`);
|
||||
|
||||
next(null, val.toString());
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: string[]): void {
|
||||
|
||||
console.log("async.mapValuesSeries: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
// filter/select/reject
|
||||
|
||||
async.filter<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(val: number, next: AsyncBooleanResultCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.filter/select: ${val}`);
|
||||
|
||||
next(null, val % 2 === 0);
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: number[]): void {
|
||||
|
||||
console.log("async.filter/select: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
async.reject<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(val: number, next: AsyncBooleanResultCallback): void {
|
||||
|
||||
setTimeout(function(): void {
|
||||
|
||||
console.log(`async.reject: ${val}`);
|
||||
|
||||
next(null, val % 2 === 0);
|
||||
|
||||
}, 500);
|
||||
|
||||
}, function(err: Error, results: number[]): void {
|
||||
|
||||
console.log("async.reject: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
// concat
|
||||
|
||||
async.concat<string, string>({
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
"c": "3"
|
||||
}, function(item: string, next: AsyncResultCallback<string[]>): void {
|
||||
|
||||
console.log(`async.concat: ${item}`);
|
||||
|
||||
next(null, [item, item, item]);
|
||||
|
||||
}, function(err: Error, results: string[]) {
|
||||
|
||||
console.log("async.concat: done with results", results);
|
||||
|
||||
});
|
||||
|
||||
// detect/find
|
||||
|
||||
async.detect<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(item: number, next: AsyncBooleanResultCallback): void {
|
||||
|
||||
console.log(`async.detect/find: ${item}`);
|
||||
|
||||
next(null, item > 1);
|
||||
|
||||
}, function(err: Error, result: number) {
|
||||
|
||||
if (err) {
|
||||
|
||||
console.log(err);
|
||||
|
||||
} else {
|
||||
|
||||
console.log("async.detect/find: done with result", result);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// every/all
|
||||
|
||||
async.every<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(item: number, next: AsyncBooleanResultCallback): void {
|
||||
|
||||
console.log(`async.every/all: ${item}`);
|
||||
|
||||
next(null, item > 0);
|
||||
|
||||
}, function(err: Error, result: boolean) {
|
||||
|
||||
console.log("async.every/all: done with result", result);
|
||||
|
||||
});
|
||||
|
||||
// some/any
|
||||
|
||||
async.some<number>({
|
||||
"a": 1,
|
||||
"b": 2,
|
||||
"c": 3
|
||||
}, function(item: number, next: AsyncBooleanResultCallback): void {
|
||||
|
||||
console.log(`async.some/any: ${item}`);
|
||||
|
||||
next(null, item > 2);
|
||||
|
||||
}, function(err: Error, result: boolean) {
|
||||
|
||||
console.log("async.some/any: done with result", result);
|
||||
|
||||
});
|
||||
|
||||
Vendored
+77
-57
@@ -1,11 +1,13 @@
|
||||
// Type definitions for Async 2.0.1
|
||||
// Project: https://github.com/caolan/async
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Arseniy Maximov <https://github.com/kern0>, Joe Herman <https://github.com/Penryn>, Angus Fenying <https://github.com/fenying>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Dictionary<T> { [key: string]: T; }
|
||||
|
||||
interface ErrorCallback { (err?: Error): void; }
|
||||
interface AsyncWaterfallCallback { (err: Error, ...args: any[]): void; }
|
||||
interface AsyncBooleanResultCallback { (err: Error, truthValue: boolean): void; }
|
||||
interface AsyncResultCallback<T> { (err: Error, result: T): void; }
|
||||
interface AsyncResultArrayCallback<T> { (err: Error, results: T[]): void; }
|
||||
interface AsyncResultObjectCallback<T> { (err: Error, results: Dictionary<T>): void; }
|
||||
@@ -15,7 +17,7 @@ interface AsyncIterator<T> { (item: T, callback: ErrorCallback): void; }
|
||||
interface AsyncForEachOfIterator<T> { (item: T, key: number|string, callback: ErrorCallback): void; }
|
||||
interface AsyncResultIterator<T, R> { (item: T, callback: AsyncResultCallback<R>): void; }
|
||||
interface AsyncMemoIterator<T, R> { (memo: R, item: T, callback: AsyncResultCallback<R>): void; }
|
||||
interface AsyncBooleanIterator<T> { (item: T, callback: (err: string, truthValue: boolean) => void): void; }
|
||||
interface AsyncBooleanIterator<T> { (item: T, callback: AsyncBooleanResultCallback): void; }
|
||||
|
||||
interface AsyncWorker<T> { (task: T, callback: ErrorCallback): void; }
|
||||
interface AsyncVoidFunction { (callback: ErrorCallback): void; }
|
||||
@@ -89,52 +91,74 @@ interface Async {
|
||||
|
||||
// Collections
|
||||
each<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
eachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
each<T>(arr: Dictionary<T>, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
eachSeries: typeof async.each;
|
||||
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
eachLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
|
||||
forEach: typeof async.each;
|
||||
forEachSeries: typeof async.each;
|
||||
forEachLimit: typeof async.eachLimit;
|
||||
forEachOf<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOfSeries<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
|
||||
forEachOf<T>(obj: Dictionary<T>, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
forEachOfSeries: typeof async.forEachOf;
|
||||
forEachOfLimit<T>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
mapValuesLimit<T, R>(obj: {[name: string]: T}, limit: number, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
|
||||
mapValues<T, R>(obj: {[name: string]: T}, iteratee: (value: string, key: T, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
|
||||
forEachOfLimit<T>(obj: Dictionary<T>, limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
|
||||
eachOf: typeof async.forEachOf;
|
||||
eachOfSeries: typeof async.forEachOf;
|
||||
eachOfLimit: typeof async.forEachOfLimit;
|
||||
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
|
||||
map<T, R>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
|
||||
mapSeries: typeof async.map;
|
||||
mapLimit<T, R>(arr: T[], limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
|
||||
mapLimit<T, R>(arr: Dictionary<T>, limit: number, iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): void;
|
||||
mapValuesLimit<T, R>(obj: Dictionary<T>, limit: number, iteratee: (value: T, key: string, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
|
||||
mapValues<T, R>(obj: Dictionary<T>, iteratee: (value: T, key: string, callback: AsyncResultCallback<R>) => void, callback: AsyncResultCallback<R[]>): void;
|
||||
mapValuesSeries: typeof async.mapValues;
|
||||
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
select<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
filterSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
selectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
filterLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
selectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
reject<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
rejectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
rejectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
|
||||
inject<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
|
||||
foldl<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): any;
|
||||
reduceRight<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
foldr<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback: AsyncResultCallback<R>): any;
|
||||
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
|
||||
filter<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
|
||||
filter<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
|
||||
filterSeries: typeof async.filter;
|
||||
filterLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
|
||||
filterLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultArrayCallback<T>): void;
|
||||
select: typeof async.filter;
|
||||
selectSeries: typeof async.filter;
|
||||
selectLimit: typeof async.filterLimit;
|
||||
reject: typeof async.filter;
|
||||
rejectSeries: typeof async.filter;
|
||||
rejectLimit: typeof async.filterLimit;
|
||||
reduce<T, R>(arr: T[], memo: R, iterator: AsyncMemoIterator<T, R>, callback?: AsyncResultCallback<R>): void;
|
||||
inject: typeof async.reduce;
|
||||
foldl: typeof async.reduce;
|
||||
reduceRight: typeof async.reduce;
|
||||
foldr: typeof async.reduce;
|
||||
detect<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
|
||||
detect<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
|
||||
detectSeries: typeof async.detect;
|
||||
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
|
||||
detectLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): void;
|
||||
find: typeof async.detect;
|
||||
detectSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
|
||||
findSeries: typeof async.detectSeries;
|
||||
detectLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncResultCallback<T>): any;
|
||||
findSeries: typeof async.detect;
|
||||
findLimit: typeof async.detectLimit;
|
||||
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): any;
|
||||
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
|
||||
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
|
||||
anyLimit: typeof async.someLimit;
|
||||
someSeries<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
|
||||
sortBy<T, V>(arr: T[], iterator: AsyncResultIterator<T, V>, callback?: AsyncResultArrayCallback<T>): void;
|
||||
some<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
some<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
someSeries: typeof async.some;
|
||||
someLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
someLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
any: typeof async.some;
|
||||
anySeries: typeof async.someSeries;
|
||||
any<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => void): any;
|
||||
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
|
||||
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
|
||||
all<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: (result: boolean) => any): any;
|
||||
concat<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
concatSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): any;
|
||||
anyLimit: typeof async.someLimit;
|
||||
every<T>(arr: T[], iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
every<T>(arr: Dictionary<T>, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
everySeries: typeof async.every;
|
||||
everyLimit<T>(arr: T[], limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
everyLimit<T>(arr: Dictionary<T>, limit: number, iterator: AsyncBooleanIterator<T>, callback?: AsyncBooleanResultCallback): void;
|
||||
all: typeof async.every;
|
||||
allSeries: typeof async.every;
|
||||
allLimit: typeof async.everyLimit;
|
||||
|
||||
concat<T, R>(arr: T[], iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): void;
|
||||
concat<T, R>(arr: Dictionary<T>, iterator: AsyncResultIterator<T, R[]>, callback?: AsyncResultArrayCallback<R>): void;
|
||||
concatSeries: typeof async.concat;
|
||||
|
||||
// Control Flow
|
||||
series<T>(tasks: AsyncFunction<T>[], callback?: AsyncResultArrayCallback<T>): void;
|
||||
@@ -143,14 +167,14 @@ interface Async {
|
||||
parallel<T>(tasks: Dictionary<AsyncFunction<T>>, callback?: AsyncResultObjectCallback<T>): void;
|
||||
parallelLimit<T>(tasks: Array<AsyncFunction<T>>, limit: number, callback?: AsyncResultArrayCallback<T>): void;
|
||||
parallelLimit<T>(tasks: Dictionary<AsyncFunction<T>>, limit: number, callback?: AsyncResultObjectCallback<T>): void;
|
||||
whilst(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void;
|
||||
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
|
||||
until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void;
|
||||
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
|
||||
during(test: (testCallback : (error: Error, truth: boolean) => void) => void, fn: AsyncVoidFunction, callback: (err: any) => void): void;
|
||||
doDuring(fn: AsyncVoidFunction, test: (testCallback: (error: Error, truth: boolean) => void) => void, callback: (err: any) => void): void;
|
||||
forever(next: (errCallback : (err: Error) => void) => void, errBack: (err: Error) => void) : void;
|
||||
waterfall(tasks: Function[], callback?: (err: Error, results?: any) => void): void;
|
||||
whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void;
|
||||
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void;
|
||||
until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void;
|
||||
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void;
|
||||
during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void;
|
||||
doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void;
|
||||
forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void;
|
||||
waterfall<T>(tasks: Function[], callback?: AsyncResultCallback<T>): void;
|
||||
compose(...fns: Function[]): Function;
|
||||
seq(...fns: Function[]): Function;
|
||||
applyEach(fns: Function[], argsAndCallback: any[]): void; // applyEach(fns, args..., callback). TS does not support ... for a middle argument. Callback is optional.
|
||||
@@ -158,19 +182,15 @@ interface Async {
|
||||
queue<T>(worker: AsyncWorker<T>, concurrency?: number): AsyncQueue<T>;
|
||||
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
|
||||
cargo(worker : (tasks: any[], callback : ErrorCallback) => void, payload? : number) : AsyncCargo;
|
||||
auto(tasks: any, concurrency?: number, callback?: (error: Error, results: any) => void): void;
|
||||
autoInject(tasks: any, callback?: (error: Error, results: any) => void): void;
|
||||
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: (error: Error, results: any) => void): void;
|
||||
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: (error: Error, results: any) => void): void;
|
||||
auto(tasks: any, concurrency?: number, callback?: AsyncResultCallback<any>): void;
|
||||
autoInject(tasks: any, callback?: AsyncResultCallback<any>): void;
|
||||
retry<T>(opts: number, task: (callback : AsyncResultCallback<T>, results: any) => void, callback: AsyncResultCallback<any>): void;
|
||||
retry<T>(opts: { times: number, interval: number|((retryCount: number) => number) }, task: (callback: AsyncResultCallback<T>, results : any) => void, callback: AsyncResultCallback<any>): void;
|
||||
retryable<T>(opts: number | {times: number, interval: number}, task: AsyncFunction<T>): AsyncFunction<T>;
|
||||
apply(fn: Function, ...arguments: any[]): AsyncFunction<any>;
|
||||
nextTick(callback: Function, ...args: any[]): void;
|
||||
setImmediate: typeof async.nextTick;
|
||||
|
||||
allLimit<T>(arr: T[], limit: number, iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any;
|
||||
everySeries<T>(arr: T[], iteratee: AsyncBooleanIterator<T>, cb?: (result: boolean) => any) : any
|
||||
allSeries: typeof async.everySeries;
|
||||
|
||||
reflect<T>(fn: AsyncFunction<T>) : (callback: (err: void, result: {error?: Error, value?: T}) => void) => void;
|
||||
reflectAll<T>(tasks: AsyncFunction<T>[]): ((callback: (err: void, result: {error?: Error, value?: T}) => void) => void)[];
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+559
@@ -0,0 +1,559 @@
|
||||
// Type definitions for automapper-ts
|
||||
// Project: https://github.com/loedeman/AutoMapper
|
||||
// Definitions by: Bert Loedeman <https://github.com/loedeman>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module AutoMapperJs {
|
||||
/**
|
||||
* AutoMapper implementation, for both creating maps and performing maps. Comparable usage and functionality to the original
|
||||
* .NET AutoMapper library is the pursuit of this implementation.
|
||||
*/
|
||||
class AutoMapper {
|
||||
/**
|
||||
* Initializes the mapper with the supplied configuration.
|
||||
* @param {(config: IConfiguration) => void} Configuration function to call.
|
||||
*/
|
||||
initialize(configFunction: (config: IConfiguration) => void): void;
|
||||
|
||||
/**
|
||||
* Create a createMap curry function which expects only a destination key.
|
||||
* @param {string} sourceKey The map source key.
|
||||
* @returns {(destinationKey: string) => ICreateMapFluentFunctions}
|
||||
*/
|
||||
createMap(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any)) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Create a mapping profile.
|
||||
* @param {string} sourceKey The map source key.
|
||||
* @param {string} destinationKey The map destination key.
|
||||
* @returns {Core.ICreateMapFluentFunctions}
|
||||
*/
|
||||
createMap(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Create a map curry function which expects a destination key and a source object.
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @returns {(destinationKey: string, sourceObject: any) => any}
|
||||
*/
|
||||
map(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any), sourceObject: any) => any;
|
||||
|
||||
/**
|
||||
* Create a map curry function which expects only a source object.
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @param destinationKey Destination key, for instance the destination type name.
|
||||
* @returns {(sourceObject: any) => any}
|
||||
*/
|
||||
map(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): (sourceObject: any) => any;
|
||||
|
||||
/**
|
||||
* Execute a mapping from the source object to a new destination object with explicit mapping configuration and supplied mapping options (using createMap).
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @param destinationKey Destination key, for instance the destination type name.
|
||||
* @param sourceObject The source object to map.
|
||||
* @returns {any} Destination object.
|
||||
*/
|
||||
map(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any): any;
|
||||
|
||||
/**
|
||||
* Create a mapAsync curry function which expects a destination key, a source object and a callback function.
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @returns {(destinationKey: string, sourceObject: any, callback: IMapCallback) => void}
|
||||
*/
|
||||
mapAsync(sourceKey: string | (new() => any)): (destinationKey: string | (new() => any), sourceObject: any, callback: IMapCallback) => void;
|
||||
|
||||
/**
|
||||
* Create a map curry function which expects only a source object and a callback function.
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @param destinationKey Destination key, for instance the destination type name.
|
||||
* @param sourceObject The source object to map.
|
||||
* @returns {(callback: IMapCallback) => void}
|
||||
*/
|
||||
mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any): (callback: IMapCallback) => void;
|
||||
|
||||
/**
|
||||
* Create a map curry function which expects only a source object and a callback function.
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @param destinationKey Destination key, for instance the destination type name.
|
||||
* @returns {(sourceObject: any, callback: IMapCallback) => void}
|
||||
*/
|
||||
mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any)): (sourceObject: any, callback: IMapCallback) => void;
|
||||
|
||||
/**
|
||||
* Execute an asynchronous mapping from the source object to a new destination object with explicit mapping configuration and supplied mapping options (using createMap).
|
||||
* @param sourceKey Source key, for instance the source type name.
|
||||
* @param destinationKey Destination key, for instance the destination type name.
|
||||
* @param sourceObject The source object to map.
|
||||
* @param {IMapCallback} callback The callback to call when asynchronous mapping is complete.
|
||||
*/
|
||||
mapAsync(sourceKey: string | (new() => any), destinationKey: string | (new() => any), sourceObject: any, callback: IMapCallback): void;
|
||||
|
||||
/**
|
||||
* Validates mapping configuration by dry-running. Since JS does not
|
||||
* fully support typing, it only checks if properties match on both
|
||||
* sides. The function needs IMapping.sourceTypeClass and
|
||||
* IMapping.destinationTypeClass to function.
|
||||
* @param {boolean} strictMode Whether or not to fail when properties
|
||||
* sourceTypeClass or destinationTypeClass
|
||||
* are unavailable.
|
||||
*/
|
||||
assertConfigurationIsValid(strictMode?: boolean): void;
|
||||
}
|
||||
|
||||
class AsyncAutoMapper {
|
||||
/* For Test Purposes Only */
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts source type to destination type instead of normal member mapping
|
||||
*/
|
||||
class TypeConverter implements ITypeConverter {
|
||||
/**
|
||||
* Performs conversion from source to destination type.
|
||||
* @param {IResolutionContext} resolutionContext Resolution context.
|
||||
* @returns {any} Destination object.
|
||||
*/
|
||||
convert(resolutionContext: IResolutionContext): any;
|
||||
}
|
||||
|
||||
export class Profile implements IProfile {
|
||||
/** Profile name */
|
||||
public profileName: string;
|
||||
|
||||
/** Naming convention for source members */
|
||||
public sourceMemberNamingConvention: INamingConvention;
|
||||
|
||||
/** Naming convention for destination members */
|
||||
public destinationMemberNamingConvention: INamingConvention;
|
||||
|
||||
/**
|
||||
* Create a createMap curry function which expects only a destination key.
|
||||
* @param {string} sourceKey The map source key.
|
||||
* @returns {(destinationKey: string) => ICreateMapFluentFunctions}
|
||||
*/
|
||||
protected createMap(sourceKey: string): (destinationKey: string) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Create a mapping profile.
|
||||
* @param {string} sourceKey The map source key.
|
||||
* @param {string} destinationKey The map destination key.
|
||||
* @returns {Core.ICreateMapFluentFunctions}
|
||||
*/
|
||||
protected createMap(sourceKey: string, destinationKey: string): ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Implement this method in a derived class and call the CreateMap method to associate that map with this profile.
|
||||
* Avoid calling the AutoMapper class / automapper instance from this method.
|
||||
*/
|
||||
public configure(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the PascalCase naming convention strategy.
|
||||
*/
|
||||
class PascalCaseNamingConvention implements INamingConvention {
|
||||
/** Regular expression on how to tokenize a member. */
|
||||
splittingExpression: RegExp;
|
||||
|
||||
/** Character to separate on. */
|
||||
separatorCharacter: string;
|
||||
|
||||
/**
|
||||
* Transformation function called when this convention is the destination naming convention.
|
||||
* @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts.
|
||||
* @returns {string} Destination property name
|
||||
*/
|
||||
transformPropertyName(sourcePropertyNameParts: string[]): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the camelCase naming convention strategy.
|
||||
*/
|
||||
class CamelCaseNamingConvention implements INamingConvention {
|
||||
/** Regular expression on how to tokenize a member. */
|
||||
splittingExpression: RegExp;
|
||||
|
||||
/** Character to separate on. */
|
||||
separatorCharacter: string;
|
||||
|
||||
/**
|
||||
* Transformation function called when this convention is the destination naming convention.
|
||||
* @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts.
|
||||
* @returns {string} Destination property name
|
||||
*/
|
||||
transformPropertyName(sourcePropertyNameParts: string[]): string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface IProperty {
|
||||
name: string;
|
||||
metadata: IPropertyMetadata;
|
||||
level: number;
|
||||
sourceMapping: boolean;
|
||||
ignore: boolean;
|
||||
async: boolean;
|
||||
children?: IProperty[];
|
||||
destinations?: IProperty[];
|
||||
conversionValuesAndFunctions: any[];
|
||||
conditionFunction?: (sourceObject: any) => boolean;
|
||||
}
|
||||
|
||||
interface IPropertyMetadata {
|
||||
mapping: IMapping;
|
||||
root: IProperty;
|
||||
parent: IProperty;
|
||||
destinations: {[name: string]: IPropertyDestinationMetadata};
|
||||
destinationCount: number;
|
||||
}
|
||||
|
||||
interface IPropertyDestinationMetadata {
|
||||
source: IProperty;
|
||||
destination: IProperty;
|
||||
}
|
||||
|
||||
interface IMemberMappingMetaData {
|
||||
destination: string;
|
||||
source: string;
|
||||
sourceMapping: boolean;
|
||||
ignore: boolean;
|
||||
async: boolean;
|
||||
condition: (sourceObject: any) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Member mapping properties.
|
||||
*/
|
||||
interface IForMemberMapping {
|
||||
/** The source member property name. */
|
||||
sourceProperty: string;
|
||||
/** The destination member property name parts for nested property support (e.g. 'type.name'). */
|
||||
destinationProperty: string;
|
||||
/** Source or destination mapping. */
|
||||
sourceMapping: boolean;
|
||||
/** All mapping values and/or functions resulting from stacked for(Source)Member calls. */
|
||||
mappingValuesAndFunctions: Array<any>;
|
||||
/** Whether or not this destination property must be ignored. */
|
||||
ignore: boolean;
|
||||
/** Whether or not this member mapping has an asynchronous mapping function. */
|
||||
async: boolean;
|
||||
/**
|
||||
* The object will only be mapped when the condition is met.
|
||||
* @param {any} sourceObject The source object to check.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
conditionFunction: (sourceObject: any) => boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for returning an object with available 'sub' functions to enable method chaining (e.g. automapper.createMap().forMember().forMember() ...)
|
||||
*/
|
||||
interface ICreateMapFluentFunctions {
|
||||
/**
|
||||
* Customize configuration for an individual destination member.
|
||||
* @param sourceProperty The destination member property name.
|
||||
* @param valueOrFunction The value or function to use for this individual member.
|
||||
* @returns {IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
forMember: (sourceProperty: string, valueOrFunction: any |
|
||||
((opts: IMemberConfigurationOptions) => any) |
|
||||
((opts: IMemberConfigurationOptions, cb: IMemberCallback) => void)) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Customize configuration for an individual source member.
|
||||
* @param sourceProperty The source member property name.
|
||||
* @param sourceMemberConfigFunction The function to use for this individual member.
|
||||
* @returns {IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
forSourceMember: (sourceProperty: string,
|
||||
sourceMemberConfigFunction: ((opts: ISourceMemberConfigurationOptions) => any) |
|
||||
((opts: ISourceMemberConfigurationOptions, cb: IMemberCallback) => void)
|
||||
) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Customize configuration for all destination members.
|
||||
* @param func The function to use for this individual member.
|
||||
* @returns {IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
forAllMembers: (func: (destinationObject: any, destinationPropertyName: string, value: any) => void) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Ignore all members not specified explicitly.
|
||||
*/
|
||||
ignoreAllNonExisting: () => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Skip normal member mapping and convert using a custom type converter (instantiated during mapping).
|
||||
* @param typeConverterClassOrFunction The converter class or function to use when converting.
|
||||
*/
|
||||
convertUsing: (typeConverterClassOrFunction: ((resolutionContext: IResolutionContext) => any) |
|
||||
((resolutionContext: IResolutionContext, callback: IMapCallback) => void) |
|
||||
ITypeConverter |
|
||||
(new() => ITypeConverter)
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Specify to which class type AutoMapper should convert. When specified, AutoMapper will create an instance of the given type, instead of returning a new object literal.
|
||||
* @param typeClass The destination type class.
|
||||
* @returns {IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
convertToType: (typeClass: new () => any) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Specify which profile should be used when mapping.
|
||||
* @param {string} profileName The profile name.
|
||||
* @returns {IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
withProfile: (profileName: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The mapping configuration for the current mapping keys/types.
|
||||
*/
|
||||
interface IMapping {
|
||||
/** The mapping source key. */
|
||||
sourceKey: string;
|
||||
|
||||
/** The mapping destination key. */
|
||||
destinationKey: string;
|
||||
|
||||
/** The mappings for forAllMembers functions. */
|
||||
forAllMemberMappings: Array<(destinationObject: any, destinationPropertyName: string, value: any) => void>;
|
||||
|
||||
properties: IProperty[];
|
||||
|
||||
/**
|
||||
* Skip normal member mapping and convert using a type converter.
|
||||
* @param resolutionContext Context information regarding resolution of a destination value
|
||||
* @returns {any} Destination object.
|
||||
*/
|
||||
typeConverterFunction: ((resolutionContext: IResolutionContext) => any) |
|
||||
((resolutionContext: IResolutionContext, callback: IMapCallback) => void);
|
||||
|
||||
/** The source type class to convert from. */
|
||||
sourceTypeClass: any;
|
||||
|
||||
/** The destination type class to convert to. */
|
||||
destinationTypeClass: any;
|
||||
|
||||
/** The profile used when mapping. */
|
||||
profile?: IProfile;
|
||||
|
||||
/** Whether or not to ignore all properties not specified using createMap. */
|
||||
ignoreAllNonExisting?: boolean;
|
||||
|
||||
/** Whether or not an mapping has to be asynchronous. */
|
||||
async: boolean;
|
||||
|
||||
/*
|
||||
* PERFORMANCE ENHANCEMENTS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Item mapping function to use.
|
||||
*/
|
||||
mapItemFunction: IMapItemFunction | IAsyncMapItemFunction;
|
||||
}
|
||||
|
||||
// export interface IMappingMapOptimized extends IMapping {
|
||||
// final: boolean;
|
||||
// forMemberMappingsArray: Array<IForMemberMapping>;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Context information regarding resolution of a destination value
|
||||
*/
|
||||
export interface IResolutionContext {
|
||||
/** Source value */
|
||||
sourceValue: any;
|
||||
|
||||
/** Destination value */
|
||||
destinationValue: any;
|
||||
|
||||
/** Source property name */
|
||||
sourcePropertyName?: string;
|
||||
|
||||
/** Destination property name */
|
||||
destinationPropertyName?: string;
|
||||
|
||||
/** Index of current collection mapping */
|
||||
arrayIndex?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for forMember mapping function.
|
||||
*/
|
||||
interface IMemberConfigurationOptions {
|
||||
/**
|
||||
* Map from a custom source property name.
|
||||
* @param sourcePropertyName The source property to map.
|
||||
*/
|
||||
mapFrom: (sourcePropertyName: string) => void;
|
||||
|
||||
/**
|
||||
* When this configuration function is used, the (destination) property is ignored
|
||||
* when mapping.
|
||||
*/
|
||||
ignore?: () => void;
|
||||
|
||||
/**
|
||||
* If specified, the property will only be mapped when the condition is fulfilled.
|
||||
*/
|
||||
condition: (predicate: ((sourceObject: any) => boolean)) => void;
|
||||
|
||||
/** The source object to map. */
|
||||
sourceObject: any;
|
||||
|
||||
/** The source property to map. */
|
||||
sourcePropertyName: string;
|
||||
|
||||
/**
|
||||
* The intermediate destination property value, used for stacking multiple for(Source)Member calls
|
||||
* while elaborating the intermediate result.
|
||||
*/
|
||||
intermediatePropertyValue: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration options for forSourceMember mapping function.
|
||||
*/
|
||||
interface ISourceMemberConfigurationOptions {
|
||||
/**
|
||||
* When this configuration function is used, the source property is ignored
|
||||
* when mapping.
|
||||
*/
|
||||
ignore: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Member callback interface
|
||||
*/
|
||||
interface IMemberCallback {
|
||||
/**
|
||||
* Callback function to call when the async operation is executed.
|
||||
* @param {any} callbackValue Callback value to be used as output for the for(Source)Member call.
|
||||
*/
|
||||
(callbackValue: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Member callback interface
|
||||
*/
|
||||
interface IMapCallback {
|
||||
/**
|
||||
* Callback function to call when the async operation is executed.
|
||||
* @param {any} result Callback value to be used as output for the mapAsync call.
|
||||
*/
|
||||
(result: any): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts source type to destination type instead of normal member mapping
|
||||
*/
|
||||
export interface ITypeConverter {
|
||||
/**
|
||||
* Performs conversion from source to destination type.
|
||||
* @param {IResolutionContext} resolutionContext Resolution context.
|
||||
* @returns {any} Destination object.
|
||||
*/
|
||||
convert: (resolutionContext: IResolutionContext) => any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a naming convention strategy.
|
||||
*/
|
||||
export interface INamingConvention {
|
||||
/** Regular expression on how to tokenize a member. */
|
||||
splittingExpression: RegExp;
|
||||
|
||||
/** Character to separate on. */
|
||||
separatorCharacter: string;
|
||||
|
||||
/**
|
||||
* Transformation function called when this convention is the destination naming convention.
|
||||
* @param {string[]} sourcePropertyNameParts Array containing tokenized source property name parts.
|
||||
* @returns {string} Destination property name
|
||||
*/
|
||||
transformPropertyName: (sourcePropertyNameParts: string[]) => string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration for profile-specific maps.
|
||||
*/
|
||||
export interface IConfiguration {
|
||||
/**
|
||||
* Add an existing profile
|
||||
* @param profile {IProfile} Profile to add.
|
||||
*/
|
||||
addProfile(profile: IProfile): void;
|
||||
|
||||
/**
|
||||
* Create a createMap curry function which expects only a destination key.
|
||||
* @param {string} sourceKey The map source key.
|
||||
* @returns {(destinationKey: string) => IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
createMap?(sourceKey: string): (destinationKey: string) => ICreateMapFluentFunctions;
|
||||
|
||||
/**
|
||||
* Create a mapping profile.
|
||||
* @param {string} sourceKey The map source key.
|
||||
* @param {string} destinationKey The map destination key.
|
||||
* @returns {Core.IAutoMapperCreateMapChainingFunctions}
|
||||
*/
|
||||
createMap?(sourceKey: string, destinationKey: string): ICreateMapFluentFunctions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a named configuration for maps. Naming conventions become scoped per profile.
|
||||
*/
|
||||
export interface IProfile {
|
||||
/** Profile name */
|
||||
profileName: string;
|
||||
|
||||
/** Naming convention for source members */
|
||||
sourceMemberNamingConvention: INamingConvention;
|
||||
|
||||
/** Naming convention for destination members */
|
||||
destinationMemberNamingConvention: INamingConvention;
|
||||
|
||||
/**
|
||||
* Implement this method in a derived class and call the CreateMap method to associate that map with this profile.
|
||||
* Avoid calling the AutoMapper class / automapper instance from this method.
|
||||
*/
|
||||
configure: () => void;
|
||||
}
|
||||
|
||||
export interface IMapItemFunction {
|
||||
(mapping: IMapping, sourceObject: any, destinationObject: any): any;
|
||||
}
|
||||
|
||||
export interface IAsyncMapItemFunction {
|
||||
(mapping: IMapping, sourceObject: any, destinationObject: any, callback: IMapCallback): void;
|
||||
}
|
||||
|
||||
interface ICreateMapParameters {
|
||||
mapping: IMapping;
|
||||
destinationProperty: string;
|
||||
conversionValueOrFunction: any;
|
||||
sourceMapping: boolean;
|
||||
fluentFunctions: ICreateMapFluentFunctions;
|
||||
}
|
||||
|
||||
interface IGetOrCreatePropertyParameters {
|
||||
propertyNameParts: string[];
|
||||
mapping: IMapping;
|
||||
parent?: IProperty;
|
||||
propertyArray: IProperty[];
|
||||
destination?: string;
|
||||
sourceMapping: boolean;
|
||||
}
|
||||
|
||||
interface ICreatePropertyParameters {
|
||||
name: string;
|
||||
mapping: IMapping;
|
||||
parent: IProperty;
|
||||
propertyArray: IProperty[];
|
||||
sourceMapping: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare var automapper: AutoMapperJs.AutoMapper;
|
||||
@@ -0,0 +1,57 @@
|
||||
/// <reference path="awesomplete.d.ts" />
|
||||
|
||||
var input = document.getElementById("myinput");
|
||||
new Awesomplete(input, {list: "#mylist"});
|
||||
|
||||
new Awesomplete(input, {list: document.querySelector("#mylist")});
|
||||
|
||||
new Awesomplete(input, {
|
||||
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
|
||||
});
|
||||
|
||||
var awesomplete = new Awesomplete(input);
|
||||
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
|
||||
|
||||
new Awesomplete(input, {
|
||||
list: [
|
||||
{ label: "Belarus", value: "BY" },
|
||||
{ label: "China", value: "CN" },
|
||||
{ label: "United States", value: "US" }
|
||||
]
|
||||
});
|
||||
|
||||
// Same with arrays:
|
||||
new Awesomplete(input, {
|
||||
list: [
|
||||
[ "Belarus", "BY" ],
|
||||
[ "China", "CN" ],
|
||||
[ "United States", "US" ]
|
||||
]
|
||||
});
|
||||
|
||||
new Awesomplete('input[type="email"]', {
|
||||
list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", "google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
|
||||
data: function (text: string, input: any) {
|
||||
return input.slice(0, input.indexOf("@")) + "@" + text;
|
||||
},
|
||||
filter: Awesomplete.FILTER_STARTSWITH
|
||||
});
|
||||
|
||||
new Awesomplete('input[data-multiple]', {
|
||||
filter: function(text: string, input: any) {
|
||||
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]);
|
||||
},
|
||||
|
||||
replace: function(text: string) {
|
||||
var before = this.input.value.match(/^.+,\s*|/)[0];
|
||||
this.input.value = before + text + ", ";
|
||||
}
|
||||
});
|
||||
|
||||
var ajax = new XMLHttpRequest();
|
||||
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
|
||||
ajax.onload = function() {
|
||||
var list = JSON.parse(ajax.responseText).map(function(i: any) { return i.name; });
|
||||
new Awesomplete(document.querySelector("#ajax-example input"),{ list: list });
|
||||
};
|
||||
ajax.send();
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
// Type definitions for Awesomplete v1.1.0
|
||||
// Project: https://leaverou.github.io/awesomplete/
|
||||
// Definitions by: webbiesdk <https://github.com/webbiesdk/>, Ben Dixon <https://github.com/bmdixon/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Awesomplete {
|
||||
constructor(input: Element | HTMLElement | string, o?: AwesompleteOptions);
|
||||
static all: Array<any>;
|
||||
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
|
||||
static ITEM: (text: string, input: string) => HTMLElement;
|
||||
static $: {
|
||||
(expr: string|Element, con?: NodeSelector): string | Element;
|
||||
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
|
||||
create: (tag: string, o: any) => HTMLElement;
|
||||
fire: (target: EventTarget, type: string, properties: any) => any;
|
||||
siblingIndex: (el: Element) => number;
|
||||
};
|
||||
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
|
||||
static FILTER_CONTAINS: (text: string, input: string) => boolean;
|
||||
static SORT_BYLENGTH: (a: number | any[], b: number | any[]) => number;
|
||||
static REPLACE: (text: any) => void;
|
||||
next: () => void;
|
||||
container: HTMLElement;
|
||||
select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void;
|
||||
previous: () => void;
|
||||
index: number;
|
||||
opened: number;
|
||||
list: string | string[] | Element | { label: string, value: any }[] | [string, string][];
|
||||
input: HTMLElement | string;
|
||||
goto: (i: number) => void;
|
||||
ul: HTMLElement;
|
||||
close: () => void;
|
||||
evaluate: () => void;
|
||||
selected: boolean;
|
||||
open: () => void;
|
||||
status: HTMLElement;
|
||||
}
|
||||
|
||||
interface AwesompleteOptions {
|
||||
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
|
||||
minChars?: Number;
|
||||
maxItems?: Number;
|
||||
autoFirst?: boolean;
|
||||
data?: Function;
|
||||
filter?: Function;
|
||||
sort?: Function;
|
||||
item?: Function;
|
||||
replace?: Function;
|
||||
}
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
import lambda = require('aws-lambda');
|
||||
|
||||
var str: string;
|
||||
var date: Date;
|
||||
var anyObj: any;
|
||||
var num: number;
|
||||
var str: string = "any string";
|
||||
var date: Date = new Date();
|
||||
var anyObj: any = { abc: 123 };
|
||||
var num: number = 5;
|
||||
var identity: lambda.CognitoIdentity;
|
||||
var error: Error;
|
||||
var b: boolean;
|
||||
var error: Error = new Error();
|
||||
var b: boolean = true;
|
||||
var clientCtx: lambda.ClientContext;
|
||||
|
||||
/* Context */
|
||||
@@ -37,4 +37,14 @@ function callback(cb: lambda.Callback) {
|
||||
cb(null);
|
||||
cb(error);
|
||||
cb(null, anyObj);
|
||||
}
|
||||
}
|
||||
|
||||
/* Compatibility functions */
|
||||
context.done();
|
||||
context.done(error);
|
||||
context.done(error, anyObj);
|
||||
context.succeed(str);
|
||||
context.succeed(anyObj);
|
||||
context.succeed(str, anyObj);
|
||||
context.fail(error);
|
||||
context.fail(str);
|
||||
Vendored
+3
-1
@@ -23,7 +23,9 @@ declare module "aws-lambda" {
|
||||
getRemainingTimeInMillis(): number;
|
||||
|
||||
// Functions for compatibility with earlier Node.js Runtime v0.10.42
|
||||
log(message: string, object: any): void;
|
||||
// For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods
|
||||
done(error?: Error, result?: any): void;
|
||||
fail(error: Error): void;
|
||||
fail(message: string): void;
|
||||
succeed(message: string): void;
|
||||
succeed(object: any): void;
|
||||
|
||||
Vendored
+39
-3
@@ -382,7 +382,8 @@ declare module "aws-sdk" {
|
||||
endpoint: Endpoint;
|
||||
|
||||
getObject(params: s3.GetObjectRequest, callback?: (err: Error, data: any) => void): any;
|
||||
putObject(params: s3.PutObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
putObject(params: s3.PutObjectRequest, callback?: (err: Error, data: any) => void): any;
|
||||
copyObject(params: s3.CopyObjectRequest, callback?: (err: Error, data: any) => void): any;
|
||||
deleteObject(params: s3.DeleteObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
headObject(params: s3.HeadObjectRequest, callback: (err: Error, data: any) => void): void;
|
||||
getSignedUrl(operation: string, params: any): string;
|
||||
@@ -527,7 +528,8 @@ declare module "aws-sdk" {
|
||||
|
||||
interface UpdateParam extends _DDBDC_Writer {
|
||||
Key: _DDBDC_Keys;
|
||||
AttributeUpdates: {
|
||||
UpdateExpression?: string;
|
||||
AttributeUpdates?: {
|
||||
[someKey: string]: {
|
||||
Action: "PUT" | "ADD" | "DELETE";
|
||||
Value: any
|
||||
@@ -658,7 +660,7 @@ declare module "aws-sdk" {
|
||||
|
||||
export interface DescribeStackResourcesParams {
|
||||
StackName?: string; // must specify either StackName or PhysicalResourceId
|
||||
LogicalResourceId?: string;
|
||||
LogicalResourceId?: string;
|
||||
PhysicalResourceId?: string; // must specify either StackName or PhysicalResourceId
|
||||
}
|
||||
|
||||
@@ -2262,6 +2264,40 @@ declare module "aws-sdk" {
|
||||
WebsiteRedirectLocation?: string;
|
||||
}
|
||||
|
||||
export interface CopyObjectRequest {
|
||||
Bucket: string;
|
||||
CopySource: string;
|
||||
Key: string;
|
||||
ACL?: string;
|
||||
CacheControl?: string;
|
||||
ContentDisposition?: string;
|
||||
ContentEncoding?: string;
|
||||
ContentLanguage?: string;
|
||||
ContentType?: string;
|
||||
CopySourceIfMatch?: string;
|
||||
CopySourceIfModifiedSince?: any;
|
||||
CopySourceIfNoneMatch?: string;
|
||||
CopySourceIfUnmodifiedSince?: any;
|
||||
CopySourceSSECustomerAlgorithm?: string;
|
||||
CopySourceSSECustomerKey?: any;
|
||||
CopySourceSSECustomerKeyMD5?: string;
|
||||
Expires?: any;
|
||||
GrantFullControl?: string;
|
||||
GrantRead?: string;
|
||||
GrantReadACP?: string;
|
||||
GrantWriteACP?: string;
|
||||
Metadata?: { [key: string]: string; };
|
||||
MetadataDirective?: string;
|
||||
RequestPayer?: string;
|
||||
SSECustomerAlgorithm?: string;
|
||||
SSECustomerKey?: any;
|
||||
SSECustomerKeyMD5?: string;
|
||||
SSEKMSKeyId?: string;
|
||||
ServerSideEncryption?: string;
|
||||
StorageClass?: string;
|
||||
WebsiteRedirectLocation?: string;
|
||||
}
|
||||
|
||||
export interface GetObjectRequest {
|
||||
Bucket: string;
|
||||
IfMatch?: string;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/// <reference path="./aws-serverless-express.d.ts" />
|
||||
/// <reference path="../express/express.d.ts"/>
|
||||
|
||||
import * as awsServerlessExpress from 'aws-serverless-express';
|
||||
import * as express from 'express';
|
||||
|
||||
const app = express();
|
||||
const server = awsServerlessExpress.createServer(app, () => {});
|
||||
|
||||
const mockEvent = {
|
||||
key: 'value'
|
||||
};
|
||||
|
||||
const mockContext = {
|
||||
callbackWaitsForEmptyEventLoop: true,
|
||||
functionName: 'testFunction',
|
||||
functionVersion: '1',
|
||||
invokedFunctionArn: 'arn',
|
||||
memoryLimitInMB: 128,
|
||||
awsRequestId: 'id',
|
||||
logGroupName: 'group',
|
||||
logStreamName: 'stream',
|
||||
getRemainingTimeInMillis: () => 2000,
|
||||
done: () => false,
|
||||
fail: (error: any) => false,
|
||||
succeed: (message: string) => false
|
||||
};
|
||||
|
||||
awsServerlessExpress.proxy(server, mockEvent, mockContext);
|
||||
@@ -0,0 +1,24 @@
|
||||
// Type definitions for aws-serverless-express
|
||||
// Project: https://github.com/awslabs/aws-serverless-express
|
||||
// Definitions by: Ben Speakman <https://github.com/threesquared>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="../aws-lambda/aws-lambda.d.ts"/>
|
||||
|
||||
declare module 'aws-serverless-express' {
|
||||
|
||||
import * as http from 'http';
|
||||
import * as lambda from 'aws-lambda';
|
||||
|
||||
export function createServer(
|
||||
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server,
|
||||
serverListenCallback?: () => any
|
||||
): http.Server;
|
||||
|
||||
export function proxy(
|
||||
server: http.Server,
|
||||
event: any,
|
||||
context: lambda.Context
|
||||
): void;
|
||||
}
|
||||
@@ -69,6 +69,10 @@ axios.post("http://example.com/", {
|
||||
]
|
||||
});
|
||||
|
||||
var config: Axios.AxiosXHRConfigBase<any> = {headers: {}};
|
||||
config.headers['X-Custom-Header'] = 'baz';
|
||||
axios.post("http://example.com/", config);
|
||||
|
||||
var getRepoIssue = axios.get<Issue>("https://api.github.com/repos/mzabriskie/axios/issues/1");
|
||||
|
||||
var axiosInstance = axios.create({
|
||||
|
||||
Vendored
+1
-1
@@ -39,7 +39,7 @@ declare namespace Axios {
|
||||
/**
|
||||
* custom headers to be sent
|
||||
*/
|
||||
headers?: Object;
|
||||
headers?: {[key: string]: any};
|
||||
|
||||
/**
|
||||
* URL parameters to be sent with the request
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="./bases.d.ts" />
|
||||
import * as bases from 'bases';
|
||||
|
||||
let bs16String: string = bases.toBase(200, 16); // => 'c8'
|
||||
let bs62String: string = bases.toBase(99999, 62); // => 'q0T'
|
||||
let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba'
|
||||
|
||||
let frombs16Int: number = bases.fromBase('c8', 16); // => 200
|
||||
let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999
|
||||
let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for bases 0.2.1
|
||||
// Project: https://github.com/aseemk/bases.js
|
||||
// Definitions by: Hari Krishna <https://github.com/harikv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bases" {
|
||||
export function toAlphabet(num: number, alphabet: string): string;
|
||||
|
||||
export function fromAlphabet(str: string, alphabet: string): number;
|
||||
|
||||
export function toBase(num: number, base: number): string;
|
||||
|
||||
export function fromBase(str: string, base:number): number;
|
||||
|
||||
export let KNOWN_ALPHABETS: any;
|
||||
|
||||
export let NUMERALS: string;
|
||||
|
||||
export let LETTERS_LOWERCASE: string;
|
||||
|
||||
export let LETTERS_UPPERCASE: string;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="billplz.d.ts" />
|
||||
|
||||
import * as Billplz from 'billplz';
|
||||
|
||||
const billplz = new Billplz({
|
||||
key: 'your-api-key',
|
||||
endpoint: 'http://localhost/',
|
||||
sandbox: true
|
||||
});
|
||||
|
||||
// test create collection
|
||||
billplz.create_collection({
|
||||
title: 'your-title'
|
||||
});
|
||||
|
||||
// test create open collection
|
||||
billplz.create_collectionOpen({
|
||||
title: 'your-title',
|
||||
description: 'your-description',
|
||||
amount: 100
|
||||
});
|
||||
|
||||
// test create bill
|
||||
billplz.create_bill({
|
||||
collection_id: 'your-collection-id',
|
||||
description: 'your-description',
|
||||
email: 'your-email',
|
||||
mobile: 12345,
|
||||
name: 'your-name',
|
||||
amount: 100,
|
||||
callback_url: 'https://example.com/webhook/',
|
||||
redirect_url: 'https://example.com/done',
|
||||
due_at: '0000-00-00'
|
||||
});
|
||||
|
||||
// test get bill
|
||||
billplz.get_bill('your-bill-id');
|
||||
|
||||
// test delete bill
|
||||
billplz.delete_bill('your-bill-id');
|
||||
|
||||
// test change collection status
|
||||
billplz.change_collection_status('your-collection-id', 'status-here');
|
||||
|
||||
// test registration check
|
||||
billplz.registration_check('your-bank-account-number');
|
||||
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
// Type definitions for billplz 1.0.2
|
||||
// Project: https://github.com/suhz/node-billplz
|
||||
// Definitions by: Akim <https://github.com/Akim95>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module Billplz {
|
||||
// api options type
|
||||
interface BillplzOptions {
|
||||
key: string;
|
||||
endpoint?: string;
|
||||
sandbox?: boolean;
|
||||
}
|
||||
|
||||
// collection type
|
||||
interface CollectionArguments {
|
||||
title: string;
|
||||
}
|
||||
|
||||
// open collection type
|
||||
interface OpenCollectionArguments {
|
||||
title: string;
|
||||
description: string;
|
||||
amount: number;
|
||||
fixed_amount?: boolean;
|
||||
fixed_quantity?: boolean;
|
||||
payment_button?: string;
|
||||
reference_1_label?: string
|
||||
reference_2_label?: string;
|
||||
email_link?: string;
|
||||
tax?: number;
|
||||
}
|
||||
|
||||
// bill type
|
||||
interface BillArguments {
|
||||
collection_id: string;
|
||||
email: string;
|
||||
mobile: number;
|
||||
name: string;
|
||||
amount: number;
|
||||
callback_url: string;
|
||||
description: string;
|
||||
due_at?: string;
|
||||
redirect_url?: string;
|
||||
deliver?: boolean;
|
||||
reference_1_label?: string;
|
||||
reference_1?: string;
|
||||
reference_2_label?: string;
|
||||
reference_2?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare class Billplz {
|
||||
// constructor
|
||||
constructor(options: string | Billplz.BillplzOptions);
|
||||
|
||||
// create_collection
|
||||
create_collection(title: Billplz.CollectionArguments, callback?: (res: any, err: any) => void): void;
|
||||
|
||||
// create collectionOpen
|
||||
create_collectionOpen(args: Billplz.OpenCollectionArguments, callback?: (res: any, err: any) => void): void;
|
||||
|
||||
// create bill
|
||||
create_bill(args: Billplz.BillArguments, callback?: (res: any, err: any) => void): void;
|
||||
|
||||
// get bill
|
||||
get_bill(billId: string, callback?: (res: any, err: any) => void): void;
|
||||
|
||||
// delete bill
|
||||
delete_bill(billId: string, callback?: (res: any, err: any) => void): void;
|
||||
|
||||
// change_collection status
|
||||
change_collection_status(collectionId: string, status: string, callback?: (res: any, err: any) => void): void;
|
||||
|
||||
// registration check
|
||||
registration_check(bankAccountNumber: string, callback?: (res: any, err: any) => void): void;
|
||||
}
|
||||
|
||||
declare module "billplz" {
|
||||
export = Billplz;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="bonjour.d.ts" />
|
||||
import * as bonjour from 'bonjour';
|
||||
|
||||
var bonjourOptions: bonjour.BonjourOptions;
|
||||
var bonjourInstance: bonjour.Bonjour;
|
||||
|
||||
var serviceOptions: bonjour.ServiceOptions;
|
||||
var service: bonjour.Service;
|
||||
|
||||
var browserOptions: bonjour.BrowserOptions;
|
||||
var browser: bonjour.Browser;
|
||||
|
||||
bonjourOptions = { interface: '192.168.1.1', port: 5353 };
|
||||
bonjourInstance = new bonjour.Bonjour(bonjourOptions);
|
||||
|
||||
serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 };
|
||||
service = bonjourInstance.publish(serviceOptions);
|
||||
|
||||
browserOptions = { protocol: 'tcp', type: 'http' };
|
||||
browser = bonjour.find(browserOptions);
|
||||
|
||||
Vendored
+71
@@ -0,0 +1,71 @@
|
||||
// Type definitions for bonjour v3.5.0
|
||||
// Project: https://github.com/watson/bonjour
|
||||
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "bonjour" {
|
||||
export interface BonjourOptions {
|
||||
multicast?: boolean;
|
||||
interface?: string;
|
||||
port?: number;
|
||||
ip?: string;
|
||||
ttl?: number;
|
||||
loopback?: boolean;
|
||||
reuseAddr?: boolean;
|
||||
}
|
||||
|
||||
export interface BrowserOptions {
|
||||
type?: string;
|
||||
subtypes?: string[];
|
||||
protocol?: string;
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface ServiceOptions {
|
||||
name: string;
|
||||
host?: string;
|
||||
port: number;
|
||||
type: string;
|
||||
subtypes?: string[];
|
||||
protocol?: 'udp'|'tcp';
|
||||
txt?: Object;
|
||||
}
|
||||
|
||||
export interface Service {
|
||||
name: string;
|
||||
type: string;
|
||||
subtypes: string[];
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
fqdn: string;
|
||||
rawTxt: Object;
|
||||
txt: Object;
|
||||
published: boolean;
|
||||
|
||||
stop: (cb: ()=>any) => void;
|
||||
start: () => void;
|
||||
}
|
||||
|
||||
export class Bonjour {
|
||||
|
||||
constructor(opts: BonjourOptions);
|
||||
publish(options: ServiceOptions):Service;
|
||||
unpublishAll(cb: ()=>any): void;
|
||||
find(options:BrowserOptions, onUp: ()=>any): Browser;
|
||||
findOne(options:any, cb: (service: Service)=>any): Browser;
|
||||
destroy():void;
|
||||
}
|
||||
|
||||
export class Browser {
|
||||
services: Service[];
|
||||
|
||||
start():void;
|
||||
update():void;
|
||||
stop():void;
|
||||
}
|
||||
|
||||
export function find(options: BrowserOptions, onUp?: ()=>any): Browser;
|
||||
export function findOne(options: BrowserOptions): Browser;
|
||||
|
||||
}
|
||||
Vendored
+1
@@ -40,6 +40,7 @@ interface BootboxConfirmOptions extends BootboxDialogOptions {
|
||||
interface BootboxPromptOptions extends BootboxBaseOptions {
|
||||
title: string;
|
||||
value?: string;
|
||||
inputType?: string;
|
||||
callback: (result: string) => any;
|
||||
buttons?: BootboxConfirmPromptButtonMap;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ interface DatepickerOptions {
|
||||
multidateSeparator?: string;
|
||||
orientation?: string;
|
||||
assumeNearbyYear?: any;
|
||||
viewMode?: string;
|
||||
}
|
||||
|
||||
interface DatepickerCustomFormatOptions {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// Bootstrap Select Test
|
||||
// ================================================================================
|
||||
/// <reference path="bootstrap-select.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
$(".selectpicker").selectpicker({
|
||||
actionsBox: true,
|
||||
container: "body",
|
||||
countSelectedText: "counts > #",
|
||||
deselectAllText: "test",
|
||||
dropdownAlignRight: true,
|
||||
dropupAuto: true,
|
||||
header: "test",
|
||||
hideDisabled: true,
|
||||
iconBase: "fa",
|
||||
liveSearch: true,
|
||||
liveSearchNormalize: true,
|
||||
liveSearchPlaceholder: "test",
|
||||
liveSearchStyle: "contains",
|
||||
maxOptions: 10,
|
||||
maxOptionsText: "test",
|
||||
mobile: true,
|
||||
multipleSeparator: ", ",
|
||||
noneSelectedText: "test",
|
||||
selectAllText: "test",
|
||||
selectedTextFormat: "values",
|
||||
selectOnTab: true,
|
||||
showContent: true,
|
||||
showIcon: true,
|
||||
showSubtext: true,
|
||||
showTick: true,
|
||||
size: "auto",
|
||||
style: "test",
|
||||
tickIcon: "test",
|
||||
title: "test",
|
||||
width: "auto"
|
||||
})
|
||||
|
||||
$(".selectpicker").selectpicker("val", "foo")
|
||||
$(".selectpicker").selectpicker("val", ["foo", "bar"])
|
||||
$(".selectpicker").selectpicker("selectAll")
|
||||
$(".selectpicker").selectpicker("setStyle", "btn-large", "add")
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for bootstrap-select v1.11.2
|
||||
// Project: https://silviomoreto.github.io/bootstrap-select/
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface BootstrapSelectOptions {
|
||||
actionsBox?: boolean
|
||||
container?: string | boolean
|
||||
countSelectedText?: string | Function
|
||||
deselectAllText?: string
|
||||
dropdownAlignRight?: string | boolean
|
||||
dropupAuto?: boolean
|
||||
header?: string
|
||||
hideDisabled?: boolean
|
||||
iconBase?: string
|
||||
liveSearch?: boolean
|
||||
liveSearchNormalize?: boolean
|
||||
liveSearchPlaceholder?: string
|
||||
liveSearchStyle?: string
|
||||
maxOptions?: number | boolean
|
||||
maxOptionsText?: string | Array<any> | Function
|
||||
mobile?: boolean
|
||||
multipleSeparator?: string
|
||||
noneSelectedText?: string
|
||||
selectAllText?: string
|
||||
selectedTextFormat?: string
|
||||
selectOnTab?: boolean
|
||||
showContent?: boolean
|
||||
showIcon?: boolean
|
||||
showSubtext?: boolean
|
||||
showTick?: boolean
|
||||
size?: string | number | boolean
|
||||
style?: string
|
||||
tickIcon?: string
|
||||
title?: string
|
||||
width?: string | boolean
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
selectpicker(opts?: BootstrapSelectOptions): void
|
||||
selectpicker(method: string, ...args: Array<string | Array<string>>): void
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for Bootstrap Table v1.11.0
|
||||
// Project: http://bootstrap-table.wenzhixin.net.cn/
|
||||
// Definitions by: Talat Baig <https://github.com/talatbaig/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface JQuery {
|
||||
bootstrapTable(options?: any): JQuery;
|
||||
}
|
||||
|
||||
declare var bootstrapTable: JQueryStatic;
|
||||
@@ -50,10 +50,18 @@ braintree.client.create({
|
||||
selector: '#card-number'
|
||||
},
|
||||
cvv: {
|
||||
selector: '#cvv'
|
||||
selector: '#cvv',
|
||||
type: 'password'
|
||||
},
|
||||
expirationDate: {
|
||||
selector: '#expiration-date'
|
||||
expirationMonth: {
|
||||
selector: '#expiration-month',
|
||||
select: {
|
||||
options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"]
|
||||
}
|
||||
},
|
||||
expirationYear: {
|
||||
selector: '#expiration-year',
|
||||
select: true
|
||||
}
|
||||
}
|
||||
}, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
|
||||
|
||||
Vendored
+7
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Braintree-web v3.0.2
|
||||
// Type definitions for Braintree-web v3.5.0
|
||||
// Project: https://github.com/braintree/braintree-web
|
||||
// Definitions by: Guy Shahine <https://github.com/chlela>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -540,12 +540,17 @@ declare namespace BraintreeWeb {
|
||||
* @typedef {object} field
|
||||
* @property {string} selector A CSS selector to find the container where the hosted field will be inserted.
|
||||
* @property {string} [placeholder] Will be used as the `placeholder` attribute of the input. If `placeholder` is not natively supported by the browser, it will be polyfilled.
|
||||
* @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field. Note: Input formatting does not work properly on Android and iOS, so input formatting is automatically disabled on those browsers.
|
||||
* @property {string} [type] Will be used as the `type` attribute of the input. To mask `cvv` input, for instance, `type: "password"` can be used.
|
||||
* @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field.
|
||||
* @property {object|boolean} [select] If truthy, this field becomes a `<select>` dropdown list. This can only be used for `expirationMonth` and `expirationYear` fields.
|
||||
* @property {string[]} [select.options] An array of 12 strings, one per month. This can only be used for the `expirationMonth` field. For example, the array can look like `['01 - January', '02 - February', ...]`.
|
||||
*/
|
||||
interface HostedFieldsField {
|
||||
selector: string;
|
||||
placeholder?: string;
|
||||
type?: string;
|
||||
formatInput?: boolean;
|
||||
select?: boolean | { options: string[] };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for bull 0.7.0
|
||||
// Type definitions for bull 1.0.0
|
||||
// Project: https://github.com/OptimalBits/bull
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -24,7 +24,7 @@ declare module "bull" {
|
||||
|
||||
export interface Job {
|
||||
|
||||
id: string
|
||||
jobId: string
|
||||
|
||||
/**
|
||||
* The custom data passed when the job was created
|
||||
|
||||
@@ -56,7 +56,20 @@ var options:bunyan.LoggerOptions = {
|
||||
|
||||
var log = bunyan.createLogger(options);
|
||||
|
||||
var customSerializer = function(anything: any) {
|
||||
return { obj: anything};
|
||||
};
|
||||
|
||||
log.addSerializers({anything: customSerializer});
|
||||
log.addSerializers(bunyan.stdSerializers);
|
||||
log.addSerializers(
|
||||
{
|
||||
err: bunyan.stdSerializers.err,
|
||||
req: bunyan.stdSerializers.req,
|
||||
res: bunyan.stdSerializers.res
|
||||
}
|
||||
);
|
||||
|
||||
var child = log.child({name: 'child'});
|
||||
child.reopenFileStreams();
|
||||
log.addStream({path: '/dev/null'});
|
||||
|
||||
Vendored
+14
-4
@@ -11,7 +11,7 @@ declare module "bunyan" {
|
||||
class Logger extends EventEmitter {
|
||||
constructor(options:LoggerOptions);
|
||||
addStream(stream:Stream):void;
|
||||
addSerializers(serializers:Serializers):void;
|
||||
addSerializers(serializers:Serializers | StdSerializers):void;
|
||||
child(options:LoggerOptions, simple?:boolean):Logger;
|
||||
child(obj:Object, simple?:boolean):Logger;
|
||||
reopenFileStreams():void;
|
||||
@@ -21,7 +21,7 @@ declare module "bunyan" {
|
||||
levels(name: number | string, value: number | string):void;
|
||||
|
||||
fields:any;
|
||||
src:boolean;
|
||||
src:boolean;
|
||||
|
||||
trace(error:Error, format?:any, ...params:any[]):void;
|
||||
trace(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
@@ -58,8 +58,18 @@ declare module "bunyan" {
|
||||
src?: boolean;
|
||||
}
|
||||
|
||||
interface Serializer {
|
||||
(input:any): any;
|
||||
}
|
||||
|
||||
interface Serializers {
|
||||
[key:string]: (input:any) => string;
|
||||
[key:string]: Serializer;
|
||||
}
|
||||
|
||||
interface StdSerializers {
|
||||
err: Serializer;
|
||||
res: Serializer;
|
||||
req: Serializer;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
@@ -72,7 +82,7 @@ declare module "bunyan" {
|
||||
count?: number;
|
||||
}
|
||||
|
||||
export var stdSerializers:Serializers;
|
||||
export var stdSerializers: StdSerializers;
|
||||
|
||||
export var TRACE:number;
|
||||
export var DEBUG:number;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path="./bwip-js.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
'use strict';
|
||||
|
||||
import * as bwipjs from 'bwip-js';
|
||||
import * as http from 'http';
|
||||
import * as fs from 'fs';
|
||||
|
||||
bwipjs.loadFont('Inconsolata', 108,
|
||||
fs.readFileSync('fonts/Inconsolata.otf', 'binary'));
|
||||
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
// If the url does not begin /?bcid= then 404. Otherwise, we end up
|
||||
// returning 400 on requests like favicon.ico.
|
||||
if (req.url.indexOf('/?bcid=') != 0) {
|
||||
res.writeHead(404, { 'Content-Type':'text/plain' });
|
||||
res.end('BWIPJS: Unknown request format.', 'utf8');
|
||||
} else {
|
||||
bwipjs(req, res);
|
||||
}
|
||||
|
||||
}).listen(3030);
|
||||
|
||||
bwipjs.toBuffer({
|
||||
bcid: 'code128', // Barcode type
|
||||
text: '0123456789', // Text to encode
|
||||
scale: 3, // 3x scaling factor
|
||||
height: 10, // Bar height, in millimeters
|
||||
includetext: true, // Show human-readable text
|
||||
textxalign: 'center', // Always good to set this
|
||||
textfont: 'Inconsolata', // Use your custom font
|
||||
textsize: 13 // Font size, in points
|
||||
}, function (err:string|Error, png: Buffer) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
} else {
|
||||
// `png` is a Buffer
|
||||
// png.length : PNG file length
|
||||
// png.readUInt32BE(16) : PNG image width
|
||||
// png.readUInt32BE(20) : PNG image height
|
||||
}
|
||||
});
|
||||
Vendored
+86
@@ -0,0 +1,86 @@
|
||||
// Type definitions for bwip-js 1.1.1
|
||||
// Project: https://github.com/metafloor/bwip-js
|
||||
// Definitions by: TANAKA Koichi <https://github.com/MugeSo/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'bwip-js' {
|
||||
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
|
||||
|
||||
module BwipJs {
|
||||
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
|
||||
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
|
||||
interface ToBufferOptions {
|
||||
bcid: string;
|
||||
text: string;
|
||||
|
||||
parse?: boolean;
|
||||
parsefunc?: boolean;
|
||||
|
||||
height?: number;
|
||||
width?: number;
|
||||
|
||||
scaleX?: number;
|
||||
scaleY?: number;
|
||||
scale?: number;
|
||||
|
||||
rotate?: 'N'|'R'|'L'|'I';
|
||||
|
||||
paddingwidth?: number;
|
||||
paddingheight?: number;
|
||||
|
||||
monochrome?: boolean;
|
||||
alttext?: boolean;
|
||||
|
||||
includetext?: boolean;
|
||||
textfont?: string;
|
||||
textsize?: number;
|
||||
textgaps?: number;
|
||||
|
||||
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
|
||||
textyalign?:'below'|'center'|'above';
|
||||
textxoffset?: number;
|
||||
textyoffset?: number;
|
||||
|
||||
showborder?: boolean;
|
||||
borderwidth?: number;
|
||||
borderleft?: number;
|
||||
borderright?: number;
|
||||
bordertop?: number;
|
||||
boraderbottom?: number;
|
||||
|
||||
barcolor?: string;
|
||||
backgroundcolor?: string;
|
||||
bordercolor?: string;
|
||||
textcolor?: string;
|
||||
|
||||
addontextxoffset?: number;
|
||||
addontextyoffset?: number;
|
||||
addontextfont?: string;
|
||||
addontextsize?: number;
|
||||
|
||||
guardwhitespace?: boolean;
|
||||
guardwidth?: number;
|
||||
guardheight?: number;
|
||||
guardleftpos?: number;
|
||||
guardrightpos?: number;
|
||||
guardleftypos?: number;
|
||||
guardrightypos?: number;
|
||||
|
||||
sizelimit?: number;
|
||||
|
||||
includecheck?: boolean;
|
||||
includecheckintext?: boolean;
|
||||
|
||||
inkspread?: number;
|
||||
inkspreadh?: number;
|
||||
inkspreadv?: number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
|
||||
|
||||
export = BwipJs;
|
||||
}
|
||||
@@ -7,8 +7,9 @@
|
||||
import fs = require( 'fs' );
|
||||
import byline = require( 'byline' );
|
||||
|
||||
//TODO can this be typed in an ambient way?
|
||||
//var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
|
||||
var stream = byline();
|
||||
|
||||
var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
|
||||
|
||||
var stream = byline.createStream( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
|
||||
|
||||
@@ -44,4 +45,4 @@ var output = fs.createWriteStream('nolines.txt');
|
||||
|
||||
var lineStream:byline.LineStream = new LineStream();
|
||||
input.pipe(lineStream);
|
||||
lineStream.pipe(output);
|
||||
lineStream.pipe(output);
|
||||
|
||||
Vendored
+21
-25
@@ -8,31 +8,27 @@
|
||||
declare module "byline" {
|
||||
import stream = require("stream");
|
||||
|
||||
export interface LineStreamOptions extends stream.TransformOptions {
|
||||
keepEmptyLines?: boolean;
|
||||
function bl(): bl.LineStream;
|
||||
function bl(stream: NodeJS.ReadableStream, options?: bl.LineStreamOptions): bl.LineStream;
|
||||
|
||||
namespace bl {
|
||||
|
||||
export interface LineStreamOptions extends stream.TransformOptions {
|
||||
keepEmptyLines?: boolean;
|
||||
}
|
||||
|
||||
export interface LineStream extends stream.Transform {
|
||||
}
|
||||
|
||||
export interface LineStreamCreatable extends LineStream {
|
||||
new (options?: LineStreamOptions): LineStream
|
||||
}
|
||||
|
||||
export function createStream(): LineStream;
|
||||
export function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
|
||||
|
||||
export var LineStream: LineStreamCreatable;
|
||||
}
|
||||
|
||||
export interface LineStream extends stream.Transform {
|
||||
}
|
||||
|
||||
export interface LineStreamCreatable extends LineStream {
|
||||
new (options?:LineStreamOptions):LineStream
|
||||
}
|
||||
|
||||
//TODO is it possible to declare static factory functions without name (directly on the module)
|
||||
//
|
||||
// JS:
|
||||
// // convinience API
|
||||
// module.exports = function(readStream, options) {
|
||||
// return module.exports.createStream(readStream, options);
|
||||
// };
|
||||
//
|
||||
// TS:
|
||||
// ():LineStream; // same as createStream():LineStream
|
||||
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
|
||||
|
||||
export function createStream():LineStream;
|
||||
export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream;
|
||||
|
||||
export var LineStream:LineStreamCreatable;
|
||||
export = bl;
|
||||
}
|
||||
|
||||
Vendored
+68
-43
@@ -7,19 +7,20 @@
|
||||
declare class CamlBuilder {
|
||||
constructor();
|
||||
/** Generate CAML Query, starting from <Where> tag */
|
||||
public Where(): CamlBuilder.IFieldExpression;
|
||||
Where(): CamlBuilder.IFieldExpression;
|
||||
/** Generate <View> tag for SP.CamlQuery
|
||||
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
|
||||
Specifying view fields is a good practice, as it decreases traffic between server and client. */
|
||||
public View(viewFields?: string[]): CamlBuilder.IView;
|
||||
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
|
||||
Specifying view fields is a good practice, as it decreases traffic between server and client. */
|
||||
View(viewFields?: string[]): CamlBuilder.IView;
|
||||
/** Generate <ViewFields> tag for SPServices */
|
||||
public ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
|
||||
ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
|
||||
/** Use for:
|
||||
1. SPServices CAMLQuery attribute
|
||||
2. Creating partial expressions
|
||||
3. In conjunction with Any & All clauses
|
||||
*/
|
||||
1. SPServices CAMLQuery attribute
|
||||
2. Creating partial expressions
|
||||
3. In conjunction with Any & All clauses
|
||||
*/
|
||||
static Expression(): CamlBuilder.IFieldExpression;
|
||||
static FromXml(xml: string): CamlBuilder.IRawQuery;
|
||||
}
|
||||
declare namespace CamlBuilder {
|
||||
interface IView extends IJoinable, IFinalizable {
|
||||
@@ -29,24 +30,24 @@ declare namespace CamlBuilder {
|
||||
}
|
||||
interface IJoinable {
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@alias alias for the joined list */
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@alias alias for the joined list */
|
||||
InnerJoin(lookupFieldInternalName: string, alias: string): IJoin;
|
||||
/** Join the list you're querying with another list.
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@alias alias for the joined list */
|
||||
Joins are only allowed through a lookup field relation.
|
||||
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
|
||||
@alias alias for the joined list */
|
||||
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
|
||||
}
|
||||
interface IJoin extends IJoinable {
|
||||
/** Select projected field for using in the main Query body
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
interface IProjectableView extends IView {
|
||||
/** Select projected field for using in the main Query body
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
enum ViewScope {
|
||||
@@ -57,7 +58,7 @@ declare namespace CamlBuilder {
|
||||
/** */
|
||||
FilesOnly = 2,
|
||||
}
|
||||
interface IQuery {
|
||||
interface IQuery extends IGroupable {
|
||||
Where(): IFieldExpression;
|
||||
}
|
||||
interface IFinalizableToString {
|
||||
@@ -70,21 +71,21 @@ declare namespace CamlBuilder {
|
||||
}
|
||||
interface ISortable extends IFinalizable {
|
||||
/** Adds OrderBy clause to the query
|
||||
@param fieldInternalName Internal field of the first field by that the data will be sorted (ascending)
|
||||
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
@param fieldInternalName Internal field of the first field by that the data will be sorted (ascending)
|
||||
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
*/
|
||||
OrderBy(fieldInternalName: string, override?: boolean, useIndexForOrderBy?: boolean): ISortedQuery;
|
||||
/** Adds OrderBy clause to the query (using descending order for the first field).
|
||||
@param fieldInternalName Internal field of the first field by that the data will be sorted (descending)
|
||||
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
@param fieldInternalName Internal field of the first field by that the data will be sorted (descending)
|
||||
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
|
||||
*/
|
||||
OrderByDesc(fieldInternalName: string, override?: boolean, useIndexForOrderBy?: boolean): ISortedQuery;
|
||||
}
|
||||
interface IGroupable extends ISortable {
|
||||
/** Adds GroupBy clause to the query.
|
||||
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
|
||||
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
|
||||
GroupBy(fieldInternalName: any): IGroupedQuery;
|
||||
}
|
||||
interface IExpression extends IGroupable {
|
||||
@@ -134,17 +135,19 @@ declare namespace CamlBuilder {
|
||||
DateField(internalName: string): IDateTimeFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is DateTime */
|
||||
DateTimeField(internalName: string): IDateTimeFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is ModStat (moderation status) */
|
||||
ModStatField(internalName: string): IModStatFieldExpression;
|
||||
/** Used in queries for retrieving recurring calendar events.
|
||||
NOTICE: DateRangesOverlap with overlapType other than Now cannot be used with SP.CamlQuery, because it doesn't support
|
||||
CalendarDate and ExpandRecurrence query options. Lists.asmx, however, supports them, so you can still use DateRangesOverlap
|
||||
with SPServices.
|
||||
@param overlapType Defines type of overlap: return all events for a day, for a week, for a month or for a year
|
||||
@param calendarDate Defines date that will be used for determining events for which exactly day/week/month/year will be returned.
|
||||
This value is ignored for overlapType=Now, but for the other overlap types it is mandatory.
|
||||
@param eventDateField Internal name of "Start Time" field (default: "EventDate" - all OOTB Calendar lists use this name)
|
||||
@param endDateField Internal name of "End Time" field (default: "EndDate" - all OOTB Calendar lists use this name)
|
||||
@param recurrenceIDField Internal name of "Recurrence ID" field (default: "RecurrenceID" - all OOTB Calendar lists use this name)
|
||||
*/
|
||||
NOTICE: DateRangesOverlap with overlapType other than Now cannot be used with SP.CamlQuery, because it doesn't support
|
||||
CalendarDate and ExpandRecurrence query options. Lists.asmx, however, supports them, so you can still use DateRangesOverlap
|
||||
with SPServices.
|
||||
@param overlapType Defines type of overlap: return all events for a day, for a week, for a month or for a year
|
||||
@param calendarDate Defines date that will be used for determining events for which exactly day/week/month/year will be returned.
|
||||
This value is ignored for overlapType=Now, but for the other overlap types it is mandatory.
|
||||
@param eventDateField Internal name of "Start Time" field (default: "EventDate" - all OOTB Calendar lists use this name)
|
||||
@param endDateField Internal name of "End Time" field (default: "EndDate" - all OOTB Calendar lists use this name)
|
||||
@param recurrenceIDField Internal name of "Recurrence ID" field (default: "RecurrenceID" - all OOTB Calendar lists use this name)
|
||||
*/
|
||||
DateRangesOverlap(overlapType: DateRangesOverlapType, calendarDate: string, eventDateField?: string, endDateField?: string, recurrenceIDField?: string): IExpression;
|
||||
}
|
||||
interface IBooleanFieldExpression {
|
||||
@@ -201,25 +204,25 @@ declare namespace CamlBuilder {
|
||||
/** Checks whether the value of the field is equal to one of the specified values */
|
||||
In(arrayOfValues: Date[]): IExpression;
|
||||
/** Checks whether the value of the field is equal to the specified value.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
EqualTo(value: string): IExpression;
|
||||
/** Checks whether the value of the field is not equal to the specified value.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
NotEqualTo(value: string): IExpression;
|
||||
/** Checks whether the value of the field is greater than the specified value.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
GreaterThan(value: string): IExpression;
|
||||
/** Checks whether the value of the field is less than the specified value.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
LessThan(value: string): IExpression;
|
||||
/** Checks whether the value of the field is greater than or equal to the specified value.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
GreaterThanOrEqualTo(value: string): IExpression;
|
||||
/** Checks whether the value of the field is less than or equal to the specified value.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
LessThanOrEqualTo(value: string): IExpression;
|
||||
/** Checks whether the value of the field is equal to one of the specified values.
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
The datetime value should be defined in ISO 8601 format! */
|
||||
In(arrayOfValues: string[]): IExpression;
|
||||
}
|
||||
interface ITextFieldExpression {
|
||||
@@ -322,6 +325,27 @@ declare namespace CamlBuilder {
|
||||
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
|
||||
NotEqualTo(value: any): IExpression;
|
||||
}
|
||||
interface IModStatFieldExpression {
|
||||
/** Represents moderation status ID. */
|
||||
ModStatId(): INumberFieldExpression;
|
||||
/** Checks whether the value of the field is Approved - same as ModStatId.EqualTo(0) */
|
||||
IsApproved(): IExpression;
|
||||
/** Checks whether the value of the field is Rejected - same as ModStatId.EqualTo(1) */
|
||||
IsRejected(): IExpression;
|
||||
/** Checks whether the value of the field is Pending - same as ModStatId.EqualTo(2) */
|
||||
IsPending(): IExpression;
|
||||
/** Represents moderation status as localized text. In most cases it is better to use ModStatId in the queries instead of ValueAsText. */
|
||||
ValueAsText(): ITextFieldExpression;
|
||||
}
|
||||
interface IRawQuery {
|
||||
/** Change Where clause */
|
||||
ReplaceWhere(): IFieldExpression;
|
||||
ModifyWhere(): IRawQueryModify;
|
||||
}
|
||||
interface IRawQueryModify {
|
||||
AppendOr(): IFieldExpression;
|
||||
AppendAnd(): IFieldExpression;
|
||||
}
|
||||
enum DateRangesOverlapType {
|
||||
/** Returns events for today */
|
||||
Now = 0,
|
||||
@@ -330,7 +354,7 @@ declare namespace CamlBuilder {
|
||||
/** Returns events for one week, specified by CalendarDate in QueryOptions */
|
||||
Week = 2,
|
||||
/** Returns events for one month, specified by CalendarDate in QueryOptions.
|
||||
Caution: usually also returns few days from previous and next months */
|
||||
Caution: usually also returns few days from previous and next months */
|
||||
Month = 3,
|
||||
/** Returns events for one year, specified by CalendarDate in QueryOptions */
|
||||
Year = 4,
|
||||
@@ -340,6 +364,7 @@ declare namespace CamlBuilder {
|
||||
static createViewFields(viewFields: string[]): IFinalizableToString;
|
||||
static createWhere(): IFieldExpression;
|
||||
static createExpression(): IFieldExpression;
|
||||
static createRawQuery(xml: string): IRawQuery;
|
||||
}
|
||||
class CamlValues {
|
||||
/** Dynamic value that represents Id of the current user */
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for canvas-gauges
|
||||
// Type definitions for canvas-gauges v2.0.8
|
||||
// Project: https://github.com/Mikhus/canvas-gauges
|
||||
// Definitions by: Mikhus <https://github.com/Mikhus>
|
||||
// Definitions: https://github.com/Mikhus/DefinitelyTyped
|
||||
|
||||
Vendored
+30
-14
@@ -376,7 +376,7 @@ declare namespace CanvasJS {
|
||||
dataSeriesIndex: number;
|
||||
}
|
||||
|
||||
interface ChartAxisXOptions {
|
||||
interface ChartAxisOptions {
|
||||
/**
|
||||
* Sets the Axis Title.
|
||||
* Default: null
|
||||
@@ -472,18 +472,6 @@ declare namespace CanvasJS {
|
||||
*/
|
||||
valueFormatString?: string;
|
||||
/**
|
||||
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
minimum?: number;
|
||||
/**
|
||||
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
maximum?: number;
|
||||
/**
|
||||
* Sets the distance between Tick Marks, Grid Lines and Interlaced Colors.
|
||||
* Default: Automatically Calculated
|
||||
* Example: 50, 75..
|
||||
@@ -638,13 +626,41 @@ declare namespace CanvasJS {
|
||||
labelFontStyle?: string;
|
||||
}
|
||||
|
||||
interface ChartAxisYOptions extends ChartAxisXOptions {
|
||||
interface ChartAxisXOptions extends ChartAxisOptions {
|
||||
/**
|
||||
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
minimum?: number | Date;
|
||||
/**
|
||||
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
maximum?: number | Date;
|
||||
}
|
||||
|
||||
interface ChartAxisYOptions extends ChartAxisOptions {
|
||||
/**
|
||||
* When includeZero is set to true, axisY sets the range in such a way that Zero is a part of it. It is set to true by default. But, whenever y values are very big and difference among dataPoints are hard to judge, setting includeZero to false makes axisY to set a range that makes the differences prominently visible.
|
||||
* Default: true
|
||||
* Example: true, false
|
||||
*/
|
||||
includeZero?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the minimum value of Axis. Values smaller than minimum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
minimum?: number;
|
||||
/**
|
||||
* Sets the maximum value permitted on Axis. Values greater than maximum are clipped.
|
||||
* Default: Automatically Calculated based on the data
|
||||
* Example: 100, 350..
|
||||
*/
|
||||
maximum?: number;
|
||||
}
|
||||
|
||||
interface ChartToolTipOptions {
|
||||
|
||||
+2
-2
@@ -6,6 +6,6 @@ import * as util from 'util';
|
||||
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
|
||||
|
||||
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
|
||||
client.execute(query, ['guy'], function(err, result) {
|
||||
client.execute(query, ['guy'], function(err: any, result: any) {
|
||||
console.log('got user profile with email ' + result.rows[0].email);
|
||||
});
|
||||
});
|
||||
+1
-2
@@ -135,7 +135,7 @@ declare module "cassandra-driver" {
|
||||
var LocalTime: LocalTimeStatic;
|
||||
var Long: _Long;
|
||||
var ResultSet: ResultSetStatic;
|
||||
var ResultStream: ResultStreamStatic;
|
||||
// var ResultStream: ResultStreamStatic;
|
||||
var Row: RowStatic;
|
||||
var TimeUuid: TimeUuidStatic;
|
||||
var Tuple: TupleStatic;
|
||||
@@ -366,7 +366,6 @@ declare module "cassandra-driver" {
|
||||
buffer: Buffer;
|
||||
paused: boolean;
|
||||
|
||||
_read(): void;
|
||||
_valve(readNext: Function): void;
|
||||
add(chunk: Buffer): void;
|
||||
}
|
||||
|
||||
Vendored
+8
-2
@@ -5,13 +5,19 @@
|
||||
|
||||
declare namespace Chance {
|
||||
|
||||
interface Seeded {
|
||||
seed: number;
|
||||
}
|
||||
|
||||
type SeededChance = Chance & Seeded;
|
||||
|
||||
interface ChanceStatic {
|
||||
(): Chance
|
||||
(seed: number): Chance
|
||||
(seed: number): SeededChance
|
||||
(generator: () => any): Chance
|
||||
|
||||
new(): Chance;
|
||||
new(seed: number): Chance;
|
||||
new(seed: number): SeededChance;
|
||||
new(generator: () => any): Chance;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
-6
@@ -345,6 +345,7 @@ interface ChartXAxe {
|
||||
stacked?: boolean;
|
||||
categoryPercentage?: number;
|
||||
barPercentage?: number;
|
||||
barThickness?: number;
|
||||
gridLines?: GridLineOptions;
|
||||
position?: string;
|
||||
ticks?: TickOptions;
|
||||
@@ -379,7 +380,7 @@ interface TimeScale extends ChartScales {
|
||||
parser?: string | ((arg: any) => any);
|
||||
round?: string;
|
||||
tooltipFormat?: string;
|
||||
unit?: TimeUnit;
|
||||
unit?: string | TimeUnit;
|
||||
unitStepSize?: number;
|
||||
}
|
||||
|
||||
@@ -390,11 +391,12 @@ interface RadialLinearScale {
|
||||
ticks?: TickOptions;
|
||||
}
|
||||
|
||||
declare var Chart: {
|
||||
new (context: CanvasRenderingContext2D, options: ChartConfiguration): {};
|
||||
declare class Chart {
|
||||
constructor (context: CanvasRenderingContext2D, options: ChartConfiguration);
|
||||
config: ChartConfiguration;
|
||||
destroy: () => {};
|
||||
update: (duration: any, lazy: any) => {};
|
||||
render: (duration: any, lazy: any) => {};
|
||||
update: (duration?: any, lazy?: any) => {};
|
||||
render: (duration?: any, lazy?: any) => {};
|
||||
stop: () => {};
|
||||
resize: () => {};
|
||||
clear: () => {};
|
||||
@@ -407,4 +409,4 @@ declare var Chart: {
|
||||
defaults: {
|
||||
global: ChartOptions;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="chunked-dc.d.ts" />
|
||||
|
||||
// Chunker
|
||||
|
||||
let chunker = new Chunker(1337, Uint8Array.of(1,2,3), 2);
|
||||
for (let chunk of chunker) {
|
||||
// Do smoething with chunk
|
||||
}
|
||||
while (chunker.hasNext) {
|
||||
let chunk = chunker.next().value;
|
||||
}
|
||||
|
||||
// Unchunker
|
||||
|
||||
let unchunker = new Unchunker();
|
||||
unchunker.onMessage = (message: Uint8Array, context: any[]) => {
|
||||
// Do something with the received message
|
||||
};
|
||||
let chunk = Uint8Array.of(1,2).buffer;
|
||||
unchunker.add(chunk);
|
||||
unchunker.gc(1024);
|
||||
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
// Type definitions for chunked-dc v0.1.2
|
||||
// Project: https://github.com/saltyrtc/chunked-dc-js
|
||||
// Definitions by: Danilo Bargen <https://github.com/dbrgn/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Interfaces
|
||||
declare namespace chunkedDc {
|
||||
|
||||
/** common.ts **/
|
||||
|
||||
interface CommonStatic {
|
||||
HEADER_LENGTH: number;
|
||||
}
|
||||
|
||||
/** chunker.ts **/
|
||||
|
||||
interface Chunker extends IterableIterator<Uint8Array> {
|
||||
hasNext: boolean;
|
||||
next(): IteratorResult<Uint8Array>;
|
||||
[Symbol.iterator](): IterableIterator<Uint8Array>;
|
||||
}
|
||||
|
||||
interface ChunkerStatic {
|
||||
new(id: number, message: Uint8Array, chunkSize: number): Chunker
|
||||
}
|
||||
|
||||
/** unchunker.ts **/
|
||||
|
||||
type MessageListener = (message: Uint8Array, context?: any) => void;
|
||||
|
||||
interface Unchunker {
|
||||
onMessage: MessageListener;
|
||||
add(chunk: ArrayBuffer, context?: any): void;
|
||||
gc(maxAge: number): number;
|
||||
}
|
||||
|
||||
interface UnchunkerStatic {
|
||||
new(): Unchunker
|
||||
}
|
||||
|
||||
/** main.ts **/
|
||||
|
||||
interface Standalone {
|
||||
Chunker: ChunkerStatic,
|
||||
Unchunker: UnchunkerStatic,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Entry point for the packed ES5 version:
|
||||
declare var chunkedDc: chunkedDc.Standalone;
|
||||
|
||||
// Entry point for the ES2015 version:
|
||||
declare var Chunker: chunkedDc.ChunkerStatic;
|
||||
declare var Unchunker: chunkedDc.UnchunkerStatic;
|
||||
@@ -0,0 +1 @@
|
||||
--target es2015 --noImplicitAny
|
||||
@@ -37,6 +37,23 @@ function test_CKEDITOR() {
|
||||
CKEDITOR.replaceAll((textarea, config) => false);
|
||||
}
|
||||
|
||||
function test_config() {
|
||||
var config1: CKEDITOR.config = {
|
||||
toolbar: 'basic',
|
||||
};
|
||||
var config2: CKEDITOR.config = {
|
||||
toolbar: [
|
||||
[ 'mode', 'document', 'doctools' ],
|
||||
[ 'clipboard', 'undo' ],
|
||||
'/',
|
||||
[ 'find', 'selection', 'spellchecker' ],
|
||||
[ 'basicstyles', 'cleanup' ],
|
||||
'/',
|
||||
[ 'list', 'indent', 'blocks', 'align', 'bidi' ],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
function test_dom_comment() {
|
||||
var type = CKEDITOR.NODE_COMMENT;
|
||||
var nativeNode = document.createComment('Example');
|
||||
@@ -319,3 +336,30 @@ function test_focusManager() {
|
||||
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
|
||||
var bool: boolean = focusManager.hasFocus;
|
||||
}
|
||||
|
||||
function test_basicWriter() {
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
}
|
||||
|
||||
function test_htmlWriter() {
|
||||
var writer = new CKEDITOR.htmlWriter();
|
||||
writer.openTag('p', {});
|
||||
writer.attribute('class', 'MyClass');
|
||||
writer.openTagClose('p', false);
|
||||
writer.text('Hello');
|
||||
writer.closeTag('p');
|
||||
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
|
||||
|
||||
writer.indentationChars = '\t';
|
||||
writer.lineBreakChars = '\r\n';
|
||||
writer.selfClosingEnd = '>';
|
||||
writer.indentation();
|
||||
writer.lineBreak();
|
||||
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
|
||||
}
|
||||
|
||||
Vendored
+21
-1
@@ -807,7 +807,7 @@ declare namespace CKEDITOR {
|
||||
templates_files?: Object;
|
||||
templates_replaceContent?: boolean;
|
||||
title?: string | boolean;
|
||||
toolbar?: string | (string[])[];
|
||||
toolbar?: string | (string | string[])[];
|
||||
toolbarCanCollapse?: boolean;
|
||||
toolbarGroupCycling?: boolean;
|
||||
toolbarGroups?: toolbarGroups[];
|
||||
@@ -1270,6 +1270,16 @@ declare namespace CKEDITOR {
|
||||
toHtml(data: string, fixForBody?: string): void;
|
||||
}
|
||||
|
||||
class htmlDataProcessor {
|
||||
dataFilter: htmlParser.filter;
|
||||
htmlFilter: htmlParser.filter;
|
||||
writer: htmlParser.basicWriter;
|
||||
|
||||
constructor(editor: editor);
|
||||
toDataFormat(html: string, options?: Object): string;
|
||||
toHtml(data: string, options?: Object): string;
|
||||
}
|
||||
|
||||
|
||||
class event {
|
||||
constructor();
|
||||
@@ -1803,6 +1813,16 @@ declare namespace CKEDITOR {
|
||||
|
||||
}
|
||||
|
||||
class htmlWriter extends htmlParser.basicWriter {
|
||||
indentationChars: string;
|
||||
lineBreakChars: string;
|
||||
selfClosingEnd: string;
|
||||
|
||||
indentation(): void;
|
||||
lineBreak(): void;
|
||||
setRules(tagName: string, rules: Object): void;
|
||||
}
|
||||
|
||||
|
||||
namespace tools {
|
||||
var callFunction: Function;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/// <reference path="clipboard-js.d.ts" />
|
||||
|
||||
clipboard.copy("Hello World");
|
||||
clipboard.copy(document.body).then(() => console.log("success"));
|
||||
|
||||
clipboard.paste().then(val => console.log(val));
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for clipboard-js 0.3.1
|
||||
// Project: https://github.com/lgarron/clipboard.js
|
||||
// Definitions by: Mark Wong Siang Kai <https://github.com/markwongsk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace clipboard {
|
||||
|
||||
interface IClipboardJsStatic {
|
||||
copy(val: string | Element): Promise<void>;
|
||||
paste(): Promise<string>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var clipboard: clipboard.IClipboardJsStatic;
|
||||
|
||||
declare module 'clipboard-js' {
|
||||
export = clipboard;
|
||||
}
|
||||
Vendored
+1
-1
@@ -427,7 +427,7 @@ declare namespace CodeMirror {
|
||||
|
||||
/** Replace the part of the document between from and to with the given string.
|
||||
from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */
|
||||
replaceRange(replacement: string, from: CodeMirror.Position, to: CodeMirror.Position): void;
|
||||
replaceRange(replacement: string, from: CodeMirror.Position, to?: CodeMirror.Position): void;
|
||||
|
||||
/** Get the content of line n. */
|
||||
getLine(n: number): string;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// Color Test
|
||||
// ================================================================================
|
||||
/// <reference path="color.d.ts"/>
|
||||
|
||||
// Imports
|
||||
// --------------------------------------------------------------------------------
|
||||
import * as Color from "color"
|
||||
|
||||
var color: Color.Color = Color("white")
|
||||
var colorOther: Color.Color = Color("black")
|
||||
|
||||
var colorRGB: Color.Color = color.rgb(0, 0, 0)
|
||||
var colorRGB: Color.Color = color.rgb([0, 0, 0])
|
||||
var rgb: Color.RGBColor = color.rgb()
|
||||
|
||||
var colorHSL: Color.Color = color.hsl([0, 0, 0])
|
||||
var hsl: Color.HSLColor = color.hsl()
|
||||
|
||||
var colorHSV: Color.Color = color.hsv([0, 0, 0])
|
||||
var hsv: Color.HSVColor = color.hsv()
|
||||
|
||||
var colorHBW: Color.Color = color.hbw([0, 0, 0])
|
||||
var hbw: Color.HBWColor = color.hbw()
|
||||
|
||||
var colorCMYK: Color.Color = color.cmyk([0, 0, 0, 0])
|
||||
var cmyk: Color.CMYKColor = color.cmyk()
|
||||
|
||||
var hex: string = color.hexString()
|
||||
var percent: string = color.percentString()
|
||||
var keyword: string | void = color.keyword()
|
||||
var alpha: number = color.alpha()
|
||||
var red: number = color.red()
|
||||
var green: number = color.green()
|
||||
var blue: number = color.blue()
|
||||
var hue: number = color.hue()
|
||||
var saturation: number = color.saturation()
|
||||
var lightness: number = color.lightness()
|
||||
var saturationv: number = color.saturationv()
|
||||
var value: number = color.value()
|
||||
var whiteness: number = color.whiteness()
|
||||
var blackness: number = color.blackness()
|
||||
var cyan: number = color.cyan()
|
||||
var magenta: number = color.magenta()
|
||||
var yellow: number = color.yellow()
|
||||
var black: number = color.black()
|
||||
var luminosity: number = color.luminosity()
|
||||
var contrast: number = color.contrast(colorOther)
|
||||
var dark: boolean = color.dark()
|
||||
var light: boolean = color.light()
|
||||
var level: string = color.level(colorOther)
|
||||
|
||||
var chain: Color.Color = color
|
||||
.rgb(0, 0, 0)
|
||||
.hsl([0, 0, 0])
|
||||
.hsv([0, 0, 0])
|
||||
.hbw([0, 0, 0])
|
||||
.cmyk([0, 0, 0 ,0])
|
||||
.alpha(0)
|
||||
.red(0)
|
||||
.green(0)
|
||||
.blue(0)
|
||||
.hue(0)
|
||||
.saturation(0)
|
||||
.lightness(0)
|
||||
.saturationv(0)
|
||||
.value(0)
|
||||
.whiteness(0)
|
||||
.blackness(0)
|
||||
.cyan(0)
|
||||
.magenta(0)
|
||||
.yellow(0)
|
||||
.black(0)
|
||||
.negate()
|
||||
.lighten(0)
|
||||
.darken(0)
|
||||
.saturate(0)
|
||||
.desaturate(0)
|
||||
.greyscale()
|
||||
.whiten(0)
|
||||
.blacken(0)
|
||||
.clearer(0)
|
||||
.opaquer(0)
|
||||
.rotate(0)
|
||||
.mix(colorOther, 0)
|
||||
.clone()
|
||||
Vendored
+162
@@ -0,0 +1,162 @@
|
||||
// Type definitions for color v0.12.0
|
||||
// Project: https://github.com/qix-/color
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Color {
|
||||
|
||||
interface RGBColor {
|
||||
r: number
|
||||
g: number
|
||||
b: number
|
||||
a?: number
|
||||
}
|
||||
|
||||
interface FullRGBColor {
|
||||
red: number
|
||||
green: number
|
||||
blue: number
|
||||
alpha?: number
|
||||
}
|
||||
|
||||
interface HSLColor {
|
||||
h: number
|
||||
s: number
|
||||
l: number
|
||||
a?: number
|
||||
}
|
||||
|
||||
interface FullHSLColor {
|
||||
hue: number
|
||||
saturation: number
|
||||
lightness: number
|
||||
alpha?: number
|
||||
}
|
||||
|
||||
interface HSVColor {
|
||||
h: number
|
||||
s: number
|
||||
v: number
|
||||
}
|
||||
|
||||
interface FullHSVColor {
|
||||
hue: number
|
||||
saturation: number
|
||||
value: number
|
||||
}
|
||||
|
||||
interface HBWColor {
|
||||
h: number
|
||||
b: number
|
||||
w: number
|
||||
}
|
||||
|
||||
interface FullHBWColor {
|
||||
hue: number
|
||||
whiteness: number
|
||||
blackness: number
|
||||
}
|
||||
|
||||
interface CMYKColor {
|
||||
c: number
|
||||
m: number
|
||||
y: number
|
||||
k: number
|
||||
}
|
||||
|
||||
interface FullCMYKColor {
|
||||
cyan: number
|
||||
magenta: number
|
||||
yellow: number
|
||||
black: number
|
||||
}
|
||||
|
||||
type ColorParam = string | RGBColor | FullRGBColor | HSLColor | FullHSLColor | HSVColor
|
||||
| FullHSVColor | HBWColor | FullHBWColor | CMYKColor | FullCMYKColor
|
||||
|
||||
interface Color {
|
||||
(color: ColorParam | Color) : Color
|
||||
rgb(values: Array<number>): Color
|
||||
rgb(r: number, g: number, b: number, a?: number): Color
|
||||
rgb(values: RGBColor): Color
|
||||
rgb(values: FullRGBColor): Color
|
||||
rgb(): RGBColor
|
||||
rgbArray(): Array<number>
|
||||
rgbString(): string
|
||||
rgbaString(): string
|
||||
rgbNumber(): number
|
||||
hsl(values: Array<number>): Color
|
||||
hsl(): HSLColor
|
||||
hslArray(): Array<number>
|
||||
hslString(): string
|
||||
hslaString(): string
|
||||
hsv(values: Array<number>): Color
|
||||
hsv(): HSVColor
|
||||
hsvArray(): Array<number>
|
||||
hsvString(): string
|
||||
hbw(values: Array<number>): Color
|
||||
hbw(): HBWColor
|
||||
hbwArray(): Array<number>
|
||||
hbwString(): string
|
||||
cmyk(values: Array<number>): Color
|
||||
cmyk(): CMYKColor
|
||||
cmykArray(): Array<number>
|
||||
cmykString(): string
|
||||
hexString(): string
|
||||
percentString(): string
|
||||
keyword(): string | void
|
||||
alpha(alpha: number): Color
|
||||
alpha(): number
|
||||
red(red: number): Color
|
||||
red(): number
|
||||
green(green: number): Color
|
||||
green(): number
|
||||
blue(blue: number): Color
|
||||
blue(): number
|
||||
hue(hue: number): Color
|
||||
hue(): number
|
||||
saturation(saturation: number): Color
|
||||
saturation(): number
|
||||
lightness(lightness: number): Color
|
||||
lightness(): number
|
||||
saturationv(saturationv: number): Color
|
||||
saturationv(): number
|
||||
value(value: number): Color
|
||||
value(): number
|
||||
whiteness(whiteness: number): Color
|
||||
whiteness(): number
|
||||
blackness(blackness: number): Color
|
||||
blackness(): number
|
||||
cyan(cyan: number): Color
|
||||
cyan(): number
|
||||
magenta(magenta: number): Color
|
||||
magenta(): number
|
||||
yellow(yellow: number): Color
|
||||
yellow(): number
|
||||
black(black: number): Color
|
||||
black(): number
|
||||
luminosity(): number
|
||||
contrast(color: Color): number
|
||||
dark(): boolean
|
||||
light(): boolean
|
||||
negate(): Color
|
||||
lighten(value: number): Color
|
||||
darken(value: number): Color
|
||||
saturate(value: number): Color
|
||||
desaturate(value: number): Color
|
||||
greyscale(): Color
|
||||
whiten(value: number): Color
|
||||
blacken(value: number): Color
|
||||
clearer(value: number): Color
|
||||
opaquer(value: number): Color
|
||||
rotate(value: number): Color
|
||||
mix(color: Color, value?: number): Color
|
||||
level(color: Color): string
|
||||
clone(): Color
|
||||
}
|
||||
}
|
||||
|
||||
declare module "color" {
|
||||
const Color: Color.Color
|
||||
export = Color
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/// <reference path='./cordova-plugin-ble-central.d.ts' />
|
||||
|
||||
var log = (msg : string) => {};
|
||||
var devices: BLECentralPlugin.PeripheralData[] = [];
|
||||
var demoDevice :BLECentralPlugin.PeripheralData = {
|
||||
"name": "Battery Demo",
|
||||
"id": "20:FF:D0:FF:D1:C0",
|
||||
"advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
|
||||
"rssi": -55
|
||||
};
|
||||
|
||||
devices.push(demoDevice);
|
||||
var demoExtendedData : BLECentralPlugin.PeripheralDataExtended = {
|
||||
"name": "Battery Demo",
|
||||
"id": "20:FF:D0:FF:D1:C0",
|
||||
"advertising": [2,1,6,3,3,15,24,8,9,66,97,116,116,101,114,121],
|
||||
"rssi": -55,
|
||||
"services": [
|
||||
"1800",
|
||||
"1801",
|
||||
"180f"
|
||||
],
|
||||
"characteristics": [
|
||||
{
|
||||
"service": "1800",
|
||||
"characteristic": "2a00",
|
||||
"properties": [
|
||||
"Read"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "1800",
|
||||
"characteristic": "2a01",
|
||||
"properties": [
|
||||
"Read"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "1801",
|
||||
"characteristic": "2a05",
|
||||
"properties": [
|
||||
"Read"
|
||||
]
|
||||
},
|
||||
{
|
||||
"service": "180f",
|
||||
"characteristic": "2a19",
|
||||
"properties": [
|
||||
"Read"
|
||||
],
|
||||
"descriptors": [
|
||||
{
|
||||
"uuid": "2901"
|
||||
},
|
||||
{
|
||||
"uuid": "2904"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
//get updates about the bluethooth states
|
||||
ble.startStateNotifications((state) => log(`BLE state ${state}`));
|
||||
|
||||
ble.isEnabled(()=> log(`bluetooth is enabled`), ()=>log(`bluetooth is not enabled`));
|
||||
|
||||
//here we try to enable bluetooth
|
||||
ble.enable(() => log(`yes it worked, or it was already enabled `), () => log(`nope it didn't work, the user pressed cancel, or we are in iOS`));
|
||||
|
||||
ble.showBluetoothSettings(() => log(`yes it worked`), () => log(`nope it didn't work`))
|
||||
|
||||
//stop getting updates about the bluethooth states
|
||||
ble.stopStateNotifications()
|
||||
|
||||
//scan 5 seconds
|
||||
ble.scan([], 5000, (data) => { devices.push(data); }, ()=> log('couldn\'t connect') );
|
||||
|
||||
//scan continously
|
||||
ble.startScan([], (data) => { devices.push(data); }, ()=> log('couldn\'t connect') )
|
||||
|
||||
////scan continously
|
||||
ble.startScanWithOptions([], {reportDuplicates:false }, (data) => { devices.push(data); }, ()=> log('couldn\'t connect') )
|
||||
|
||||
//stop scanning
|
||||
ble.stopScan(()=> log('all good'), ()=> log('couldn\'t stop scanning'));
|
||||
|
||||
//are we conenected to that device?
|
||||
ble.isConnected(demoDevice.id, () => log(`already connected to this device`), ()=> log(`not yet connected to that device`));
|
||||
|
||||
//connect to a specific device
|
||||
var extendedData : BLECentralPlugin.PeripheralDataExtended;
|
||||
ble.connect(demoDevice.id, (data)=> extendedData = data, () => log(`couldn't connect to the device`) );
|
||||
|
||||
//read some data from a characteristic
|
||||
var charsOfOneOfItsServices = demoExtendedData.characteristics.filter((value) => value.service == demoExtendedData.services[0]);
|
||||
ble.read(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, (data) => log(`we've received some data`), ()=> log(`couldn't read any data`));
|
||||
|
||||
//read the rssi
|
||||
ble.readRSSI(demoDevice.id, (rssi)=>log(`Device ${demoDevice.name} has an RSSI of ${rssi}`));
|
||||
|
||||
var notificationsReceived : number = 0;
|
||||
//get notified of changes for that characteristic
|
||||
ble.startNotification(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, (data)=> notificationsReceived++, ()=> log(`darn`));
|
||||
|
||||
//write some data
|
||||
ble.write(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, new ArrayBuffer(40), ()=> log(`all good`), ()=> log(`could't write`));
|
||||
//write some data without getting notified
|
||||
ble.writeWithoutResponse(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic, new ArrayBuffer(40), ()=> log(`all good`), ()=> log(`could't write`));
|
||||
|
||||
//stop getting notified of changes.
|
||||
ble.stopNotification(demoDevice.id, charsOfOneOfItsServices[0].service, charsOfOneOfItsServices[0].characteristic);
|
||||
|
||||
//notificationsReceived == 1
|
||||
|
||||
//just disconnect
|
||||
ble.disconnect(demoDevice.id);
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// Type definitions for cordova-plugin-ble-central 1.1.2
|
||||
// Project: https://github.com/don/cordova-plugin-ble-central
|
||||
// Definitions by: Gidon Junge <https://github.com/gjunge>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare namespace BLECentralPlugin {
|
||||
|
||||
interface PeripheralCharacteristic {
|
||||
service: string;
|
||||
characteristic: string;
|
||||
properties: string[];
|
||||
descriptors?: any[];
|
||||
}
|
||||
|
||||
interface PeripheralData {
|
||||
name: string;
|
||||
id: string;
|
||||
rssi: number
|
||||
advertising: ArrayBuffer|any;
|
||||
}
|
||||
|
||||
|
||||
interface PeripheralDataExtended extends PeripheralData{
|
||||
services: string[];
|
||||
characteristics: PeripheralCharacteristic[]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
interface StartScanOptions {
|
||||
reportDuplicates?: boolean;
|
||||
}
|
||||
|
||||
export interface BLECentralPluginStatic {
|
||||
scan(services: string[], seconds: number, success : (data: PeripheralData) => any): void;
|
||||
scan(services: string[], seconds: number, success : (data: PeripheralData) => any, failure : () => any): void;
|
||||
|
||||
startScan(services: string[], success: (data: PeripheralData) => any): void;
|
||||
startScan(services: string[], success: (data: PeripheralData) => any, failure: () => any): void;
|
||||
|
||||
startScanWithOptions(services: string[], options: StartScanOptions, success: (data: PeripheralData) => any): void;
|
||||
startScanWithOptions(services: string[], options: StartScanOptions, success: (data: PeripheralData) => any, failure: () => any): void;
|
||||
|
||||
stopScan(): void;
|
||||
stopScan(success: () => any): void;
|
||||
stopScan(success: () => any, failure: () => any): void;
|
||||
|
||||
connect(device_id:string, success: (data: PeripheralDataExtended) => any, failure: () => any): void;
|
||||
|
||||
disconnect(device_id:string): void;
|
||||
disconnect(device_id:string, success: () => any): void;
|
||||
disconnect(device_id:string, success: () => any, failure: () => any): void;
|
||||
|
||||
read(device_id: string, service_uuid:string, characteristic_uuid:string): void;
|
||||
read(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any): void;
|
||||
read(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any, failure: () => any): void;
|
||||
|
||||
write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer): void;
|
||||
write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any): void;
|
||||
write(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any, failure: () => any): void;
|
||||
|
||||
/* Writes data to a characteristic without a response from the peripheral. You are not notified if the write fails in the BLE stack.
|
||||
The success callback is be called when the characteristic is written.*/
|
||||
writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer): void;
|
||||
writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any): void;
|
||||
writeWithoutResponse(device_id: string, service_uuid:string, characteristic_uuid:string, data: ArrayBuffer, success : () => any, failure: () => any): void;
|
||||
|
||||
/* Register to be notified when the value of a characteristic changes. */
|
||||
startNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any): void;
|
||||
startNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: (rawData: ArrayBuffer) => any, failure: () => any): void;
|
||||
|
||||
stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string): void;
|
||||
stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: () => any): void;
|
||||
stopNotification(device_id: string, service_uuid:string, characteristic_uuid:string, success: () => any, failure: () => any): void;
|
||||
|
||||
/* Reports if bluetooth is enabled. */
|
||||
isEnabled(success: () => any , failure: () => any): void;
|
||||
|
||||
/* Calls the success callback when the peripheral is connected and the failure callback when not connected. */
|
||||
isConnected(device_id: string, success: () => any): void;
|
||||
isConnected(device_id: string, success: () => any, failure: () => any): void;
|
||||
|
||||
startStateNotifications(success: (state: string) => any): void;
|
||||
startStateNotifications(success: (state: string) => any, failure: () => any): void;
|
||||
|
||||
stopStateNotifications(): void;
|
||||
stopStateNotifications(success: () => any): void;
|
||||
stopStateNotifications(success: () => any, failure: () => any): void;
|
||||
|
||||
/* Opens the Bluetooth settings for the operating systems.
|
||||
[iOS] showBluetoothSettings is not supported on iOS. */
|
||||
showBluetoothSettings(): void;
|
||||
showBluetoothSettings(success: () => any): void;
|
||||
showBluetoothSettings(success: () => any, failure: () => any): void;
|
||||
|
||||
/* Enable Bluetooth on the device.
|
||||
[iOS] enable is not supported on iOS. */
|
||||
enable(success: () => any, failure: () => any): void;
|
||||
|
||||
|
||||
readRSSI(device_id:string, success: (rssi: number) => any): void;
|
||||
readRSSI(device_id:string, success: (rssi: number) => any, failure: () => any): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var ble: BLECentralPlugin.BLECentralPluginStatic;
|
||||
@@ -0,0 +1,510 @@
|
||||
/// <reference path='../cordova/cordova.d.ts' />
|
||||
/// <reference path="cordova.plugins.diagnostic.d.ts" />
|
||||
|
||||
|
||||
cordova.plugins.diagnostic.isLocationAvailable(function(available){
|
||||
console.log("Location is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isWifiAvailable(function(available){
|
||||
console.log("WiFi is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCameraAvailable(function(available){
|
||||
console.log("Camera is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isBluetoothAvailable(function(available){
|
||||
console.log("Bluetooth is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.switchToLocationSettings();
|
||||
cordova.plugins.diagnostic.switchToMobileDataSettings();
|
||||
cordova.plugins.diagnostic.switchToBluetoothSettings();
|
||||
cordova.plugins.diagnostic.switchToWifiSettings();
|
||||
|
||||
cordova.plugins.diagnostic.isWifiEnabled(function(enabled){
|
||||
console.log("WiFi is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.setWifiState(function(){
|
||||
console.log("Wifi was enabled");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, true
|
||||
);
|
||||
|
||||
cordova.plugins.diagnostic.setBluetoothState(function(){
|
||||
console.log("Bluetooth was enabled");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, true
|
||||
);
|
||||
|
||||
cordova.plugins.diagnostic.isLocationEnabled(function(enabled){
|
||||
console.log("Location setting is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isLocationAuthorized(function(enabled){
|
||||
console.log("Location authorization is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getLocationAuthorizationStatus(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission not requested");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted always");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
|
||||
console.log("Permission granted only when in use");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestLocationAuthorization(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission not requested");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted always");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE:
|
||||
console.log("Permission granted only when in use");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
}, cordova.plugins.diagnostic.locationAuthorizationMode.ALWAYS);
|
||||
|
||||
cordova.plugins.diagnostic.isCameraPresent(function(present){
|
||||
console.log("Camera is " + (present ? "present" : "absent"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCameraAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getCameraAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Camera use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestCameraAuthorization(function(status){
|
||||
console.log("Authorization request for camera use was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied"));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isMicrophoneAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to the microphone");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getMicrophoneAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Microphone use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestMicrophoneAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Microphone use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isContactsAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to contacts");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getContactsAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Contacts use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestContactsAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Contacts use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCalendarAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to calendar");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getCalendarAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Calendar use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestCalendarAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Calendar use is authorized");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.switchToSettings(function(){
|
||||
console.log("Successfully switched to Settings app");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getBluetoothState(function(state){
|
||||
if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){
|
||||
console.log("Bluetooth is able to connect");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerBluetoothStateChangeHandler(function(state){
|
||||
if(state === cordova.plugins.diagnostic.bluetoothState.POWERED_ON){
|
||||
console.log("Bluetooth is able to connect");
|
||||
}
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.registerLocationStateChangeHandler(function(state){
|
||||
if((device.platform === "Android" && state !== cordova.plugins.diagnostic.locationMode.LOCATION_OFF)
|
||||
|| (device.platform === "iOS") && ( state === cordova.plugins.diagnostic.permissionStatus.GRANTED
|
||||
|| state === cordova.plugins.diagnostic.permissionStatus.GRANTED_WHEN_IN_USE
|
||||
)){
|
||||
console.log("Location is available");
|
||||
}
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getLocationMode(function(locationMode){
|
||||
switch(locationMode){
|
||||
case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY:
|
||||
console.log("High accuracy");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING:
|
||||
console.log("Battery saving");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY:
|
||||
console.log("Device only");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.LOCATION_OFF:
|
||||
console.log("Location off");
|
||||
break;
|
||||
}
|
||||
},function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isGpsLocationAvailable(function(available){
|
||||
console.log("GPS location is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isGpsLocationEnabled(function(enabled){
|
||||
console.log("GPS location is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNetworkLocationAvailable(function(available){
|
||||
console.log("Network location is " + (available ? "available" : "not available"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isNetworkLocationEnabled(function(enabled){
|
||||
console.log("Network location is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getLocationMode(function(locationMode){
|
||||
switch(locationMode){
|
||||
case cordova.plugins.diagnostic.locationMode.HIGH_ACCURACY:
|
||||
console.log("High accuracy");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.BATTERY_SAVING:
|
||||
console.log("Battery saving");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.DEVICE_ONLY:
|
||||
console.log("Device only");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.locationMode.LOCATION_OFF:
|
||||
console.log("Location off");
|
||||
break;
|
||||
}
|
||||
},function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getPermissionAuthorizationStatus(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use the camera");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use the camera has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use the camera - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use the camera - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, cordova.plugins.diagnostic.permission.CAMERA);
|
||||
|
||||
cordova.plugins.diagnostic.getPermissionsAuthorizationStatus(function(statuses){
|
||||
for (var permission in statuses){
|
||||
switch(statuses[permission]){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use "+permission+" has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use "+permission+" - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
},[
|
||||
cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION,
|
||||
cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION
|
||||
]);
|
||||
|
||||
cordova.plugins.diagnostic.requestRuntimePermission(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use the camera");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use the camera has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use the camera - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use the camera - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
}, cordova.plugins.diagnostic.permission.CAMERA);
|
||||
|
||||
cordova.plugins.diagnostic.requestRuntimePermissions(function(statuses){
|
||||
for (var permission in statuses){
|
||||
switch(statuses[permission]){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use "+permission+" has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use "+permission+" - ask again?");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use "+permission+" - guess we won't be using it then!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
},[
|
||||
cordova.plugins.diagnostic.permission.ACCESS_FINE_LOCATION,
|
||||
cordova.plugins.diagnostic.permission.ACCESS_COARSE_LOCATION
|
||||
]);
|
||||
|
||||
if(!cordova.plugins.diagnostic.isRequestingPermission()){
|
||||
console.log("Request some permissions");
|
||||
}else{
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(function(statuses){
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler after single call
|
||||
console.log("Request some permissions");
|
||||
});
|
||||
}
|
||||
|
||||
function onPermissionRequestComplete(statuses:any){
|
||||
console.info("Permission request complete");
|
||||
for (var permission in statuses){
|
||||
switch(statuses[permission]){
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission to use "+permission+" has not been requested yet");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied to use "+permission);
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED_ALWAYS:
|
||||
console.log("Permission permanently denied to use "+permission);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(null); // de-register handler
|
||||
}
|
||||
cordova.plugins.diagnostic.registerPermissionRequestCompleteHandler(onPermissionRequestComplete)
|
||||
|
||||
cordova.plugins.diagnostic.isBluetoothEnabled(function(enabled){
|
||||
console.log("Bluetooth is " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.hasBluetoothSupport(function(supported){
|
||||
console.log("Bluetooth is " + (supported ? "supported" : "unsupported"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.hasBluetoothLESupport(function(supported){
|
||||
console.log("Bluetooth LE is " + (supported ? "supported" : "unsupported"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.hasBluetoothLEPeripheralSupport(function(supported){
|
||||
console.log("Bluetooth LE Peripheral Mode is " + (supported ? "supported" : "unsupported"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isCameraRollAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to the camera roll");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getCameraRollAuthorizationStatus(function(status){
|
||||
switch(status){
|
||||
case cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
|
||||
console.log("Permission not requested");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.DENIED:
|
||||
console.log("Permission denied");
|
||||
break;
|
||||
case cordova.plugins.diagnostic.permissionStatus.GRANTED:
|
||||
console.log("Permission granted");
|
||||
break;
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestCameraRollAuthorization(function(status){
|
||||
console.log("Authorization request for camera roll was " + (status == cordova.plugins.diagnostic.permissionStatus.GRANTED ? "granted" : "denied"));
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isRemoteNotificationsEnabled(function(enabled){
|
||||
console.log("Remote notifications are " + (enabled ? "enabled" : "disabled"));
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isRegisteredForRemoteNotifications(function(registered){
|
||||
console.log("Device " + (registered ? "is" : "isn't") + " registered for remote notifications");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getRemoteNotificationTypes(function(types){
|
||||
for(var type in types){
|
||||
console.log(type + " is " + (types[type] ? "enabled" : "disabled"));
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isRemindersAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "denied") + " access to reminders");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getRemindersAuthorizationStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Reminders authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.requestRemindersAuthorization(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Reminders authorization allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.isBackgroundRefreshAuthorized(function(authorized){
|
||||
console.log("App is " + (authorized ? "authorized" : "not authorized") + " to perform background refresh");
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
|
||||
cordova.plugins.diagnostic.getBackgroundRefreshStatus(function(status){
|
||||
if(status === cordova.plugins.diagnostic.permissionStatus.GRANTED){
|
||||
console.log("Background refresh is allowed");
|
||||
}
|
||||
}, function(error){
|
||||
console.error("The following error occurred: "+error);
|
||||
});
|
||||
@@ -0,0 +1,693 @@
|
||||
// Type definitions for cordova.plugins.diagnostic v3.2.2
|
||||
// Project: https://github.com/dpa99c/cordova-diagnostic-plugin
|
||||
// Definitions by: Dave Alden <https://github.com/dpa99c/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether device hardware features are enabled or available to the app, e.g. camera, GPS, wifi
|
||||
*/
|
||||
interface Diagnostic {
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* "Dangerous" permissions that need to be requested at run-time (Android 6.0/API 23 and above)
|
||||
* See http://developer.android.com/guide/topics/security/permissions.html#perm-groups
|
||||
* @type {Object}
|
||||
*/
|
||||
permission?: any;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Permission groups indicate which associated permissions will also be requested if a given permission is requested.
|
||||
* See http://developer.android.com/guide/topics/security/permissions.html#perm-groups
|
||||
* @type {Object}
|
||||
*/
|
||||
permissionGroups?: any;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Constants for requesting and reporting the various permission states.
|
||||
* @type {Object}
|
||||
*/
|
||||
permissionStatus?: any;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Location authorization mode
|
||||
* @type {Object}
|
||||
*/
|
||||
locationAuthorizationMode?: any;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Constants for the various location modes on Android.
|
||||
* @type {Object}
|
||||
*/
|
||||
locationMode?: any;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Constants for the various Bluetooth hardware states.
|
||||
* @type {Object}
|
||||
*/
|
||||
bluetoothState?: any;
|
||||
|
||||
|
||||
/**
|
||||
* Checks if app is able to access device location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isLocationAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Checks if Wifi is available.
|
||||
* On iOS this returns true if the device is connected to a network by WiFi.
|
||||
* On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled, and is the same as isWifiEnabled()
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isWifiAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Checks if camera is available.
|
||||
* On Android & iOS this returns true if the device has a camera AND the application is authorized to use it.
|
||||
* On Windows 10 Mobile this returns true if the device has a rear-facing camera.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* Checks if Bluetooth is available to the app.
|
||||
* Returns true if the device has Bluetooth capabilities AND if Bluetooth setting is switched on (same on Android, iOS and Windows 10 Mobile)
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isBluetoothAvailable: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays the device location settings to allow user to enable location services/change location mode.
|
||||
*/
|
||||
switchToLocationSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays mobile settings to allow user to enable mobile data.
|
||||
*/
|
||||
switchToMobileDataSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays Bluetooth settings to allow user to enable Bluetooth.
|
||||
*/
|
||||
switchToBluetoothSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Displays WiFi settings to allow user to enable WiFi.
|
||||
*/
|
||||
switchToWifiSettings?: () => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Returns true if the WiFi setting is set to enabled, and is the same as isWifiAvailable()
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isWifiEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Enables/disables WiFi on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param state
|
||||
*/
|
||||
setWifiState?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
state: boolean
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and WINDOWS ONLY
|
||||
* Enables/disables Bluetooth on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param state
|
||||
*/
|
||||
setBluetoothState?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
state: boolean
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns true if the device setting for location is on.
|
||||
* On Android this returns true if Location Mode is switched on.
|
||||
* On iOS this returns true if Location Services is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isLocationEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isLocationAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the location authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getLocationAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests location authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param mode - (iOS-only / optional) location authorization mode specified as a locationAuthorizationMode constant. If not specified, defaults to WHEN_IN_USE.
|
||||
*/
|
||||
requestLocationAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
mode?: string
|
||||
) => void;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if camera hardware is present on device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraPresent?: (
|
||||
successCallback: (present: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use the camera.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the camera authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getCameraAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests camera authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestCameraAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use the microphone.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isMicrophoneAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the microphone authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getMicrophoneAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests microphone authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestMicrophoneAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use contacts (address book).
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isContactsAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the contacts authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getContactsAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests contacts authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestContactsAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Checks if the application is authorized to use the calendar.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCalendarAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the calendar authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getCalendarAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Requests calendar authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestCalendarAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Opens settings page for this app.
|
||||
* On Android, this opens the "App Info" page in the Settings app.
|
||||
* On iOS, this opens the app settings page in the Settings app. This works only on iOS 8+ - iOS 7 and below will invoke the errorCallback.
|
||||
*/
|
||||
switchToSettings?: (
|
||||
successCallback: () => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Returns the state of Bluetooth on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getBluetoothState?: (
|
||||
successCallback: (state: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Registers a function to be called when a change in Bluetooth state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerBluetoothStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID and iOS ONLY
|
||||
* Registers a function to be called when a change in Location state occurs. Pass in a falsey value to de-register the currently registered function.
|
||||
* On Android, this occurs when the Location Mode is changed.
|
||||
* On iOS, this occurs when location authorization status is changed. This can be triggered either by the user's response to a location permission authorization dialog, by the user turning on/off Location Services, or by the user changing the Location authorization state specifically for your app.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerLocationStateChangeHandler?: (
|
||||
successCallback: (state: string) => void
|
||||
) => void;
|
||||
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if high-accuracy locations are available to the app from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to "Device only" or "High accuracy" AND if the app is authorised to use location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isGpsLocationAvailable?: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device location setting is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either Device only or High accuracy
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isGpsLocationEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if low-accuracy locations are available to the app from network triangulation/WiFi access points.
|
||||
* Returns true if Location mode is enabled and is set to "Battery saving" or "High accuracy" AND if the app is authorised to use location.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNetworkLocationAvailable?: (
|
||||
successCallback: (available: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device location setting is set to return high-accuracy locations from GPS hardware.
|
||||
* Returns true if Location mode is enabled and is set to either Battery saving or High accuracy
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isNetworkLocationEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the current location mode setting for the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getLocationMode?: (
|
||||
successCallback: (mode: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the current authorisation status for a given permission.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permission
|
||||
*/
|
||||
getPermissionAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permission: string
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Returns the current authorisation status for multiple permissions.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permissions
|
||||
*/
|
||||
getPermissionsAuthorizationStatus?: (
|
||||
successCallback: (status: string[]) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permissions: string[]
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests app to be granted authorisation for a runtime permission.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permission
|
||||
*/
|
||||
requestRuntimePermission?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permission: string
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Requests app to be granted authorisation for multiple runtime permissions.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
* @param permissions
|
||||
*/
|
||||
requestRuntimePermissions?: (
|
||||
successCallback: (status: string[]) => void,
|
||||
errorCallback: (error: string) => void,
|
||||
permissions: string[]
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Indicates if the plugin is currently requesting a runtime permission via the native API.
|
||||
*/
|
||||
isRequestingPermission?: () => boolean;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Registers a function to be called when a runtime permission request has completed. Pass in a falsey value to de-register the currently registered function.
|
||||
* @param successCallback
|
||||
*/
|
||||
registerPermissionRequestCompleteHandler?: (
|
||||
successCallback: (statuses: any) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device setting for Bluetooth is switched on.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isBluetoothEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device has Bluetooth capabilities.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
hasBluetoothSupport?: (
|
||||
successCallback: (supported: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device has Bluetooth Low Energy (LE) capabilities.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
hasBluetoothLESupport?: (
|
||||
successCallback: (supported: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* ANDROID ONLY
|
||||
* Checks if the device supports Bluetooth Low Energy (LE) Peripheral mode.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
hasBluetoothLEPeripheralSupport?: (
|
||||
successCallback: (supported: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized to use the Camera Roll in Photos app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isCameraRollAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Returns the authorization status for the application to use the Camera Roll in Photos app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getCameraRollAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Requests camera roll authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestCameraRollAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if remote (push) notifications are enabled.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isRemoteNotificationsEnabled?: (
|
||||
successCallback: (enabled: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Indicates if the app is registered for remote (push) notifications on the device.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isRegisteredForRemoteNotifications?: (
|
||||
successCallback: (registered: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Indicates the current setting of notification types for the app in the Settings app.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getRemoteNotificationTypes?: (
|
||||
successCallback: (types: any) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized to use reminders.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isRemindersAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Returns the reminders authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getRemindersAuthorizationStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Requests reminders authorization for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
requestRemindersAuthorization?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Checks if the application is authorized for background refresh.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
isBackgroundRefreshAuthorized?: (
|
||||
successCallback: (authorized: boolean) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
|
||||
/**
|
||||
* iOS ONLY
|
||||
* Returns the background refresh authorization status for the application.
|
||||
* @param successCallback
|
||||
* @param errorCallback
|
||||
*/
|
||||
getBackgroundRefreshStatus?: (
|
||||
successCallback: (status: string) => void,
|
||||
errorCallback: (error: string) => void
|
||||
) => void;
|
||||
}
|
||||
|
||||
interface CordovaPlugins {
|
||||
diagnostic: Diagnostic
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Credit Card Type Test
|
||||
// ================================================================================
|
||||
///<reference path="credit-card-type.d.ts"/>
|
||||
|
||||
// Imports
|
||||
// --------------------------------------------------------------------------------
|
||||
import * as creditCardType from "credit-card-type"
|
||||
|
||||
var cardTypes: Array<CreditCardType.CreditCardTypeInfo> = creditCardType("")
|
||||
var cardInfo: CreditCardType.CreditCardTypeInfo = creditCardType.getTypeInfo("")
|
||||
var types: { [type: string]: string } = creditCardType.types
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for Credit Card Type v5.0.0
|
||||
// Project: https://github.com/braintree/credit-card-type
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace CreditCardType {
|
||||
|
||||
type CardBrand = "american-express" | "diners-club" | "discover" | "jcb" | "maestro" | "master-card" | "unionpay" | "visa"
|
||||
|
||||
interface CreditCardTypeInfo {
|
||||
niceType?: string
|
||||
type?: CardBrand
|
||||
pattern?: RegExp
|
||||
gaps?: Array<number>
|
||||
lengths?: Array<number>
|
||||
code?: {
|
||||
name?: string
|
||||
size?: number
|
||||
}
|
||||
}
|
||||
|
||||
interface CreditCardType {
|
||||
(number: string): Array<CreditCardTypeInfo>
|
||||
getTypeInfo (type: string): CreditCardTypeInfo
|
||||
types: { [type: string]: string }
|
||||
}
|
||||
}
|
||||
|
||||
declare module "credit-card-type" {
|
||||
const creditCardType: CreditCardType.CreditCardType
|
||||
export = creditCardType
|
||||
}
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ declare namespace cucumber {
|
||||
|
||||
export interface CallbackStepDefinition{
|
||||
pending : () => PromiseLike<any>;
|
||||
(errror?:any, pending?: string):void;
|
||||
(error?:any, pending?: string):void;
|
||||
}
|
||||
|
||||
export interface TableDefinition{
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
/// <reference path="d3-box.d.ts" />
|
||||
|
||||
// Inspired by http://bl.ocks.org/mbostock/4061502
|
||||
|
||||
function iqr(k: number) {
|
||||
return function(d: any) {
|
||||
var q1 = d.quartiles[0],
|
||||
q3 = d.quartiles[2],
|
||||
iqr = (q3 - q1) * k;
|
||||
let i = -1,
|
||||
j = d.length;
|
||||
while (d[++i] < q1 - iqr);
|
||||
while (d[--j] > q3 + iqr);
|
||||
return [i, j];
|
||||
};
|
||||
}
|
||||
|
||||
var chart = d3.box()
|
||||
.whiskers(iqr(1.5))
|
||||
.width(100)
|
||||
.height(100);
|
||||
|
||||
chart.domain([1, 30]);
|
||||
|
||||
d3.selectAll("sth.").call(chart.duration(1000));
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for d3-box
|
||||
// Project: https://github.com/JacksonGariety/d3-box
|
||||
// Definitions by: Linkun Chen <https://github.com/lk-chen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../d3/d3.d.ts"/>
|
||||
|
||||
declare namespace d3 {
|
||||
export function box(): Box;
|
||||
|
||||
interface Box {
|
||||
(sel: d3.Selection<any>): void;
|
||||
width(): number;
|
||||
width(x: number): Box;
|
||||
height(): number;
|
||||
height(x: number): Box;
|
||||
tickFormat(): (n: number) => string;
|
||||
tickFormat(fun: (n: number) => string): Box;
|
||||
duration(): number;
|
||||
duration(x: number): Box;
|
||||
domain(): () => number[];
|
||||
domain(x: number[]): Box;
|
||||
value(): (d: any) => number;
|
||||
value(x: (d: any) => number): Box;
|
||||
whiskers(): (d: any[], i?: number) => number[];
|
||||
whiskers(x: (d: any[], i?: number) => number[]): Box;
|
||||
quartiles(): (d: any[]) => number[];
|
||||
quantiles(x: (d: any[]) => number[]): Box;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/// <reference path="../d3/d3.d.ts" />
|
||||
/// <reference path="d3.slider.d.ts" />
|
||||
|
||||
d3.select('#slider1').call(d3.slider());
|
||||
d3.select('#slider2').call(d3.slider().value( [ 10, 25 ] ));
|
||||
d3.select('#slider3').call(d3.slider().axis(true).value( [ 10, 25 ] )
|
||||
.on("slide", function(evt, value) {
|
||||
d3.select('#slider3textmin').text(value[ 0 ]);
|
||||
d3.select('#slider3textmax').text(value[ 1 ]);
|
||||
}));
|
||||
d3.select('#slider4').call(d3.slider().on("slide", function(evt, value) {
|
||||
d3.select('#slider4text').text(value);
|
||||
}));
|
||||
d3.select('#slider5').call(d3.slider().axis(true));
|
||||
var axis = d3.svg.axis().orient("top").ticks(4);
|
||||
d3.select('#slider6').call(d3.slider().axis(axis));
|
||||
d3.select('#slider7').call(d3.slider().axis(true).min(2000).max(2100).step(5));
|
||||
d3.select('#slider8').call(d3.slider().value(50).orientation("vertical"));
|
||||
d3.select('#slider9').call(d3.slider().value( [10, 30] ).orientation("vertical"));
|
||||
d3.select('#slider10').call(d3.slider().scale(d3.time.scale().domain([new Date(1984,1,1), new Date(2014,1,1)])).axis(d3.svg.axis()));
|
||||
d3.select('#slider11').call(d3.slider().scale(d3.time.scale().domain([new Date(1984,1,1), new Date(2014,1,1)])).axis(d3.svg.axis()).snap(true).value(new Date(2000,1,1)));
|
||||
let essai = d3.slider().scale(d3.scale.ordinal().domain(["Gecko", "Webkit", "Blink", "Trident"]).rangePoints([0, 1], 0.5)).axis(d3.svg.axis()).snap(true).value("Gecko");
|
||||
d3.select('#slider12').call(essai);
|
||||
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for d3-slider
|
||||
// Project: https://github.com/MasterMaps/d3-slider
|
||||
// Definitions by: Linkun Chen <https://github.com/lk-chen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../d3/d3.d.ts"/>
|
||||
|
||||
declare namespace d3 {
|
||||
export function slider(): Slider;
|
||||
|
||||
interface Slider {
|
||||
(sel: d3.Selection<any>): void;
|
||||
min(): number;
|
||||
min(val: number): Slider;
|
||||
max(): number;
|
||||
max(val: number): Slider;
|
||||
step(): number;
|
||||
step(val: number): Slider;
|
||||
animate(): boolean | number;
|
||||
animate(val: boolean | number): Slider;
|
||||
orientation(): string;
|
||||
orientation(val: string): Slider;
|
||||
axis(): boolean | d3.svg.Axis;
|
||||
axis(val: boolean | d3.svg.Axis): Slider;
|
||||
margin(): number;
|
||||
margin(val: number): Slider;
|
||||
value(): any;
|
||||
value(val: any): Slider;
|
||||
snap(): boolean;
|
||||
snap(val: boolean): Slider;
|
||||
scale(): any;
|
||||
scale(val: any): Slider;
|
||||
on(evt: ("slide" | "slideend"), callback: (evt: any, val: any) => void): Slider;
|
||||
}
|
||||
}
|
||||
Vendored
+15
@@ -52,7 +52,22 @@ declare namespace createjs {
|
||||
// methods
|
||||
clone(): Bitmap;
|
||||
}
|
||||
|
||||
export class ScaleBitmap extends DisplayObject {
|
||||
constructor(imageOrUrl: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | Object | string, scale9Grid: Rectangle);
|
||||
|
||||
// properties
|
||||
image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
|
||||
sourceRect: Rectangle;
|
||||
drawWidth: number;
|
||||
drawHeight: number;
|
||||
scale9Grid: Rectangle;
|
||||
snapToPixel: boolean;
|
||||
|
||||
// methods
|
||||
setDrawSize (newWidth: number, newHeight: number): void;
|
||||
clone(): ScaleBitmap;
|
||||
}
|
||||
|
||||
export class BitmapText extends DisplayObject {
|
||||
constructor(text?:string, spriteSheet?:SpriteSheet);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/// <reference path="./ejson.d.ts" />
|
||||
|
||||
import {
|
||||
clone as importedClone,
|
||||
parse as importedParse,
|
||||
stringify as importedStringify,
|
||||
toJSONValue as importedToJSONValue,
|
||||
fromJSONValue as importedFromJSONValue,
|
||||
isBinary as importedIsBinary,
|
||||
newBinary as importedNewBinary,
|
||||
equals as importedEquals
|
||||
} from "ejson";
|
||||
|
||||
function testImportedClone() {
|
||||
var obj: Object = {
|
||||
a: "a"
|
||||
};
|
||||
var retval: Object = importedClone(obj);
|
||||
|
||||
var str: string = "as";
|
||||
var retval2: string = importedClone(str);
|
||||
}
|
||||
|
||||
function testParse() {
|
||||
var str: string = '{a:"a"}';
|
||||
importedParse(str);
|
||||
}
|
||||
|
||||
function testStringify() {
|
||||
var obj: any = {a:"a"};
|
||||
var retval: string = importedStringify(obj);
|
||||
}
|
||||
|
||||
function testToJSONValue() {
|
||||
var obj: any = {a:"a"};
|
||||
var retval: string = importedToJSONValue(obj);
|
||||
}
|
||||
|
||||
function testFromJSONValue() {
|
||||
var str: string = '{a:"a"}';
|
||||
importedFromJSONValue(str);
|
||||
}
|
||||
|
||||
function testIsBinary() {
|
||||
var val: any = 'sasda';
|
||||
var retval: boolean = importedIsBinary(val);
|
||||
}
|
||||
|
||||
function testNewBinary() {
|
||||
var retval: Uint8Array = importedNewBinary(3);
|
||||
}
|
||||
|
||||
function testEquals() {
|
||||
var a: any;
|
||||
var b: any;
|
||||
var retval: boolean = importedEquals(a,b);
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for ejson v2.1.2
|
||||
// Project: https://www.npmjs.com/package/ejson
|
||||
// Definitions by: Shantanu Bhadoria <https://github.com/shantanubhadoria>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "ejson" {
|
||||
interface StringifyOptions {
|
||||
canonical: boolean;
|
||||
indent: boolean|number|string;
|
||||
}
|
||||
|
||||
interface CloneOptions {
|
||||
keyOrderSensitive: boolean;
|
||||
}
|
||||
|
||||
function clone<T>(obj: T): T;
|
||||
function parse(str: string): any;
|
||||
function stringify(obj: any, options?: StringifyOptions): string;
|
||||
|
||||
function toJSONValue(obj: any): string;
|
||||
function fromJSONValue(obj: string): any;
|
||||
function isBinary(value: any): boolean;
|
||||
function newBinary(len: number): Uint8Array;
|
||||
function equals(a: any, b: any, options?: CloneOptions): boolean;
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for electron 1.3.3
|
||||
// Project: https://github.com/electron-userland/electron-prebuilt
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'electron' {
|
||||
var electron: string;
|
||||
export = electron;
|
||||
}
|
||||
|
||||
+10
@@ -303,6 +303,10 @@ if (app.isAccessibilitySupportEnabled()) {
|
||||
}
|
||||
app.setLoginItemSettings({openAtLogin: true, openAsHidden: false});
|
||||
console.log(app.getLoginItemSettings().wasOpenedAtLogin);
|
||||
app.setAboutPanelOptions({
|
||||
applicationName: 'Test',
|
||||
version: '1.2.3'
|
||||
});
|
||||
|
||||
var window = new BrowserWindow();
|
||||
window.setProgressBar(0.5);
|
||||
@@ -359,6 +363,12 @@ if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
|
||||
browserOptions.frame = false;
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
systemPreferences.on('color-changed', () => { console.log('color changed'); });
|
||||
systemPreferences.on('inverted-color-scheme-changed', (_, inverted) => console.log(inverted ? 'inverted' : 'not inverted'));
|
||||
console.log('Color for menu is', systemPreferences.getColor('menu'));
|
||||
}
|
||||
|
||||
// Create the window.
|
||||
var win = new BrowserWindow(browserOptions);
|
||||
|
||||
+3
-3
@@ -26,7 +26,7 @@ ipcRenderer.send('asynchronous-message', 'ping');
|
||||
// remote
|
||||
// https://github.com/atom/electron/blob/master/docs/api/remote.md
|
||||
|
||||
var BrowserWindow: typeof Electron.BrowserWindow = remote.require('browser-window');
|
||||
var BrowserWindow = remote.BrowserWindow;
|
||||
var win = new BrowserWindow({ width: 800, height: 600 });
|
||||
win.loadURL('https://github.com');
|
||||
|
||||
@@ -167,7 +167,7 @@ holder.ondrop = function (e) {
|
||||
// nativeImage
|
||||
// https://github.com/atom/electron/blob/master/docs/api/native-image.md
|
||||
|
||||
var Tray: Electron.Tray = remote.require('Tray');
|
||||
var Tray = remote.Tray;
|
||||
var appIcon2 = new Tray('/Users/somebody/images/icon.png');
|
||||
var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' });
|
||||
var image = clipboard.readImage();
|
||||
@@ -187,7 +187,7 @@ process.once('loaded', function() {
|
||||
// screen
|
||||
// https://github.com/atom/electron/blob/master/docs/api/screen.md
|
||||
|
||||
var app: Electron.App = remote.require('app');
|
||||
var app = remote.app;
|
||||
|
||||
var mainWindow: Electron.BrowserWindow = null;
|
||||
|
||||
Vendored
+5765
File diff suppressed because it is too large
Load Diff
+27
-3
@@ -96,6 +96,18 @@ namespace ShallowWrapperTest {
|
||||
boolVal = shallowWrapper.containsAnyMatchingElements([<div className="foo bar"/>]);
|
||||
}
|
||||
|
||||
function test_dive() {
|
||||
interface TmpProps {
|
||||
foo: any
|
||||
}
|
||||
|
||||
interface TmpState {
|
||||
bar: any
|
||||
}
|
||||
|
||||
const diveWrapper: ShallowWrapper<TmpProps, TmpState> = shallowWrapper.dive<TmpProps, TmpState>({ context: { foobar: 'barfoo' }});
|
||||
}
|
||||
|
||||
function test_equals() {
|
||||
boolVal = shallowWrapper.equals(<div className="foo bar"/>);
|
||||
}
|
||||
@@ -112,6 +124,10 @@ namespace ShallowWrapperTest {
|
||||
boolVal = shallowWrapper.is('.some-class');
|
||||
}
|
||||
|
||||
function test_isEmpty() {
|
||||
boolVal = shallowWrapper.isEmpty()
|
||||
}
|
||||
|
||||
function test_not() {
|
||||
elementWrapper = shallowWrapper.find('.foo').not('.bar');
|
||||
}
|
||||
@@ -188,7 +204,7 @@ namespace ShallowWrapperTest {
|
||||
}
|
||||
|
||||
function test_state() {
|
||||
shallowWrapper.state();
|
||||
const state: MyComponentState = shallowWrapper.state();
|
||||
shallowWrapper.state('key');
|
||||
const tmp: String = shallowWrapper.state<String>('key');
|
||||
}
|
||||
@@ -218,11 +234,11 @@ namespace ShallowWrapperTest {
|
||||
}
|
||||
|
||||
function test_setState() {
|
||||
shallowWrapper = shallowWrapper.setState({ stateProperty: 'state' });
|
||||
shallowWrapper = shallowWrapper.setState({ stateProperty: 'state' }, () => console.log('state updated'));
|
||||
}
|
||||
|
||||
function test_setProps() {
|
||||
shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' });
|
||||
shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' }, () => console.log('props updated'));
|
||||
}
|
||||
|
||||
function test_setContext() {
|
||||
@@ -399,6 +415,10 @@ namespace ReactWrapperTest {
|
||||
boolVal = reactWrapper.is('.some-class');
|
||||
}
|
||||
|
||||
function test_isEmpty() {
|
||||
boolVal = reactWrapper.isEmpty()
|
||||
}
|
||||
|
||||
function test_not() {
|
||||
elementWrapper = reactWrapper.find('.foo').not('.bar');
|
||||
}
|
||||
@@ -636,6 +656,10 @@ namespace CheerioWrapperTest {
|
||||
boolVal = cheerioWrapper.is('.some-class');
|
||||
}
|
||||
|
||||
function test_isEmpty() {
|
||||
boolVal = cheerioWrapper.isEmpty()
|
||||
}
|
||||
|
||||
function test_not() {
|
||||
elementWrapper = cheerioWrapper.find('.foo').not('.bar');
|
||||
}
|
||||
|
||||
Vendored
+22
-7
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Enzyme v2.4.1
|
||||
// Type definitions for Enzyme v2.5.1
|
||||
// Project: https://github.com/airbnb/enzyme
|
||||
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>
|
||||
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>, Ivo Stratev <https://github.com/NoHomey>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference path="../react/react.d.ts" />
|
||||
@@ -102,6 +102,11 @@ declare module "enzyme" {
|
||||
*/
|
||||
is(selector: EnzymeSelector): boolean;
|
||||
|
||||
/**
|
||||
* Returns whether or not the current node is empty.
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
|
||||
/**
|
||||
* Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector.
|
||||
* This method is effectively the negation or inverse of filter.
|
||||
@@ -199,8 +204,9 @@ declare module "enzyme" {
|
||||
* Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.
|
||||
* @param [key]
|
||||
*/
|
||||
state(key?: string): any;
|
||||
state<T>(key?: string): T;
|
||||
state(): S;
|
||||
state(key: string): any;
|
||||
state<T>(key: string): T;
|
||||
|
||||
/**
|
||||
* Returns the context hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value.
|
||||
@@ -248,8 +254,9 @@ declare module "enzyme" {
|
||||
*
|
||||
* NOTE: can only be called on a wrapper instance that is also the root instance.
|
||||
* @param state
|
||||
* @param [callback]
|
||||
*/
|
||||
setState(state: S): this;
|
||||
setState(state: S, callback?: () => void): this;
|
||||
|
||||
/**
|
||||
* A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
|
||||
@@ -260,9 +267,10 @@ declare module "enzyme" {
|
||||
* Returns itself.
|
||||
*
|
||||
* NOTE: can only be called on a wrapper instance that is also the root instance.
|
||||
* @param state
|
||||
* @param props
|
||||
* @param [callback]
|
||||
*/
|
||||
setProps(props: P): this;
|
||||
setProps(props: P, callback?: () => void): this;
|
||||
|
||||
/**
|
||||
* A method that sets the context of the root component, and re-renders. Useful for when you are wanting to
|
||||
@@ -419,6 +427,13 @@ declare module "enzyme" {
|
||||
childAt(index: number): ShallowWrapper<any, any>;
|
||||
childAt<P2, S2>(index: number): ShallowWrapper<P2, S2>;
|
||||
|
||||
/**
|
||||
* Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result.
|
||||
* NOTE: can only be called on wrapper of a single non-DOM component element node.
|
||||
* @param [options]
|
||||
*/
|
||||
dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
|
||||
|
||||
/**
|
||||
* Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
|
||||
* current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// ES6 Error Test
|
||||
// ================================================================================
|
||||
/// <reference path="es6-error.d.ts"/>
|
||||
|
||||
// Imports
|
||||
// --------------------------------------------------------------------------------
|
||||
import * as ExtendableError from "es6-error"
|
||||
|
||||
class TestError extends ExtendableError {
|
||||
constructor (message: string = "TestError") {
|
||||
super(message)
|
||||
}
|
||||
}
|
||||
|
||||
throw new TestError("Test Message")
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for es6-error v4.0.0
|
||||
// Project: https://github.com/bjyoungblood/es6-error
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "es6-error" {
|
||||
export = Error
|
||||
}
|
||||
+34
-21
@@ -93,6 +93,23 @@ declare module "express-serve-static-core" {
|
||||
patch: IRouterMatcher<this>;
|
||||
options: IRouterMatcher<this>;
|
||||
head: IRouterMatcher<this>;
|
||||
|
||||
checkout: IRouterMatcher<this>;
|
||||
copy: IRouterMatcher<this>;
|
||||
lock: IRouterMatcher<this>;
|
||||
merge: IRouterMatcher<this>;
|
||||
mkactivity: IRouterMatcher<this>;
|
||||
mkcol: IRouterMatcher<this>;
|
||||
move: IRouterMatcher<this>;
|
||||
"m-search": IRouterMatcher<this>;
|
||||
notify: IRouterMatcher<this>;
|
||||
purge: IRouterMatcher<this>;
|
||||
report: IRouterMatcher<this>;
|
||||
search: IRouterMatcher<this>;
|
||||
subscribe: IRouterMatcher<this>;
|
||||
trace: IRouterMatcher<this>;
|
||||
unlock: IRouterMatcher<this>;
|
||||
unsubscribe: IRouterMatcher<this>;
|
||||
|
||||
use: IRouterHandler<this> & IRouterMatcher<this>;
|
||||
|
||||
@@ -114,6 +131,23 @@ declare module "express-serve-static-core" {
|
||||
patch: IRouterHandler<this>;
|
||||
options: IRouterHandler<this>;
|
||||
head: IRouterHandler<this>;
|
||||
|
||||
checkout: IRouterHandler<this>;
|
||||
copy: IRouterHandler<this>;
|
||||
lock: IRouterHandler<this>;
|
||||
merge: IRouterHandler<this>;
|
||||
mkactivity: IRouterHandler<this>;
|
||||
mkcol: IRouterHandler<this>;
|
||||
move: IRouterHandler<this>;
|
||||
"m-search": IRouterHandler<this>;
|
||||
notify: IRouterHandler<this>;
|
||||
purge: IRouterHandler<this>;
|
||||
report: IRouterHandler<this>;
|
||||
search: IRouterHandler<this>;
|
||||
subscribe: IRouterHandler<this>;
|
||||
trace: IRouterHandler<this>;
|
||||
unlock: IRouterHandler<this>;
|
||||
unsubscribe: IRouterHandler<this>
|
||||
}
|
||||
|
||||
export interface Router extends IRouter { }
|
||||
@@ -1064,27 +1098,6 @@ declare module "express-serve-static-core" {
|
||||
}
|
||||
|
||||
interface Express extends Application {
|
||||
/**
|
||||
* Framework version.
|
||||
*/
|
||||
version: string;
|
||||
|
||||
/**
|
||||
* Expose mime.
|
||||
*/
|
||||
mime: string;
|
||||
|
||||
(): Application;
|
||||
|
||||
/**
|
||||
* Create an express application.
|
||||
*/
|
||||
createApplication(): Application;
|
||||
|
||||
createServer(): Application;
|
||||
|
||||
application: any;
|
||||
|
||||
request: Request;
|
||||
|
||||
response: Response;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="./finalhandler.d.ts" />
|
||||
|
||||
import {ServerRequest, ServerResponse} from "http";
|
||||
import finalHandler from "finalhandler";
|
||||
import * as finalHandler from "finalhandler";
|
||||
|
||||
let req: ServerRequest;
|
||||
let res: ServerResponse;
|
||||
|
||||
Vendored
+9
-7
@@ -8,13 +8,15 @@
|
||||
declare module "finalhandler" {
|
||||
import {ServerRequest, ServerResponse} from "http";
|
||||
|
||||
export interface Options {
|
||||
message?: boolean|((err: any, status: number) => string);
|
||||
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
|
||||
stacktrace?: boolean;
|
||||
function finalHandler(req: ServerRequest, res: ServerResponse, options?: finalHandler.Options): (err: any) => void;
|
||||
|
||||
namespace finalHandler {
|
||||
export interface Options {
|
||||
message?: boolean|((err: any, status: number) => string);
|
||||
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
|
||||
stacktrace?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void;
|
||||
|
||||
export default finalHandler;
|
||||
export = finalHandler;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="fossil-delta.d.ts" />
|
||||
import * as fossilDelta from "fossil-delta";
|
||||
|
||||
var origin = new Array<number>(1,2,3);
|
||||
var target = new Array<number>(1,2,3,4,5);
|
||||
|
||||
var delta = fossilDelta.create(origin, target);
|
||||
var targetApplied = fossilDelta.apply(origin, delta);
|
||||
|
||||
var outputSize: number = fossilDelta.outputSize(delta);
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for fossil-delta 0.2.5
|
||||
// Project: https://github.com/dchest/fossil-delta-js
|
||||
// Definitions by: Endel Dreyer <https://github.com/endel/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare module "fossil-delta" {
|
||||
type ByteArray = Array<number> | Uint8Array | Buffer;
|
||||
|
||||
export function create(origin: ByteArray, target: ByteArray): Array<number>;
|
||||
export function apply(origin: ByteArray, delta: Array<number>): Array<number>;
|
||||
export function outputSize(delta: Array<number>): number;
|
||||
}
|
||||
Vendored
+15
-7
@@ -8,7 +8,7 @@
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "fs-extra" {
|
||||
export * from "fs";
|
||||
export * from "fs";
|
||||
|
||||
export function copy(src: string, dest: string, callback?: (err: Error) => void): void;
|
||||
export function copy(src: string, dest: string, filter: CopyFilter, callback?: (err: Error) => void): void;
|
||||
@@ -18,6 +18,9 @@ declare module "fs-extra" {
|
||||
export function copySync(src: string, dest: string, filter: CopyFilter): void;
|
||||
export function copySync(src: string, dest: string, options: CopyOptions): void;
|
||||
|
||||
export function move(src: string, dest: string, callback?: (err: Error) => void): void;
|
||||
export function move(src: string, dest: string, options: MoveOptions, callback?: (err: Error) => void): void;
|
||||
|
||||
export function createFile(file: string, callback?: (err: Error) => void): void;
|
||||
export function createFileSync(file: string): void;
|
||||
|
||||
@@ -55,8 +58,8 @@ declare module "fs-extra" {
|
||||
export function writeJsonSync(file: string, object: any, options?: OpenOptions): void;
|
||||
export function writeJSONSync(file: string, object: any, options?: OpenOptions): void;
|
||||
|
||||
export function ensureDir(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureDirSync(path: string): void;
|
||||
export function ensureDir(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureDirSync(path: string): void;
|
||||
|
||||
export function ensureFile(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureFileSync(path: string): void;
|
||||
@@ -67,10 +70,10 @@ declare module "fs-extra" {
|
||||
export function ensureSymlink(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureSymlinkSync(path: string): void;
|
||||
|
||||
export function emptyDir(path: string, callback?: (err: Error) => void): void;
|
||||
export function emptyDirSync(path: string): boolean;
|
||||
|
||||
export interface CopyFilterFunction {
|
||||
export function emptyDir(path: string, callback?: (err: Error) => void): void;
|
||||
export function emptyDirSync(path: string): boolean;
|
||||
|
||||
export interface CopyFilterFunction {
|
||||
(src: string): boolean
|
||||
}
|
||||
|
||||
@@ -83,6 +86,11 @@ declare module "fs-extra" {
|
||||
filter?: CopyFilter
|
||||
recursive?: boolean
|
||||
}
|
||||
|
||||
export interface MoveOptions {
|
||||
clobber? : boolean;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface OpenOptions {
|
||||
encoding?: string;
|
||||
|
||||
Vendored
+8
@@ -131,6 +131,14 @@ declare namespace FullCalendar {
|
||||
eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: ViewObject) => void;
|
||||
eventAfterAllRender?: (view: ViewObject) => void;
|
||||
eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void;
|
||||
|
||||
//scheduler options
|
||||
resourceAreaWidth?:number,
|
||||
schedulerLicenseKey?:string,
|
||||
customButtons?:any,
|
||||
resourceLabelText?:any,
|
||||
resourceColumns?:any,
|
||||
displayEventTime?:any,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/// <reference path="fusioncharts.d.ts" />
|
||||
|
||||
FusionCharts.addEventListener('ready',(eventObject)=>{
|
||||
eventObject.stopPropagation();
|
||||
});
|
||||
|
||||
FusionCharts.ready((fusioncharts)=>{
|
||||
|
||||
});
|
||||
|
||||
FusionCharts.version;
|
||||
|
||||
FusionCharts('chartId').render();;
|
||||
|
||||
FusionCharts["debugger"].enable(true);
|
||||
|
||||
let chartData ={
|
||||
type: 'column2d',
|
||||
renderAt: 'chart-container',
|
||||
width: '450',
|
||||
height: '200',
|
||||
dataFormat: 'json',
|
||||
dataSource: {
|
||||
"chart": {
|
||||
"caption": "Monthly revenue for last year",
|
||||
"subCaption": "Harry's SuperMart",
|
||||
},
|
||||
"data": [{
|
||||
"label": "Jan",
|
||||
"value": "420000"
|
||||
}, {
|
||||
"label": "Feb",
|
||||
"value": "810000"
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
let chart = new FusionCharts(chartData);
|
||||
chart.render();
|
||||
chart.isActive();
|
||||
chart.addEventListener('ready',function(eventObject){
|
||||
eventObject.type;
|
||||
});
|
||||
chart.chartType();
|
||||
chart.addVariable();
|
||||
chart.clone();
|
||||
chart.zoomTo(0,3);
|
||||
chart.zoomOut();
|
||||
chart.setJSONData(chartData);
|
||||
chart.ref;
|
||||
Vendored
+302
@@ -0,0 +1,302 @@
|
||||
// Type definitions for FusionCharts 3.11.2
|
||||
// Project: http://www.fusioncharts.com
|
||||
// Definitions by: Shivaraj KV <https://github.com/shivarajkv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare namespace FusionCharts {
|
||||
|
||||
type ChartDataFormats = 'json' | 'jsonurl' | 'csv' | 'xml' | 'xmlurl';
|
||||
|
||||
type ImageHAlign = 'left' | 'right' | 'middle';
|
||||
|
||||
type ImageVAlign = 'top' | 'bottom' | 'middle';
|
||||
|
||||
interface EventObject {
|
||||
type: string;
|
||||
|
||||
eventId: number;
|
||||
|
||||
sender: FusionCharts;
|
||||
|
||||
cancelled: boolean;
|
||||
|
||||
stopPropagation: () => void;
|
||||
|
||||
prevented: boolean;
|
||||
|
||||
preventDefault: () => void;
|
||||
|
||||
detached: boolean;
|
||||
|
||||
detachHandler: () => void;
|
||||
}
|
||||
|
||||
interface ChartObject {
|
||||
|
||||
type?: string;
|
||||
|
||||
id?: string;
|
||||
|
||||
width?: number | string;
|
||||
|
||||
height?: number | string;
|
||||
|
||||
renderAt?: string;
|
||||
|
||||
dataFormat?: ChartDataFormats;
|
||||
|
||||
dataSource?: string | {};
|
||||
|
||||
events?: {};
|
||||
|
||||
link?: {};
|
||||
|
||||
showDataLoadingMessage?: boolean;
|
||||
|
||||
showChartLoadingMessage?: boolean;
|
||||
|
||||
baseChartMessageFont?: string;
|
||||
|
||||
baseChartMessageFontSize?: string;
|
||||
|
||||
baseChartMessageColor?: string;
|
||||
|
||||
dataLoadStartMessage?: string;
|
||||
|
||||
dataLoadErrorMessage?: string;
|
||||
|
||||
dataInvalidMessage?: string;
|
||||
|
||||
dataEmptyMessage?: string;
|
||||
|
||||
typeNotSupportedMessage?: string;
|
||||
|
||||
loadMessage?: string;
|
||||
|
||||
renderErrorMessage?: string;
|
||||
|
||||
containerBackgroundColor?: string;
|
||||
|
||||
containerBackgroundOpacity?: number;
|
||||
|
||||
containerClassName?: string;
|
||||
|
||||
baseChartMessageImageHAlign?: ImageHAlign;
|
||||
|
||||
dataLoadErrorMessageImageVAlign?: ImageVAlign;
|
||||
|
||||
dataLoadErrorMessageImageAlpha?: number;
|
||||
|
||||
dataLoadErrorMessageImageScale?: number;
|
||||
|
||||
dataLoadStartMessageImageHAlign?: ImageHAlign;
|
||||
|
||||
dataLoadStartMessageImageVAlign?: ImageVAlign;
|
||||
|
||||
dataLoadStartMessageImageAlpha?: number;
|
||||
|
||||
dataLoadStartMessageImageScale?: number;
|
||||
|
||||
dataInvalidMessageImageHAlign?: ImageHAlign;
|
||||
|
||||
dataInvalidMessageImageVAlign?: ImageVAlign;
|
||||
|
||||
dataInvalidMessageImageAlpha?: number;
|
||||
|
||||
dataInvalidMessageImageScale?: number;
|
||||
|
||||
dataEmptyMessageImageHAlign?: ImageHAlign;
|
||||
|
||||
dataEmptyMessageImageVAlign?: ImageVAlign;
|
||||
|
||||
dataEmptyMessageImageAlpha?: number;
|
||||
|
||||
dataEmptyMessageImageScale?: number;
|
||||
|
||||
renderErrorMessageImageHAlign?: ImageHAlign;
|
||||
|
||||
renderErrorMessageImageVAlign?: ImageVAlign;
|
||||
|
||||
renderErrorMessageImageAlpha?: number;
|
||||
|
||||
renderErrorMessageImageScale?: number;
|
||||
|
||||
loadMessageImageHAlign?: ImageHAlign;
|
||||
|
||||
loadMessageImageVAlign?: ImageVAlign;
|
||||
|
||||
loadMessageImageAlpha?: number;
|
||||
|
||||
loadMessageImageScale?: number;
|
||||
}
|
||||
|
||||
interface Debugger {
|
||||
outputFormat(format: any): void;
|
||||
|
||||
outputTo(callback: (message: any) => any): void;
|
||||
|
||||
enable(state:any,outputTo?:(message: any) =>any,outputFormat?:any):void
|
||||
|
||||
enableFirebugLite():any;
|
||||
}
|
||||
|
||||
interface FusionCharts {
|
||||
clone(overrides?: {}, argsOnly?: boolean): any;
|
||||
|
||||
isActive(): boolean;
|
||||
|
||||
chartType(value?: string, options?: any): string;
|
||||
|
||||
addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void;
|
||||
|
||||
removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void;
|
||||
|
||||
configureLink(param: {} | any[], level?: number): void;
|
||||
|
||||
setChartAttribute(attributes: ChartObject | String, value?: string): void;
|
||||
|
||||
getChartAttribute(attribute?: string | string[]): ChartObject;
|
||||
|
||||
getXMLData(): any;
|
||||
|
||||
setXMLData(data: string | {}): void;
|
||||
|
||||
setXMLUrl(url: string): void;
|
||||
|
||||
setChartDataUrl(url: string, format: ChartDataFormats): void;
|
||||
|
||||
setChartData(data: string | {}, format: ChartDataFormats): void;
|
||||
|
||||
getChartData(format: ChartDataFormats): any;
|
||||
|
||||
dataReady(available?: boolean): boolean;
|
||||
|
||||
feedData(stream: string): void;
|
||||
|
||||
getData(): any;
|
||||
|
||||
getDataWithId(): any;
|
||||
|
||||
setData(value: number, label: string): void;
|
||||
|
||||
stopUpdate(): void;
|
||||
|
||||
restartUpdate(): void;
|
||||
|
||||
isUpdateActive(): boolean;
|
||||
|
||||
clearChart(): void;
|
||||
|
||||
getSWFHTML(): any;
|
||||
|
||||
addVariable(): void;
|
||||
|
||||
getXML(): any;
|
||||
|
||||
setDataXML(data: string | {}): void;
|
||||
|
||||
setDataURL(url: string): void;
|
||||
|
||||
hasRendered(): boolean;
|
||||
|
||||
setTransparent(transparency?: boolean): void;
|
||||
|
||||
isPlotItemSliced(index: number): boolean;
|
||||
|
||||
slicePlotItem(index: number, slice: boolean): void;
|
||||
|
||||
centerLabel(labelText: string, options?: {}): void;
|
||||
|
||||
startingAngle(angle?: number, relative?: boolean): void;
|
||||
|
||||
zoomOut(): void;
|
||||
|
||||
zoomTo(startIndex: number, endIndex: number): void;
|
||||
|
||||
resetChart(): void;
|
||||
|
||||
setZoomMode(yes: boolean): void;
|
||||
|
||||
getViewStartIndex(): number;
|
||||
|
||||
getViewEndIndex(): number;
|
||||
|
||||
print(options?: {}): void;
|
||||
|
||||
exportChart(options?: {}): void;
|
||||
|
||||
getSVGString(): string;
|
||||
|
||||
lockResize(state: boolean): boolean;
|
||||
|
||||
showChartMessage(text: string, modal?: boolean, cancelable?: boolean): void;
|
||||
|
||||
getJSONData(): JSON;
|
||||
|
||||
setJSONData(data: string | {}): void;
|
||||
|
||||
setJSONUrl(url: string): void;
|
||||
|
||||
getCSVData(): any;
|
||||
|
||||
getDataAsCSV(): any;
|
||||
|
||||
render(containerElement?: string | Element, insertMode?: string, callback?: () => any): FusionCharts;
|
||||
|
||||
resizeTo(width: number | string, height: number | string): any;
|
||||
|
||||
dispose(): void;
|
||||
|
||||
configure(options: {}): void;
|
||||
|
||||
ref: {};
|
||||
|
||||
}
|
||||
|
||||
interface FusionChartStatic {
|
||||
new (chartObject: ChartObject|{}): FusionCharts;
|
||||
|
||||
(chartId: string): FusionCharts;
|
||||
|
||||
getObjectReference(elementId: string): Element;
|
||||
|
||||
addEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void;
|
||||
|
||||
removeEventListener(type: string | string[], listener: (eventObject?: EventObject, eventArgs?: {}) => void): void;
|
||||
|
||||
ready(callback: (fusionChartStatic?: FusionChartStatic) => any, context?: any): FusionChartStatic;
|
||||
|
||||
transcodeData(data: string | {}, source: ChartDataFormats, target: ChartDataFormats, advanced: boolean): any;
|
||||
|
||||
batchExport(options: {}): void;
|
||||
|
||||
formatNumber(num: number, type?: string, config?: {}): Element;
|
||||
|
||||
setCurrentRenderer(name: string): void
|
||||
|
||||
getCurrentRenderer(): string;
|
||||
|
||||
render(options?: ChartObject, callback?: () => any): FusionCharts;
|
||||
|
||||
version: string[];
|
||||
|
||||
items: {};
|
||||
|
||||
options: {};
|
||||
|
||||
debugger:Debugger;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'FusionCharts' {
|
||||
var FusionCharts: FusionCharts.FusionChartStatic;
|
||||
export = FusionCharts;
|
||||
}
|
||||
|
||||
declare var FusionCharts: FusionCharts.FusionChartStatic;
|
||||
|
||||
|
||||
Vendored
+2
-4
@@ -3,8 +3,6 @@
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'electron' {
|
||||
var electron: string;
|
||||
export = electron;
|
||||
}
|
||||
/// <reference path="../electron/electron.d.ts" />
|
||||
|
||||
// this file will be removed.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user