mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' into RxJS
This commit is contained in:
@@ -33,3 +33,5 @@ _infrastructure/tests/build
|
||||
!rx.js
|
||||
|
||||
node_modules
|
||||
|
||||
.sublimets
|
||||
|
||||
@@ -2,5 +2,7 @@ language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
|
||||
sudo: false
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
+672
-417
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
/// <reference path="headroom.d.ts" />
|
||||
|
||||
new Headroom(document.getElementById('siteHead'));
|
||||
|
||||
new Headroom(document.getElementsByClassName('siteHead')[0]);
|
||||
|
||||
new Headroom(document.getElementsByClassName('siteHead')[0], {
|
||||
tolerance: 34
|
||||
});
|
||||
|
||||
new Headroom(document.getElementsByClassName('siteHead')[0], {
|
||||
offset: 500
|
||||
});
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for headroom.js v0.7.0
|
||||
// Project: http://wicky.nillia.ms/headroom.js/
|
||||
// Definitions by: Jakub Olek <https://github.com/hakubo/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface HeadroomOptions {
|
||||
offset?: number;
|
||||
tolerance?: any;
|
||||
classes?: {
|
||||
initial?: string;
|
||||
pinned?: string;
|
||||
unpinned?: string;
|
||||
top?: string;
|
||||
notTop?: string;
|
||||
};
|
||||
scroller?: Element;
|
||||
onPin?: () => void;
|
||||
onUnPin?: () => void;
|
||||
onTop?: () => void;
|
||||
onNotTop?: () => void;
|
||||
|
||||
}
|
||||
|
||||
declare class Headroom {
|
||||
constructor(element: Node, options?: HeadroomOptions);
|
||||
constructor(element: Element, options?: HeadroomOptions);
|
||||
init: () => void;
|
||||
}
|
||||
@@ -1 +1,23 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
function readJSON(target) {
|
||||
return JSON.parse(fs.readFileSync(target, 'utf8'));
|
||||
}
|
||||
|
||||
function getSemFloat(str) {
|
||||
var m = /^[^\d]*(\d+)\.(\d+)/.exec(str);
|
||||
return parseFloat(m[1] + '.' + m[2]);
|
||||
}
|
||||
|
||||
var repo = readJSON(path.resolve(__dirname, '..', 'package.json'));
|
||||
|
||||
var testerPath = path.resolve(__dirname, '..', 'node_modules', 'definition-tester', 'package.json');
|
||||
|
||||
// ultra lame semver major/minor check
|
||||
if (!fs.existsSync(testerPath) || getSemFloat(repo.dependencies['definition-tester']) > getSemFloat(readJSON(testerPath).version)) {
|
||||
console.log('DefinitelyTyped tester needs an update!\n\n please run \'npm install\'\n');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
require('definition-tester');
|
||||
|
||||
+14169
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('./tsc.js')
|
||||
File diff suppressed because one or more lines are too long
+14169
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('./tsc.js')
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,33 @@
|
||||
/// <reference path="adm-zip.d.ts" />
|
||||
import AdmZip = require("adm-zip");
|
||||
|
||||
|
||||
// reading archives
|
||||
var zip = new AdmZip("./my_file.zip");
|
||||
var zipEntries = zip.getEntries(); // an array of ZipEntry records
|
||||
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
console.log(zipEntry.toString()); // outputs zip entries information
|
||||
if (zipEntry.entryName == "my_file.txt") {
|
||||
console.log(zipEntry.getData().toString('utf8'));
|
||||
}
|
||||
});
|
||||
// outputs the content of some_folder/my_file.txt
|
||||
console.log(zip.readAsText("some_folder/my_file.txt"));
|
||||
// extracts the specified file to the specified location
|
||||
zip.extractEntryTo(/*entry name*/"some_folder/my_file.txt", /*target path*/"/home/me/tempfolder", /*overwrite*/true)
|
||||
// extracts everything
|
||||
zip.extractAllTo(/*target path*/"/home/me/zipcontent/", /*overwrite*/true);
|
||||
|
||||
|
||||
// creating archives
|
||||
var zip = new AdmZip();
|
||||
|
||||
// add file directly
|
||||
zip.addFile("test.txt", new Buffer("inner content of the file"), "entry comment goes here");
|
||||
// add local file
|
||||
zip.addLocalFile("/home/me/some_picture.png");
|
||||
// get everything as a buffer
|
||||
var willSendthis = zip.toBuffer();
|
||||
// or write everything to disk
|
||||
zip.writeZip(/*target file name*/"/home/me/files.zip");
|
||||
Vendored
+300
@@ -0,0 +1,300 @@
|
||||
// Type definitions for adm-zip v0.4.4
|
||||
// Project: https://github.com/cthackers/adm-zip
|
||||
// Definitions by: John Vilk <https://github.com/jvilk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module AdmZip {
|
||||
class ZipFile {
|
||||
/**
|
||||
* Create a new, empty archive.
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Read an existing archive.
|
||||
*/
|
||||
constructor(fileName: string);
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as a
|
||||
* Buffer object.
|
||||
* @param entry String with the full path of the entry
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: string): Buffer;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as a
|
||||
* Buffer object.
|
||||
* @param entry ZipEntry object
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: IZipEntry): Buffer;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry String with the full path of the entry
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: string, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry ZipEntry object
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
* @param entry String with the full path of the entry
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: string, encoding?: string): string;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
* @param entry ZipEntry object
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: IZipEntry, encoding?: string): string;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry String with the full path of the entry
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: string, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry ZipEntry object
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
* @param entry String with the full path of the entry
|
||||
*/
|
||||
deleteFile(entry: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
* @param entry A ZipEntry object.
|
||||
*/
|
||||
deleteFile(entry: IZipEntry): void;
|
||||
/**
|
||||
* Adds a comment to the zip. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* @param comment Content of the comment.
|
||||
*/
|
||||
addZipComment(comment: string): void;
|
||||
/**
|
||||
* Returns the zip comment
|
||||
* @return The zip comment.
|
||||
*/
|
||||
getZipComment(): string;
|
||||
/**
|
||||
* Adds a comment to a specified zipEntry. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* The comment cannot exceed 65535 characters in length.
|
||||
* @param entry String with the full path of the entry
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: string, comment: string): void;
|
||||
/**
|
||||
* Adds a comment to a specified zipEntry. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
* The comment cannot exceed 65535 characters in length.
|
||||
* @param entry ZipEntry object.
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: IZipEntry, comment: string): void;
|
||||
/**
|
||||
* Returns the comment of the specified entry.
|
||||
* @param entry String with the full path of the entry.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: string): string;
|
||||
/**
|
||||
* Returns the comment of the specified entry
|
||||
* @param entry ZipEntry object.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: IZipEntry): string;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
* @param entry String with the full path of the entry.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: string, content: Buffer): void;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
* @param entry ZipEntry object.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: IZipEntry, content: Buffer): void;
|
||||
/**
|
||||
* Adds a file from the disk to the archive.
|
||||
* @param localPath Path to a file on disk.
|
||||
* @param zipPath Path to a directory in the archive. Defaults to the empty
|
||||
* string.
|
||||
*/
|
||||
addLocalFile(localPath: string, zipPath?: string): void;
|
||||
/**
|
||||
* Adds a local directory and all its nested files and directories to the
|
||||
* archive.
|
||||
* @param localPath Path to a folder on disk.
|
||||
* @param zipPath Path to a folder in the archive. Defaults to an empty
|
||||
* string.
|
||||
*/
|
||||
addLocalFolder(localPath: string, zipPath?: string): void;
|
||||
/**
|
||||
* Allows you to create a entry (file or directory) in the zip file.
|
||||
* If you want to create a directory the entryName must end in / and a null
|
||||
* buffer should be provided.
|
||||
* @param entryName Entry path
|
||||
* @param content Content to add to the entry; must be a 0-length buffer
|
||||
* for a directory.
|
||||
* @param comment Comment to add to the entry.
|
||||
* @param attr Attribute to add to the entry.
|
||||
*/
|
||||
addFile(entryName: string, data: Buffer, comment?: string, attr?: number): void;
|
||||
/**
|
||||
* Returns an array of ZipEntry objects representing the files and folders
|
||||
* inside the archive
|
||||
*/
|
||||
getEntries(): IZipEntry[];
|
||||
/**
|
||||
* Returns a ZipEntry object representing the file or folder specified by
|
||||
* ``name``.
|
||||
* @param name Name of the file or folder to retrieve.
|
||||
* @return ZipEntry The entry corresponding to the name.
|
||||
*/
|
||||
getEntry(name: string): IZipEntry;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
* its subdirectories will be extracted.
|
||||
* @param entry String with the full path of the entry
|
||||
* @param targetPath Target folder where to write the file
|
||||
* @param maintainEntryPath If maintainEntryPath is true and the entry is
|
||||
* inside a folder, the entry folder will be created in targetPath as
|
||||
* well. Default is TRUE
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: string, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
* its subdirectories will be extracted.
|
||||
* @param entry ZipEntry object
|
||||
* @param targetPath Target folder where to write the file
|
||||
* @param maintainEntryPath If maintainEntryPath is true and the entry is
|
||||
* inside a folder, the entry folder will be created in targetPath as
|
||||
* well. Default is TRUE
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
* @param overwrite If the file already exists at the target path, the file
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
*/
|
||||
extractAllTo(targetPath: string, overwrite?: boolean): void;
|
||||
/**
|
||||
* Writes the newly created zip file to disk at the specified location or
|
||||
* if a zip was opened and no ``targetFileName`` is provided, it will
|
||||
* overwrite the opened zip
|
||||
* @param targetFileName
|
||||
*/
|
||||
writeZip(targetPath?: string): void;
|
||||
/**
|
||||
* Returns the content of the entire zip file as a Buffer object
|
||||
* @return Buffer
|
||||
*/
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
interface IZipEntry {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "adm-zip" {
|
||||
import zipFile = AdmZip.ZipFile;
|
||||
export = zipFile;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="./angular-http-auth.d.ts" />
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
angular.module('login', ['http-auth-interceptor'])
|
||||
|
||||
.controller('LoginController', ($scope:any, $http:any, authService:ng.httpAuth.IAuthService) => {
|
||||
$scope.submit = () => {
|
||||
$http.post('auth/login').success(() => {
|
||||
authService.loginConfirmed();
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for angular-http-auth 1.2.1
|
||||
// Project: https://github.com/witoldsz/angular-http-auth
|
||||
// Definitions by: vvakame <https://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ng.httpAuth {
|
||||
interface IAuthService {
|
||||
loginConfirmed(data?:any, configUpdater?:Function):void;
|
||||
loginCancelled(data?:any, reason?:any):void;
|
||||
}
|
||||
|
||||
interface IHttpBuffer {
|
||||
append(config:ng.IRequestConfig, deferred:{resolve(data:any):void; reject(data:any):void;}):void;
|
||||
rejectAll(reason?:any):void;
|
||||
retryAll(updater?:Function):void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/// <reference path="angular-notify.d.ts" />
|
||||
|
||||
var myapp = angular.module("myapp", ["cgNotify"]);
|
||||
|
||||
myapp.controller("MyController", ["$scope", "cgNotify",
|
||||
function ($scope:ng.IScope, notify:ng.cgNotify.INotifyService) { // <-- Inject notify
|
||||
|
||||
var notifyObj = notify("Your notification message"); // <-- Call notify with your message
|
||||
notifyObj.close();
|
||||
|
||||
notify.config({
|
||||
startTop: 10,
|
||||
verticalSpacing: 15,
|
||||
duration: 10000,
|
||||
templateUrl: "angular-notify.html",
|
||||
position: "center",
|
||||
container: document.body
|
||||
});
|
||||
|
||||
notify( {
|
||||
message: "My message",
|
||||
templateUrl: "my_template.html",
|
||||
position: "center",
|
||||
container: document.body,
|
||||
classes: "", // <-- CSS class names
|
||||
$scope: $scope
|
||||
}); // <-- Call notify with your message + option
|
||||
|
||||
notify.closeAll();
|
||||
}
|
||||
]);
|
||||
Vendored
+116
@@ -0,0 +1,116 @@
|
||||
// Type definitions for angular-notify 2.0.2
|
||||
// Project: https://github.com/cgross/angular-notify
|
||||
// Definitions by: Suwato <https://github.com/Suwato/DefinitelyTyped>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module ng.cgNotify {
|
||||
|
||||
interface INotifyService {
|
||||
|
||||
/**
|
||||
* The notify function can either be passed a string or an object.
|
||||
* This function will return an object with a close() method and a message property.
|
||||
* @param message
|
||||
*/
|
||||
(message:string):INotify;
|
||||
|
||||
/**
|
||||
* When passing an object, the object parameters can be:
|
||||
* @param option
|
||||
*/
|
||||
(option:{
|
||||
/**
|
||||
* Required. The message to show.
|
||||
*/
|
||||
message : string;
|
||||
|
||||
/**
|
||||
* Optional. A custom template for the UI of the message.
|
||||
*/
|
||||
templateUrl? : string;
|
||||
|
||||
/**
|
||||
* Optional. A list of custom CSS classes to apply to the message element.
|
||||
*/
|
||||
classes? : string;
|
||||
|
||||
/**
|
||||
* Optional. A string containing any valid Angular HTML which will be shown instead of the regular message text.
|
||||
* The string must contain one root element like all valid Angular HTML templates (so wrap everything in a <span>).
|
||||
*/
|
||||
messageTemplate? : string;
|
||||
|
||||
/**
|
||||
* Optional. A valid Angular scope object. The scope of the template will be created by calling $new() on this scope.
|
||||
*/
|
||||
$scope? : ng.IScope;
|
||||
|
||||
/**
|
||||
* Optional. Currently center and right are the only acceptable values.
|
||||
*/
|
||||
position? : string;
|
||||
|
||||
/**
|
||||
* Optional. Element that contains each notification. Defaults to document.body.
|
||||
*/
|
||||
container? : any;
|
||||
}):INotify;
|
||||
|
||||
|
||||
/**
|
||||
* Call config to set the default configuration options for angular-notify.
|
||||
* The following options may be specified in the given object:
|
||||
* @param option
|
||||
*/
|
||||
config(option:{
|
||||
/**
|
||||
* The default duration (in milliseconds) of each message. A duration of 0 will prevent messages from closing automatically.
|
||||
*/
|
||||
duration? : number;
|
||||
|
||||
/**
|
||||
* The Y pixel value where messages will be shown.
|
||||
*/
|
||||
startTop? : number;
|
||||
|
||||
/**
|
||||
* The number of pixels that should be reserved between messages vertically.
|
||||
*/
|
||||
verticalSpacing? : number;
|
||||
|
||||
/**
|
||||
* The default message template.
|
||||
*/
|
||||
templateUrl? : string;
|
||||
|
||||
/**
|
||||
* The default position of each message. Currently only center and right are the supported values.
|
||||
*/
|
||||
position? : string;
|
||||
|
||||
/**
|
||||
* The default element that contains each notification. Defaults to document.body.
|
||||
*/
|
||||
container? : any;
|
||||
}):void;
|
||||
|
||||
/**
|
||||
* Closes all currently open notifications.
|
||||
*/
|
||||
closeAll():void;
|
||||
}
|
||||
|
||||
interface INotify{
|
||||
/**
|
||||
* The message to show.
|
||||
*/
|
||||
message:string;
|
||||
|
||||
/**
|
||||
* Close this open notifications.
|
||||
*/
|
||||
close():void;
|
||||
}
|
||||
}
|
||||
@@ -3,53 +3,166 @@
|
||||
var myapp = angular.module("myapp", ["firebase"]);
|
||||
|
||||
interface AngularFireScope extends ng.IScope {
|
||||
items: AngularFire;
|
||||
remoteItems: RemoteItems;
|
||||
}
|
||||
|
||||
interface RemoteItems {
|
||||
bar: string;
|
||||
data: any;
|
||||
}
|
||||
|
||||
var url = "https://myapp.firebaseio.com";
|
||||
|
||||
myapp.controller("MyController", ["$scope", "$firebase",
|
||||
function($scope: AngularFireScope, $firebase: AngularFireService) {
|
||||
$scope.items = $firebase(new Firebase(url));
|
||||
$scope.items.$add({ foo: "bar" });
|
||||
$scope.items.$remove("foo");
|
||||
$scope.items.$remove();
|
||||
$scope.items.$save();
|
||||
var child = $scope.items.$child("foo");
|
||||
child.$remove();
|
||||
$scope.items.$set({ bar: "baz" });
|
||||
var keys = $scope.items.$getIndex();
|
||||
keys.forEach(function(key, i) {
|
||||
console.log(i, (<any>$scope.items)[key]);
|
||||
});
|
||||
$scope.items.$on("loaded", function() {
|
||||
console.log("Initial data received!");
|
||||
});
|
||||
$scope.items.$on("change", function() {
|
||||
console.log("A remote change was applied locally!");
|
||||
});
|
||||
$scope.items.$off('loaded');
|
||||
function stopSync() {
|
||||
$scope.items.$off();
|
||||
myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$FirebaseArray',
|
||||
function ($scope: AngularFireScope, $firebase: AngularFireService, $FirebaseObject: AngularFireObjectService, $FirebaseArray: AngularFireArrayService) {
|
||||
var ref = new Firebase(url);
|
||||
var sync = $firebase(ref);
|
||||
|
||||
// AngularFire
|
||||
{
|
||||
sync.$asArray();
|
||||
sync.$asObject();
|
||||
sync.$ref();
|
||||
sync.$remove();
|
||||
sync.$push({ foo: "foo data" });
|
||||
sync.$set("foo", 1);
|
||||
sync.$set({ foo: 2 });
|
||||
sync.$update({ foo: 3 });
|
||||
sync.$update("foo", { bar: 1 });
|
||||
|
||||
// Increment the message count by 1
|
||||
sync.$transaction('count', function (currentCount) {
|
||||
if (!currentCount) return 1; // Initial value for counter.
|
||||
if (currentCount < 0) return; // Return undefined to abort transaction.
|
||||
return currentCount + 1; // Increment the count by 1.
|
||||
}).then(function (snapshot) {
|
||||
if (!snapshot) {
|
||||
// Handle aborted transaction.
|
||||
} else {
|
||||
// Do something.
|
||||
console.log(snapshot.val());
|
||||
}
|
||||
}, function (err) {
|
||||
// Handle the error condition.
|
||||
console.log(err.stack);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// AngularFireObject
|
||||
{
|
||||
var obj = sync.$asObject();
|
||||
|
||||
// $id
|
||||
if (obj.$id !== ref.name()) throw "error";
|
||||
|
||||
// $loaded()
|
||||
obj.$loaded().then((data) => {
|
||||
if (data !== obj) throw "error";
|
||||
// $priority
|
||||
obj.$priority;
|
||||
|
||||
// $value, $save()
|
||||
obj.$value = "foobar";
|
||||
obj.$save();
|
||||
});
|
||||
|
||||
// $inst()
|
||||
if (obj.$inst() !== sync) throw "error";
|
||||
|
||||
// $bindTo()
|
||||
obj.$bindTo($scope, "data").then(function () {
|
||||
console.log($scope.data);
|
||||
$scope.data.foo = "baz"; // will be saved to Firebase
|
||||
sync.$set({ foo: "baz" }); // this would update Firebase and $scope.data
|
||||
});
|
||||
|
||||
// $watch()
|
||||
var unwatch = obj.$watch(function () {
|
||||
console.log("data changed!");
|
||||
});
|
||||
unwatch();
|
||||
|
||||
// $destroy()
|
||||
obj.$destroy();
|
||||
|
||||
// $extendFactory()
|
||||
var NewFactory = $FirebaseObject.$extendFactory({
|
||||
getMyFavoriteColor: function () {
|
||||
return this.favoriteColor + ", no green!"; // obscure Monty Python reference
|
||||
}
|
||||
});
|
||||
var customObj = $firebase(ref, { objectFactory: NewFactory }).$asObject();
|
||||
}
|
||||
|
||||
// AngularFireArray
|
||||
{
|
||||
var list = sync.$asArray();
|
||||
|
||||
// $inst()
|
||||
if (list.$inst() !== sync) throw "error";
|
||||
|
||||
// $add()
|
||||
list.$add({ foo: "foo value" });
|
||||
|
||||
// $keyAt()
|
||||
var key = list.$keyAt(0);
|
||||
|
||||
// $indexFor()
|
||||
var index = list.$indexFor(key);
|
||||
|
||||
// $getRecord()
|
||||
var item = list.$getRecord(key);
|
||||
|
||||
// $save()
|
||||
item["bar"] = "bar value";
|
||||
list.$save(item);
|
||||
|
||||
// $remove()
|
||||
list.$remove(item);
|
||||
|
||||
// $loaded()
|
||||
list.$loaded().then(data => {
|
||||
if (data !== list) throw "error";
|
||||
});
|
||||
|
||||
// $watch()
|
||||
var unwatch = list.$watch((event, key, prevChild) => {
|
||||
switch (event) {
|
||||
case "child_added":
|
||||
console.log(key + " added");
|
||||
break;
|
||||
case "child_changed":
|
||||
console.log(key + " changed");
|
||||
break;
|
||||
case "child_moved":
|
||||
console.log(key + " moved");
|
||||
break;
|
||||
case "child_removed":
|
||||
console.log(key + " removed");
|
||||
break;
|
||||
default:
|
||||
throw "error";
|
||||
}
|
||||
});
|
||||
unwatch();
|
||||
|
||||
// $destroy()
|
||||
list.$destroy();
|
||||
|
||||
// $extendFactory()
|
||||
var ArrayWithSum = $FirebaseArray.$extendFactory({
|
||||
sum: function () {
|
||||
var total = 0;
|
||||
angular.forEach(this.$list, function (rec) {
|
||||
total += rec.x;
|
||||
});
|
||||
return total;
|
||||
}
|
||||
});
|
||||
var list = $firebase(ref, { arrayFactory: ArrayWithSum }).$asArray();
|
||||
list.$loaded().then(function () {
|
||||
console.log("List has " + (<any>list).sum() + " items");
|
||||
});
|
||||
}
|
||||
$scope.items.$bind($scope, "remoteItems");
|
||||
$scope.remoteItems.bar = "foo";
|
||||
$scope.items.$bind($scope, "remote").then(function(unbind) {
|
||||
unbind();
|
||||
$scope.remoteItems.bar = "foo";
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
var foo: AngularFireObject = {
|
||||
$priority: 0
|
||||
};
|
||||
|
||||
interface AngularFireAuthScope extends ng.IScope {
|
||||
loginObj: AngularFireAuth;
|
||||
}
|
||||
|
||||
Vendored
+55
-14
@@ -1,4 +1,4 @@
|
||||
// Type definitions for AngularFire 0.6.0
|
||||
// Type definitions for AngularFire 0.8.2
|
||||
// Project: http://angularfire.com
|
||||
// Definitions by: Dénes Harmath <http://github.com/thSoft>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -7,24 +7,65 @@
|
||||
/// <reference path="../firebase/firebase.d.ts"/>
|
||||
|
||||
interface AngularFireService {
|
||||
(firebase: Firebase): AngularFire;
|
||||
(firebase: Firebase, config?: any): AngularFire;
|
||||
}
|
||||
|
||||
interface AngularFire {
|
||||
$add(value: any): void;
|
||||
$remove(key?: string): void;
|
||||
$save(key?: string): void;
|
||||
$child(key: string): AngularFire;
|
||||
$set(value: any): void;
|
||||
$getIndex(): string[];
|
||||
$on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
|
||||
$off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
|
||||
$bind($scope: ng.IScope, modelName: string): ng.IPromise<any>;
|
||||
$asArray(): AngularFireArray;
|
||||
$asObject(): AngularFireObject;
|
||||
$ref(): Firebase;
|
||||
$push(data: any): ng.IPromise<Firebase>;
|
||||
$set(key: string, data: any): ng.IPromise<Firebase>;
|
||||
$set(data: any): ng.IPromise<Firebase>;
|
||||
$remove(key?: string): ng.IPromise<Firebase>;
|
||||
$update(key: string, data: Object): ng.IPromise<Firebase>;
|
||||
$update(data: any): ng.IPromise<Firebase>;
|
||||
$transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<IFirebaseDataSnapshot>;
|
||||
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<IFirebaseDataSnapshot>;
|
||||
}
|
||||
|
||||
interface AngularFireObject {
|
||||
$priority: number;
|
||||
interface AngularFireObject extends AngularFireSimpleObject {
|
||||
$id: string;
|
||||
$priority: number;
|
||||
$value: any;
|
||||
$save(): ng.IPromise<Firebase>;
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise<AngularFireObject>;
|
||||
$inst(): AngularFire;
|
||||
$bindTo(scope: ng.IScope, varName: string): ng.IPromise<any>;
|
||||
$watch(callback: Function, context?: any): Function;
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireObjectService {
|
||||
$extendFactory(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
interface AngularFireArray extends Array<AngularFireSimpleObject> {
|
||||
$add(newData: any): ng.IPromise<Firebase>;
|
||||
$save(recordOrIndex: any): ng.IPromise<Firebase>;
|
||||
$remove(recordOrIndex: any): ng.IPromise<Firebase>;
|
||||
$getRecord(key: string): AngularFireSimpleObject;
|
||||
$keyAt(recordOrIndex: any): string;
|
||||
$indexFor(key: string): number;
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise<AngularFireArray>;
|
||||
$inst(): AngularFire;
|
||||
$watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function;
|
||||
$destroy(): void;
|
||||
}
|
||||
interface AngularFireArrayService {
|
||||
$extendFactory(ChildClass: Object, methods?: Object): Object;
|
||||
}
|
||||
|
||||
interface AngularFireSimpleObject {
|
||||
$id: string;
|
||||
$priority: number;
|
||||
$value: any;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
interface AngularFireAuthService {
|
||||
(firebase: Firebase): AngularFireAuth;
|
||||
@@ -34,7 +75,7 @@ interface AngularFireAuth {
|
||||
$getCurrentUser(): ng.IPromise<any>;
|
||||
$login(provider: string, options?: Object): ng.IPromise<any>;
|
||||
$logout(): void;
|
||||
$createUser(email: string, password: string, noLogin?: boolean): ng.IPromise<any>;
|
||||
$createUser(email: string, password: string): ng.IPromise<any>;
|
||||
$changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise<any>;
|
||||
$removeUser(email: string, password: string): ng.IPromise<any>;
|
||||
$sendPasswordResetEmail(email: string): ng.IPromise<any>;
|
||||
|
||||
Vendored
+98
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS 1.2+ (ngAnimate module)
|
||||
// Type definitions for Angular JS 1.3 (ngAnimate module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
@@ -13,9 +13,104 @@ declare module ng.animate {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AnimateService
|
||||
// see http://docs.angularjs.org/api/ngAnimate.$animate
|
||||
// see http://docs.angularjs.org/api/ngAnimate/service/$animate
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateService extends ng.IAnimateService {
|
||||
/**
|
||||
* Globally enables / disables animations.
|
||||
*
|
||||
* @param value If provided then set the animation on or off.
|
||||
* @param element If provided then the element will be used to represent the enable/disable operation.
|
||||
* @returns current animation state
|
||||
*/
|
||||
enabled(value?: boolean, element?: JQuery): boolean;
|
||||
|
||||
/**
|
||||
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
|
||||
*
|
||||
* @param element the element that will be the focus of the enter animation
|
||||
* @param parentElement the parent element of the element that will be the focus of the enter animation
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Runs the leave animation operation and, upon completion, removes the element from the DOM.
|
||||
*
|
||||
* @param element the element that will be the focus of the leave animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
leave(element: JQuery): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Fires the move DOM operation. Just before the animation starts, the animate service will either append
|
||||
* it into the parentElement container or add the element directly after the afterElement element if present.
|
||||
* Then the move animation will be run.
|
||||
*
|
||||
* @param element the element that will be the focus of the move animation
|
||||
* @param parentElement the parent element of the element that will be the focus of the move animation
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then attaches the className
|
||||
* value to the element as a CSS class.
|
||||
*
|
||||
* @param element the element that will be animated
|
||||
* @param className the CSS class that will be added to the element and then animated
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
addClass(element: JQuery, className: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then removes the CSS class
|
||||
* provided by the className value from the element.
|
||||
*
|
||||
* @param element the element that will be animated
|
||||
* @param className the CSS class that will be animated and then removed from the element
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
removeClass(element: JQuery, className: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback
|
||||
* will be fired (if provided).
|
||||
*
|
||||
* @param element the element which will have its CSS classes changed removed from it
|
||||
* @param add the CSS classes which will be added to the element
|
||||
* @param remove the CSS class which will be removed from the element CSS classes have been set on the element
|
||||
* @returns the animation callback promise
|
||||
*/
|
||||
setClass(element: JQuery, add: string, remove: string): ng.IPromise<void>;
|
||||
|
||||
/**
|
||||
* Cancels the provided animation.
|
||||
*/
|
||||
cancel(animationPromise: ng.IPromise<void>): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularProvider
|
||||
// see http://docs.angularjs.org/api/ngAnimate/provider/$animateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateProvider {
|
||||
/**
|
||||
* Registers a new injectable animation factory function.
|
||||
*
|
||||
* @param name The name of the animation.
|
||||
* @param factory The factory function that will be executed to return the animation object.
|
||||
*/
|
||||
register(name: string, factory: () => ng.IAnimateCallbackObject): void;
|
||||
|
||||
/**
|
||||
* Gets and/or sets the CSS class expression that is checked when performing an animation.
|
||||
*
|
||||
* @param expression The className expression which will be checked against all animations.
|
||||
* @returns The current CSS className expression value. If null then there is no expression value.
|
||||
*/
|
||||
classNameFilter(expression?: RegExp): RegExp;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.2 (ngCookies module)
|
||||
// Type definitions for Angular JS 1.3 (ngCookies module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -15,7 +15,9 @@ declare module ng.cookies {
|
||||
// CookieService
|
||||
// see http://docs.angularjs.org/api/ngCookies.$cookies
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ICookiesService {}
|
||||
interface ICookiesService {
|
||||
[index: string]: any;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CookieStoreService
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module)
|
||||
// Type definitions for Angular JS 1.3 (ngMock, ngMockE2E module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
Vendored
+20
-10
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.2 (ngResource module)
|
||||
// Type definitions for Angular JS 1.3 (ngResource module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Michael Jess <http://github.com/miffels>
|
||||
// Definitions: https://github.com/daptiv/DefinitelyTyped
|
||||
@@ -11,6 +11,16 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng.resource {
|
||||
|
||||
/**
|
||||
* Currently supported options for the $resource factory options argument.
|
||||
*/
|
||||
interface IResourceOptions {
|
||||
/**
|
||||
* If true then the trailing slashes from any calculated URL will be stripped (defaults to true)
|
||||
*/
|
||||
stripTrailingSlashes?: boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ResourceService
|
||||
// see http://docs.angularjs.org/api/ngResource.$resource
|
||||
@@ -20,17 +30,17 @@ declare module ng.resource {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IResourceService {
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<IResource<any>>;
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T, U>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): U;
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): U;
|
||||
<T>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<T>;
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: any, options?: IResourceOptions): IResourceClass<T>;
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.2 (ngRoute module)
|
||||
// Type definitions for Angular JS 1.3 (ngRoute module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Jonathan Park <https://github.com/park9140>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular JS 1.2 (ngSanitize module)
|
||||
// Type definitions for Angular JS 1.3 (ngSanitize module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Scenario Testing
|
||||
// Type definitions for Angular Scenario Testing 1.3 (ngScenario module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: RomanoLindano <https://github.com/RomanoLindano>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -83,7 +83,7 @@ angular.module('http-auth-interceptor', [])
|
||||
}
|
||||
|
||||
}];
|
||||
$httpProvider.responseInterceptors.push(interceptor);
|
||||
$httpProvider.interceptors.push(interceptor);
|
||||
}]);
|
||||
|
||||
|
||||
@@ -250,6 +250,12 @@ httpFoo.then((x) => {
|
||||
x.toFixed();
|
||||
});
|
||||
|
||||
httpFoo.success((data, status, headers, config) => {
|
||||
var h = headers("test");
|
||||
h.charAt(0);
|
||||
var hs = headers();
|
||||
hs["content-type"].charAt(1);
|
||||
});
|
||||
|
||||
function test_angular_forEach() {
|
||||
var values: { [key: string]: string } = { name: 'misko', gender: 'male' };
|
||||
@@ -320,6 +326,47 @@ class SampleDirective2 implements ng.IDirective {
|
||||
|
||||
angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance);
|
||||
|
||||
angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpolate', '$q', ($interpolate: ng.IInterpolateService, $q: ng.IQService) => {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: (scope: ng.IScope, el: ng.IAugmentedJQuery, attr: ng.IAttributes) => {
|
||||
$interpolate(attr['test'])(scope);
|
||||
$interpolate('', true)(scope);
|
||||
$interpolate('', true, 'html')(scope);
|
||||
$interpolate('', true, 'html', true)(scope);
|
||||
var defer = $q.defer();
|
||||
defer.reject();
|
||||
defer.resolve();
|
||||
defer.promise.then(function(d) {
|
||||
return d;
|
||||
}).then(function(): any {
|
||||
return null;
|
||||
}, function(): any {
|
||||
return null;
|
||||
})
|
||||
.catch((): any => {
|
||||
return null;
|
||||
})
|
||||
.finally((): any => {
|
||||
return null;
|
||||
});
|
||||
var promise = new $q((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
|
||||
promise = new $q((resolve, reject) => {
|
||||
reject();
|
||||
resolve(true);
|
||||
});
|
||||
|
||||
promise = new $q<boolean>((resolver, reject) => {
|
||||
resolver(true);
|
||||
reject(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
// test from https://docs.angularjs.org/guide/directive
|
||||
angular.module('docsSimpleDirective', [])
|
||||
.controller('Controller', ['$scope', function($scope: any) {
|
||||
|
||||
Vendored
+164
-35
@@ -13,6 +13,11 @@ interface Function {
|
||||
$inject?: string[];
|
||||
}
|
||||
|
||||
// Support AMD require
|
||||
declare module 'angular' {
|
||||
export = angular;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ng module (angular.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -32,6 +37,10 @@ declare module ng {
|
||||
$get: any;
|
||||
}
|
||||
|
||||
interface IAngularBootstrapConfig {
|
||||
strictDi?: boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularStatic
|
||||
// see http://docs.angularjs.org/api
|
||||
@@ -46,8 +55,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: string, modules?: string): auto.IInjectorService;
|
||||
bootstrap(element: string, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -55,8 +66,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: string, modules?: Function): auto.IInjectorService;
|
||||
bootstrap(element: string, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -64,8 +77,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: string, modules?: string[]): auto.IInjectorService;
|
||||
bootstrap(element: string, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -73,8 +88,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: string): auto.IInjectorService;
|
||||
bootstrap(element: JQuery, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -82,8 +99,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: Function): auto.IInjectorService;
|
||||
bootstrap(element: JQuery, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -91,8 +110,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: JQuery, modules?: string[]): auto.IInjectorService;
|
||||
bootstrap(element: JQuery, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -100,8 +121,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: string): auto.IInjectorService;
|
||||
bootstrap(element: Element, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -109,8 +132,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: Function): auto.IInjectorService;
|
||||
bootstrap(element: Element, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -118,8 +143,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Element, modules?: string[]): auto.IInjectorService;
|
||||
bootstrap(element: Element, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -127,8 +154,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: string): auto.IInjectorService;
|
||||
bootstrap(element: Document, modules?: string, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -136,8 +165,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: Function): auto.IInjectorService;
|
||||
bootstrap(element: Document, modules?: Function, config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
/**
|
||||
* Use this function to manually start up angular application.
|
||||
*
|
||||
@@ -145,8 +176,10 @@ declare module ng {
|
||||
* @param modules An array of modules to load into the application.
|
||||
* Each item in the array should be the name of a predefined module or a (DI annotated)
|
||||
* function that will be invoked by the injector as a run block.
|
||||
* @param config an object for defining configuration options for the application. The following keys are supported:
|
||||
* - `strictDi`: disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code.
|
||||
*/
|
||||
bootstrap(element: Document, modules?: string[]): auto.IInjectorService;
|
||||
bootstrap(element: Document, modules?: string[], config?: IAngularBootstrapConfig): auto.IInjectorService;
|
||||
|
||||
/**
|
||||
* Creates a deep copy of source, which should be an object or an array.
|
||||
@@ -230,6 +263,7 @@ declare module ng {
|
||||
configFn?: Function): IModule;
|
||||
|
||||
noop(...args: any[]): void;
|
||||
reloadWithDebugInfo(): void;
|
||||
toJson(obj: any, pretty?: boolean): string;
|
||||
uppercase(str: string): string;
|
||||
version: {
|
||||
@@ -237,7 +271,7 @@ declare module ng {
|
||||
major: number;
|
||||
minor: number;
|
||||
dot: number;
|
||||
codename: string;
|
||||
codeName: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -412,6 +446,7 @@ declare module ng {
|
||||
$commitViewValue(): void;
|
||||
$rollbackViewValue(): void;
|
||||
$setSubmitted(): void;
|
||||
$setUntouched(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -423,12 +458,13 @@ declare module ng {
|
||||
$setValidity(validationErrorKey: string, isValid: boolean): void;
|
||||
// Documentation states viewValue and modelValue to be a string but other
|
||||
// types do work and it's common to use them.
|
||||
$setViewValue(value: any): void;
|
||||
$setViewValue(value: any, trigger?: string): void;
|
||||
$setPristine(): void;
|
||||
$validate(): void;
|
||||
$setTouched(): void;
|
||||
$setUntouched(): void;
|
||||
$rollbackViewValue(): void;
|
||||
$commitViewValue(revalidate?: boolean): void;
|
||||
$commitViewValue(): void;
|
||||
$isEmpty(value: any): boolean;
|
||||
|
||||
$viewValue: any;
|
||||
@@ -447,6 +483,7 @@ declare module ng {
|
||||
$validators: IModelValidators;
|
||||
$asyncValidators: IAsyncModelValidators;
|
||||
|
||||
$pending: any;
|
||||
$pristine: boolean;
|
||||
$dirty: boolean;
|
||||
$valid: boolean;
|
||||
@@ -478,23 +515,31 @@ declare module ng {
|
||||
* see https://docs.angularjs.org/api/ng/type/$rootScope.Scope and https://docs.angularjs.org/api/ng/service/$rootScope
|
||||
*/
|
||||
interface IRootScopeService {
|
||||
[index: string]: any;
|
||||
|
||||
$apply(): any;
|
||||
$apply(exp: string): any;
|
||||
$apply(exp: (scope: IScope) => any): any;
|
||||
|
||||
$applyAsync(): any;
|
||||
$applyAsync(exp: string): any;
|
||||
$applyAsync(exp: (scope: IScope) => any): any;
|
||||
|
||||
$broadcast(name: string, ...args: any[]): IAngularEvent;
|
||||
$destroy(): void;
|
||||
$digest(): void;
|
||||
$emit(name: string, ...args: any[]): IAngularEvent;
|
||||
|
||||
$eval(expression?: string, args?: Object): any;
|
||||
$eval(expression?: (scope: IScope) => any, args?: Object): any;
|
||||
$eval(): any;
|
||||
$eval(expression: string, locals?: Object): any;
|
||||
$eval(expression: (scope: IScope) => any, locals?: Object): any;
|
||||
|
||||
$evalAsync(expression?: string): void;
|
||||
$evalAsync(expression?: (scope: IScope) => any): void;
|
||||
$evalAsync(): void;
|
||||
$evalAsync(expression: string): void;
|
||||
$evalAsync(expression: (scope: IScope) => any): void;
|
||||
|
||||
// Defaults to false by the implementation checking strategy
|
||||
$new(isolate?: boolean): IScope;
|
||||
$new(isolate?: boolean, parent?: IScope): IScope;
|
||||
|
||||
/**
|
||||
* Listens on events of a given type. See $emit for discussion of event life cycle.
|
||||
@@ -518,10 +563,7 @@ declare module ng {
|
||||
$watchGroup(watchExpressions: { (scope: IScope): any }[], listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
|
||||
|
||||
$parent: IScope;
|
||||
|
||||
$root: IRootScopeService;
|
||||
this: IRootScopeService;
|
||||
|
||||
$id: number;
|
||||
|
||||
// Hidden members
|
||||
@@ -529,9 +571,7 @@ declare module ng {
|
||||
$$phase: any;
|
||||
}
|
||||
|
||||
interface IScope extends IRootScopeService {
|
||||
[index: string]: any;
|
||||
}
|
||||
interface IScope extends IRootScopeService { }
|
||||
|
||||
interface IAngularEvent {
|
||||
/**
|
||||
@@ -594,6 +634,35 @@ declare module ng {
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularProvider
|
||||
// see http://docs.angularjs.org/api/ng/provider/$animateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateProvider {
|
||||
/**
|
||||
* Registers a new injectable animation factory function.
|
||||
*
|
||||
* @param name The name of the animation.
|
||||
* @param factory The factory function that will be executed to return the animation object.
|
||||
*/
|
||||
register(name: string, factory: () => IAnimateCallbackObject): void;
|
||||
|
||||
/**
|
||||
* Gets and/or sets the CSS class expression that is checked when performing an animation.
|
||||
*
|
||||
* @param expression The className expression which will be checked against all animations.
|
||||
* @returns The current CSS className expression value. If null then there is no expression value.
|
||||
*/
|
||||
classNameFilter(expression?: RegExp): RegExp;
|
||||
}
|
||||
|
||||
/**
|
||||
* The animation object which contains callback functions for each event that is expected to be animated.
|
||||
*/
|
||||
interface IAnimateCallbackObject {
|
||||
eventFn(element: Node, doneFn: () => void): Function;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// FilterService
|
||||
// see http://docs.angularjs.org/api/ng.$filter
|
||||
@@ -670,8 +739,8 @@ declare module ng {
|
||||
}
|
||||
|
||||
interface ILogProvider {
|
||||
debugEnabled(enabled: boolean): ILogProvider;
|
||||
debugEnabled(): boolean;
|
||||
debugEnabled(enabled: boolean): ILogProvider;
|
||||
}
|
||||
|
||||
// We define this as separete interface so we can reopen it later for
|
||||
@@ -779,6 +848,8 @@ declare module ng {
|
||||
*/
|
||||
search(search: string, paramValue: boolean): ILocationService;
|
||||
|
||||
state(): any;
|
||||
state(state: any): ILocationService;
|
||||
url(): string;
|
||||
url(url: string): ILocationService;
|
||||
}
|
||||
@@ -814,12 +885,20 @@ declare module ng {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRootElementService extends JQuery {}
|
||||
|
||||
interface IQResolveReject<T> {
|
||||
(): void;
|
||||
(value: T): void;
|
||||
}
|
||||
/**
|
||||
* $q - service in module ng
|
||||
* A promise/deferred implementation inspired by Kris Kowal's Q.
|
||||
* See http://docs.angularjs.org/api/ng/service/$q
|
||||
*/
|
||||
interface IQService {
|
||||
new (resolver: (resolve: IQResolveReject<any>) => any): IPromise<any>;
|
||||
new (resolver: (resolve: IQResolveReject<any>, reject: IQResolveReject<any>) => any): IPromise<any>;
|
||||
new <T>(resolver: (resolve: IQResolveReject<T>, reject: IQResolveReject<any>) => any): IPromise<T>;
|
||||
|
||||
/**
|
||||
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
|
||||
*
|
||||
@@ -847,7 +926,7 @@ declare module ng {
|
||||
*
|
||||
* @param reason Constant, message, exception or an object representing the rejection reason.
|
||||
*/
|
||||
reject(reason?: any): IPromise<void>;
|
||||
reject(reason?: any): IPromise<any>;
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -922,6 +1001,7 @@ declare module ng {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnchorScrollService {
|
||||
(): void;
|
||||
yOffset: any;
|
||||
}
|
||||
|
||||
interface IAnchorScrollProvider extends IServiceProvider {
|
||||
@@ -981,6 +1061,8 @@ declare module ng {
|
||||
|
||||
imgSrcSanitizationWhitelist(): RegExp;
|
||||
imgSrcSanitizationWhitelist(regexp: RegExp): ICompileProvider;
|
||||
|
||||
debugInfoEnabled(enabled?: boolean): any;
|
||||
}
|
||||
|
||||
interface ICloneAttachFunction {
|
||||
@@ -1015,6 +1097,7 @@ declare module ng {
|
||||
interface IControllerProvider extends IServiceProvider {
|
||||
register(name: string, controllerConstructor: Function): void;
|
||||
register(name: string, dependencyAnnotatedConstructor: any[]): void;
|
||||
allowGlobals(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1170,8 +1253,13 @@ declare module ng {
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface IHttpHeadersGetter {
|
||||
(): { [name: string]: string; };
|
||||
(headerName: string): string;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallback<T> {
|
||||
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void;
|
||||
(data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallbackArg<T> {
|
||||
@@ -1189,10 +1277,22 @@ declare module ng {
|
||||
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg<any>) => any): IPromise<TResult>;
|
||||
}
|
||||
|
||||
interface IHttpProviderDefaults {
|
||||
xsrfCookieName?: string;
|
||||
xsrfHeaderName?: string;
|
||||
headers?: {
|
||||
common?: any;
|
||||
post?: any;
|
||||
put?: any;
|
||||
patch?: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface IHttpProvider extends IServiceProvider {
|
||||
defaults: IRequestConfig;
|
||||
defaults: IHttpProviderDefaults;
|
||||
interceptors: any[];
|
||||
responseInterceptors: any[];
|
||||
useApplyAsync(): boolean;
|
||||
useApplyAsync(value: boolean): IHttpProvider;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -1211,7 +1311,7 @@ declare module ng {
|
||||
// see http://docs.angularjs.org/api/ng.$interpolateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IInterpolateService {
|
||||
(text: string, mustHaveExpression?: boolean): IInterpolationFunction;
|
||||
(text: string, mustHaveExpression?: boolean, trustedContext?: string, allOrNothing?: boolean): IInterpolationFunction;
|
||||
endSymbol(): string;
|
||||
startSymbol(): string;
|
||||
}
|
||||
@@ -1286,6 +1386,34 @@ declare module ng {
|
||||
resourceUrlWhitelist(whitelist: any[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* $templateRequest service
|
||||
* see http://docs.angularjs.org/api/ng/service/$templateRequest
|
||||
*/
|
||||
interface ITemplateRequestService {
|
||||
/**
|
||||
* Downloads a template using $http and, upon success, stores the
|
||||
* contents inside of $templateCache.
|
||||
*
|
||||
* If the HTTP request fails or the response data of the HTTP request is
|
||||
* empty then a $compile error will be thrown (unless
|
||||
* {ignoreRequestError} is set to true).
|
||||
*
|
||||
* @param tpl The template URL.
|
||||
* @param ignoreRequestError Whether or not to ignore the exception
|
||||
* when the request fails or the template is
|
||||
* empty.
|
||||
*
|
||||
* @return A promise whose value is the template content.
|
||||
*/
|
||||
(tpl: string, ignoreRequestError?: boolean): IPromise<string>;
|
||||
/**
|
||||
* total amount of pending template requests being downloaded.
|
||||
* @type {number}
|
||||
*/
|
||||
totalPendingRequests: number;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Directive
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
|
||||
@@ -1303,7 +1431,7 @@ declare module ng {
|
||||
instanceAttributes: IAttributes,
|
||||
controller: any,
|
||||
transclude: ITranscludeFunction
|
||||
): void;
|
||||
): void;
|
||||
}
|
||||
|
||||
interface IDirectivePrePost {
|
||||
@@ -1316,13 +1444,14 @@ declare module ng {
|
||||
templateElement: IAugmentedJQuery,
|
||||
templateAttributes: IAttributes,
|
||||
transclude: ITranscludeFunction
|
||||
): IDirectivePrePost;
|
||||
): IDirectivePrePost;
|
||||
}
|
||||
|
||||
interface IDirective {
|
||||
compile?: IDirectiveCompileFn;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
bindToController?: boolean;
|
||||
link?: IDirectiveLinkFn;
|
||||
name?: string;
|
||||
priority?: number;
|
||||
@@ -1360,7 +1489,7 @@ declare module ng {
|
||||
find(selector: string): IAugmentedJQuery;
|
||||
find(element: any): IAugmentedJQuery;
|
||||
find(obj: JQuery): IAugmentedJQuery;
|
||||
|
||||
controller(): any;
|
||||
controller(name: string): any;
|
||||
injector(): any;
|
||||
scope(): IScope;
|
||||
|
||||
Vendored
+7
@@ -410,6 +410,13 @@ declare module ng {
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The animation object which contains callback functions for each event that is expected to be animated.
|
||||
*/
|
||||
interface IAnimateCallbackObject {
|
||||
eventFn(element: Node, doneFn: () => void): Function;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// FilterService
|
||||
// see http://docs.angularjs.org/api/ng.$filter
|
||||
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
// Type definitions for Angular JS 1.2 (ngAnimate module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngAnimate module (angular-animate.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng.animate {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AnimateService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngAnimate/service/$animate
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateService extends ng.IAnimateService {
|
||||
/**
|
||||
* Globally enables / disables animations.
|
||||
*
|
||||
* @param value If provided then set the animation on or off.
|
||||
* @param element If provided then the element will be used to represent the enable/disable operation.
|
||||
* @returns current animation state
|
||||
*/
|
||||
enabled(value?: boolean, element?: JQuery): boolean;
|
||||
|
||||
/**
|
||||
* Appends the element to the parentElement element that resides in the document and then runs the enter animation.
|
||||
*
|
||||
* @param element the element that will be the focus of the enter animation
|
||||
* @param parentElement the parent element of the element that will be the focus of the enter animation
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
|
||||
* @param doneCallback the callback function that will be called once the animation is complete
|
||||
*/
|
||||
enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, doneCallback?: () => void): void;
|
||||
|
||||
/**
|
||||
* Runs the leave animation operation and, upon completion, removes the element from the DOM.
|
||||
*
|
||||
* @param element the element that will be the focus of the leave animation
|
||||
* @param doneCallback the callback function that will be called once the animation is complete
|
||||
*/
|
||||
leave(element: JQuery, doneCallback?: () => void): void;
|
||||
|
||||
/**
|
||||
* Fires the move DOM operation. Just before the animation starts, the animate service will either append
|
||||
* it into the parentElement container or add the element directly after the afterElement element if present.
|
||||
* Then the move animation will be run.
|
||||
*
|
||||
* @param element the element that will be the focus of the move animation
|
||||
* @param parentElement the parent element of the element that will be the focus of the move animation
|
||||
* @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
|
||||
* @param doneCallback the callback function that will be called once the animation is complete
|
||||
*/
|
||||
move(element: JQuery, parentElement: JQuery, afterElement?: JQuery, doneCallback?: () => void): void;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then attaches the className
|
||||
* value to the element as a CSS class.
|
||||
*
|
||||
* @param element the element that will be animated
|
||||
* @param className the CSS class that will be added to the element and then animated
|
||||
* @param doneCallback the callback function that will be called once the animation is complete
|
||||
*/
|
||||
addClass(element: JQuery, className: string, doneCallback?: () => void): void;
|
||||
|
||||
/**
|
||||
* Triggers a custom animation event based off the className variable and then removes the CSS class
|
||||
* provided by the className value from the element.
|
||||
*
|
||||
* @param element the element that will be animated
|
||||
* @param className the CSS class that will be animated and then removed from the element
|
||||
* @param doneCallback the callback function that will be called once the animation is complete
|
||||
*/
|
||||
removeClass(element: JQuery, className: string, doneCallback?: () => void): void;
|
||||
|
||||
/**
|
||||
* Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback
|
||||
* will be fired (if provided).
|
||||
*
|
||||
* @param element the element which will have its CSS classes changed removed from it
|
||||
* @param add the CSS classes which will be added to the element
|
||||
* @param remove the CSS class which will be removed from the element CSS classes have been set on the element
|
||||
* @param doneCallback done the callback function (if provided) that will be fired after the CSS classes have been set on the element
|
||||
*/
|
||||
setClass(element: JQuery, add: string, remove: string, doneCallback?: () => void): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularProvider
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngAnimate/provider/$animateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAnimateProvider {
|
||||
/**
|
||||
* Registers a new injectable animation factory function.
|
||||
*
|
||||
* @param name The name of the animation.
|
||||
* @param factory The factory function that will be executed to return the animation object.
|
||||
*/
|
||||
register(name: string, factory: () => ng.IAnimateCallbackObject): void;
|
||||
|
||||
/**
|
||||
* Gets and/or sets the CSS class expression that is checked when performing an animation.
|
||||
*
|
||||
* @param expression The className expression which will be checked against all animations.
|
||||
* @returns The current CSS className expression value. If null then there is no expression value.
|
||||
*/
|
||||
classNameFilter(expression?: RegExp): RegExp;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for Angular JS 1.2 (ngCookies module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngCookies module (angular-cookies.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng.cookies {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CookieService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookies
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ICookiesService {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// CookieStoreService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngCookies/service/$cookieStore
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ICookieStoreService {
|
||||
/**
|
||||
* Returns the value of given cookie key
|
||||
* @param key Id to use for lookup
|
||||
*/
|
||||
get(key: string): any;
|
||||
/**
|
||||
* Sets a value for given cookie key
|
||||
* @param key Id for the value
|
||||
* @param value Value to be stored
|
||||
*/
|
||||
put(key: string, value: any): void;
|
||||
/**
|
||||
* Remove given cookie
|
||||
* @param key Id of the key-value pair to delete
|
||||
*/
|
||||
remove(key: string): void;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
/// <reference path="angular-mocks-1.2.d.ts" />
|
||||
|
||||
///////////////////////////////////////
|
||||
// IAngularStatic
|
||||
///////////////////////////////////////
|
||||
var angular: ng.IAngularStatic;
|
||||
var mock: ng.IMockStatic;
|
||||
|
||||
mock = angular.mock;
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IMockStatic
|
||||
///////////////////////////////////////
|
||||
var date: Date;
|
||||
|
||||
mock.dump({ key: 'value' });
|
||||
|
||||
mock.inject(
|
||||
function () { return 1; },
|
||||
function () { return 2; }
|
||||
);
|
||||
|
||||
mock.inject(
|
||||
['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }]);
|
||||
|
||||
// This overload is not documented on the website, but flows from
|
||||
// how the injector works.
|
||||
mock.inject(
|
||||
['$rootScope', function ($rootScope: ng.IRootScopeService) { return 1; }],
|
||||
['$rootScope', function ($rootScope: ng.IRootScopeService) { return 2; }]);
|
||||
|
||||
mock.module('module1', 'module2');
|
||||
mock.module(
|
||||
function () { return 1; },
|
||||
function () { return 2; }
|
||||
);
|
||||
mock.module({ module1: function () { return 1; } });
|
||||
|
||||
date = mock.TzDate(-7, '2013-1-1T15:00:00Z');
|
||||
date = mock.TzDate(-8, 12345678);
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IExceptionHandlerProvider
|
||||
///////////////////////////////////////
|
||||
var exceptionHandlerProvider: ng.IExceptionHandlerProvider;
|
||||
|
||||
exceptionHandlerProvider.mode('log');
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// ITimeoutService
|
||||
///////////////////////////////////////
|
||||
var timeoutService: ng.ITimeoutService;
|
||||
|
||||
timeoutService.flush();
|
||||
timeoutService.flush(1234);
|
||||
timeoutService.flushNext();
|
||||
timeoutService.flushNext(1234);
|
||||
timeoutService.verifyNoPendingTasks();
|
||||
|
||||
////////////////////////////////////////
|
||||
// IIntervalService
|
||||
////////////////////////////////////////
|
||||
var intervalService: ng.IIntervalService;
|
||||
var intervalServiceTimeActuallyAdvanced: number;
|
||||
|
||||
intervalServiceTimeActuallyAdvanced = intervalService.flush();
|
||||
intervalServiceTimeActuallyAdvanced = intervalService.flush(1234);
|
||||
|
||||
///////////////////////////////////////
|
||||
// ILogService, ILogCall
|
||||
///////////////////////////////////////
|
||||
var logService: ng.ILogService;
|
||||
var logCall: ng.ILogCall;
|
||||
var logs: string[];
|
||||
|
||||
logService.assertEmpty();
|
||||
logService.reset();
|
||||
|
||||
logCall = logService.debug;
|
||||
logCall = logService.error;
|
||||
logCall = logService.info;
|
||||
logCall = logService.log;
|
||||
logCall = logService.warn;
|
||||
|
||||
logs = logCall.logs;
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IHttpBackendService
|
||||
///////////////////////////////////////
|
||||
var httpBackendService: ng.IHttpBackendService;
|
||||
var requestHandler: ng.mock.IRequestHandler;
|
||||
|
||||
httpBackendService.flush();
|
||||
httpBackendService.flush(1234);
|
||||
httpBackendService.resetExpectations();
|
||||
httpBackendService.verifyNoOutstandingExpectation();
|
||||
httpBackendService.verifyNoOutstandingRequest();
|
||||
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local');
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET('http://test.local');
|
||||
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.expectJSONP(/test.local/);
|
||||
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local');
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local');
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local');
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local');
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
|
||||
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local');
|
||||
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET('http://test.local');
|
||||
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local');
|
||||
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenJSONP('http://test.local');
|
||||
requestHandler = httpBackendService.whenJSONP(/test.local/);
|
||||
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local');
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local');
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local');
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data');
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/);
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
|
||||
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IRequestHandler
|
||||
///////////////////////////////////////
|
||||
requestHandler.passThrough();
|
||||
requestHandler.respond(function () { });
|
||||
requestHandler.respond({ key: 'value' });
|
||||
requestHandler.respond({ key: 'value' }, { header: 'value' });
|
||||
requestHandler.respond(404);
|
||||
requestHandler.respond(404, { key: 'value' });
|
||||
requestHandler.respond(404, { key: 'value' }, { header: 'value' });
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// functions attached to global object (window)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare var module: (...modules: any[]) => any;
|
||||
declare var inject: (...fns: Function[]) => any;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngMock module (angular-mocks.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AngularStatic
|
||||
// We reopen it to add the MockStatic definition
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IAngularStatic {
|
||||
mock: IMockStatic;
|
||||
}
|
||||
|
||||
interface IMockStatic {
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.dump
|
||||
dump(obj: any): string;
|
||||
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.inject
|
||||
inject(...fns: Function[]): any;
|
||||
inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
|
||||
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/function/angular.mock.module
|
||||
module(...modules: any[]): any;
|
||||
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/type/angular.mock.TzDate
|
||||
TzDate(offset: number, timestamp: number): Date;
|
||||
TzDate(offset: number, timestamp: string): Date;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ExceptionHandlerService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$exceptionHandler
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/provider/$exceptionHandlerProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IExceptionHandlerProvider extends IServiceProvider {
|
||||
mode(mode: string): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// TimeoutService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$timeout
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
flush(delay?: number): void;
|
||||
flushNext(expectedDelay?: number): void;
|
||||
verifyNoPendingTasks(): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IntervalService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$interval
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IIntervalService {
|
||||
flush(millis?: number): number;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LogService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$log
|
||||
// Augments the original service
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ILogService {
|
||||
assertEmpty(): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface ILogCall {
|
||||
logs: string[];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// HttpBackendService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngMock/service/$httpBackend
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IHttpBackendService {
|
||||
flush(count?: number): void;
|
||||
resetExpectations(): void;
|
||||
verifyNoOutstandingExpectation(): void;
|
||||
verifyNoOutstandingRequest(): void;
|
||||
|
||||
expect(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
expect(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
|
||||
expectDELETE(url: string, headers?: Object): mock.IRequestHandler;
|
||||
expectDELETE(url: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectGET(url: string, headers?: Object): mock.IRequestHandler;
|
||||
expectGET(url: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectHEAD(url: string, headers?: Object): mock.IRequestHandler;
|
||||
expectHEAD(url: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectJSONP(url: string): mock.IRequestHandler;
|
||||
expectJSONP(url: RegExp): mock.IRequestHandler;
|
||||
|
||||
expectPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expectPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
|
||||
expectPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expectPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
|
||||
expectPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
expectPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
|
||||
when(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
when(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
|
||||
whenDELETE(url: string, headers?: Object): mock.IRequestHandler;
|
||||
whenDELETE(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
whenDELETE(url: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenDELETE(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
|
||||
whenGET(url: string, headers?: Object): mock.IRequestHandler;
|
||||
whenGET(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
whenGET(url: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenGET(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
|
||||
whenHEAD(url: string, headers?: Object): mock.IRequestHandler;
|
||||
whenHEAD(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
whenHEAD(url: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenHEAD(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
|
||||
|
||||
whenJSONP(url: string): mock.IRequestHandler;
|
||||
whenJSONP(url: RegExp): mock.IRequestHandler;
|
||||
|
||||
whenPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
whenPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
|
||||
whenPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
whenPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
|
||||
whenPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
|
||||
whenPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
|
||||
}
|
||||
|
||||
export module mock {
|
||||
|
||||
// returned interface by the the mocked HttpBackendService expect/when methods
|
||||
interface IRequestHandler {
|
||||
respond(func: Function): void;
|
||||
respond(status: number, data?: any, headers?: any): void;
|
||||
respond(data: any, headers?: any): void;
|
||||
|
||||
// Available wehn ngMockE2E is loaded
|
||||
passThrough(): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/// <reference path="angular-resource-1.2.d.ts" />
|
||||
|
||||
interface IMyResource extends ng.resource.IResource<IMyResource> { };
|
||||
interface IMyResourceClass extends ng.resource.IResourceClass<IMyResource> { };
|
||||
|
||||
///////////////////////////////////////
|
||||
// IActionDescriptor
|
||||
///////////////////////////////////////
|
||||
var actionDescriptor: ng.resource.IActionDescriptor;
|
||||
|
||||
actionDescriptor.headers = { header: 'value' };
|
||||
actionDescriptor.isArray = true;
|
||||
actionDescriptor.method = 'method action';
|
||||
actionDescriptor.params = { key: 'value' };
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceClass
|
||||
///////////////////////////////////////
|
||||
var resourceClass: IMyResourceClass;
|
||||
var resource: IMyResource;
|
||||
var resourceArray: ng.resource.IResourceArray<IMyResource>;
|
||||
|
||||
resource = resourceClass.delete();
|
||||
resource = resourceClass.delete({ key: 'value' });
|
||||
resource = resourceClass.delete({ key: 'value' }, function () { });
|
||||
resource = resourceClass.delete(function () { });
|
||||
resource = resourceClass.delete(function () { }, function () { });
|
||||
resource = resourceClass.delete({ key: 'value' }, { key: 'value' });
|
||||
resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { });
|
||||
resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }, function () { });
|
||||
resource.$promise.then(function(data: IMyResource) {});
|
||||
|
||||
resource = resourceClass.get();
|
||||
resource = resourceClass.get({ key: 'value' });
|
||||
resource = resourceClass.get({ key: 'value' }, function () { });
|
||||
resource = resourceClass.get(function () { });
|
||||
resource = resourceClass.get(function () { }, function () { });
|
||||
resource = resourceClass.get({ key: 'value' }, { key: 'value' });
|
||||
resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { });
|
||||
resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }, function () { });
|
||||
|
||||
resourceArray = resourceClass.query();
|
||||
resourceArray = resourceClass.query({ key: 'value' });
|
||||
resourceArray = resourceClass.query({ key: 'value' }, function () { });
|
||||
resourceArray = resourceClass.query(function () { });
|
||||
resourceArray = resourceClass.query(function () { }, function () { });
|
||||
resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' });
|
||||
resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { });
|
||||
resourceArray = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }, function () { });
|
||||
resourceArray.push(resource);
|
||||
resourceArray.$promise.then(function(data: ng.resource.IResourceArray<IMyResource>) {});
|
||||
|
||||
resource = resourceClass.remove();
|
||||
resource = resourceClass.remove({ key: 'value' });
|
||||
resource = resourceClass.remove({ key: 'value' }, function () { });
|
||||
resource = resourceClass.remove(function () { });
|
||||
resource = resourceClass.remove(function () { }, function () { });
|
||||
resource = resourceClass.remove({ key: 'value' }, { key: 'value' });
|
||||
resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { });
|
||||
resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }, function () { });
|
||||
|
||||
resource = resourceClass.save();
|
||||
resource = resourceClass.save({ key: 'value' });
|
||||
resource = resourceClass.save({ key: 'value' }, function () { });
|
||||
resource = resourceClass.save(function () { });
|
||||
resource = resourceClass.save(function () { }, function () { });
|
||||
resource = resourceClass.save({ key: 'value' }, { key: 'value' });
|
||||
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { });
|
||||
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { });
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
|
||||
var promise : ng.IPromise<IMyResource>;
|
||||
var arrayPromise : ng.IPromise<IMyResource[]>;
|
||||
|
||||
promise = resource.$delete();
|
||||
promise = resource.$delete({ key: 'value' });
|
||||
promise = resource.$delete({ key: 'value' }, function () { });
|
||||
promise = resource.$delete(function () { });
|
||||
promise = resource.$delete(function () { }, function () { });
|
||||
promise = resource.$delete({ key: 'value' }, function () { }, function () { });
|
||||
promise.then(function(data: IMyResource) {});
|
||||
|
||||
promise = resource.$get();
|
||||
promise = resource.$get({ key: 'value' });
|
||||
promise = resource.$get({ key: 'value' }, function () { });
|
||||
promise = resource.$get(function () { });
|
||||
promise = resource.$get(function () { }, function () { });
|
||||
promise = resource.$get({ key: 'value' }, function () { }, function () { });
|
||||
|
||||
arrayPromise = resourceArray[0].$query();
|
||||
arrayPromise = resourceArray[0].$query({ key: 'value' });
|
||||
arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { });
|
||||
arrayPromise = resourceArray[0].$query(function () { });
|
||||
arrayPromise = resourceArray[0].$query(function () { }, function () { });
|
||||
arrayPromise = resourceArray[0].$query({ key: 'value' }, function () { }, function () { });
|
||||
arrayPromise.then(function(data: ng.resource.IResourceArray<IMyResource>) {});
|
||||
|
||||
promise = resource.$remove();
|
||||
promise = resource.$remove({ key: 'value' });
|
||||
promise = resource.$remove({ key: 'value' }, function () { });
|
||||
promise = resource.$remove(function () { });
|
||||
promise = resource.$remove(function () { }, function () { });
|
||||
promise = resource.$remove({ key: 'value' }, function () { }, function () { });
|
||||
|
||||
promise = resource.$save();
|
||||
promise = resource.$save({ key: 'value' });
|
||||
promise = resource.$save({ key: 'value' }, function () { });
|
||||
promise = resource.$save(function () { });
|
||||
promise = resource.$save(function () { }, function () { });
|
||||
promise = resource.$save({ key: 'value' }, function () { }, function () { });
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceService
|
||||
///////////////////////////////////////
|
||||
var resourceService: ng.resource.IResourceService;
|
||||
resourceClass = resourceService<IMyResource, IMyResourceClass>('test');
|
||||
resourceClass = resourceService<IMyResource>('test');
|
||||
resourceClass = resourceService('test');
|
||||
|
||||
///////////////////////////////////////
|
||||
// IModule
|
||||
///////////////////////////////////////
|
||||
var mod: ng.IModule;
|
||||
var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction<IMyResource>;
|
||||
var resourceService: ng.resource.IResourceService;
|
||||
|
||||
resourceClass = resourceServiceFactoryFunction<IMyResourceClass>(resourceService);
|
||||
|
||||
resourceServiceFactoryFunction = function (resourceService: ng.resource.IResourceService) { return <any>resourceClass; };
|
||||
mod = mod.factory('factory name', resourceServiceFactoryFunction);
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
// Type definitions for Angular JS 1.2 (ngResource module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Michael Jess <http://github.com/miffels>
|
||||
// Definitions: https://github.com/daptiv/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngResource module (angular-resource.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng.resource {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ResourceService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngResource/service/$resource
|
||||
// Most of the following definitions were achieved by analyzing the
|
||||
// actual implementation, since the documentation doesn't seem to cover
|
||||
// that deeply.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IResourceService {
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<IResource<any>>;
|
||||
<T, U>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): U;
|
||||
<T>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<T>;
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
interface IActionDescriptor {
|
||||
method: string;
|
||||
isArray?: boolean;
|
||||
params?: any;
|
||||
headers?: any;
|
||||
}
|
||||
|
||||
// Baseclass for everyresource with default actions.
|
||||
// If you define your new actions for the resource, you will need
|
||||
// to extend this interface and typecast the ResourceClass to it.
|
||||
//
|
||||
// In case of passing the first argument as anything but a function,
|
||||
// it's gonna be considered data if the action method is POST, PUT or
|
||||
// PATCH (in other words, methods with body). Otherwise, it's going
|
||||
// to be considered as parameters to the request.
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
//
|
||||
// Only those methods with an HTTP body do have 'data' as first parameter:
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463
|
||||
// More specifically, those methods are POST, PUT and PATCH:
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432
|
||||
//
|
||||
// Also, static calls always return the IResource (or IResourceArray) retrieved
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
interface IResourceClass<T> {
|
||||
new(dataOrParams? : any) : T;
|
||||
get(): T;
|
||||
get(params: Object): T;
|
||||
get(success: Function, error?: Function): T;
|
||||
get(params: Object, success: Function, error?: Function): T;
|
||||
get(params: Object, data: Object, success?: Function, error?: Function): T;
|
||||
|
||||
query(): IResourceArray<T>;
|
||||
query(params: Object): IResourceArray<T>;
|
||||
query(success: Function, error?: Function): IResourceArray<T>;
|
||||
query(params: Object, success: Function, error?: Function): IResourceArray<T>;
|
||||
query(params: Object, data: Object, success?: Function, error?: Function): IResourceArray<T>;
|
||||
|
||||
save(): T;
|
||||
save(data: Object): T;
|
||||
save(success: Function, error?: Function): T;
|
||||
save(data: Object, success: Function, error?: Function): T;
|
||||
save(params: Object, data: Object, success?: Function, error?: Function): T;
|
||||
|
||||
remove(): T;
|
||||
remove(params: Object): T;
|
||||
remove(success: Function, error?: Function): T;
|
||||
remove(params: Object, success: Function, error?: Function): T;
|
||||
remove(params: Object, data: Object, success?: Function, error?: Function): T;
|
||||
|
||||
delete(): T;
|
||||
delete(params: Object): T;
|
||||
delete(success: Function, error?: Function): T;
|
||||
delete(params: Object, success: Function, error?: Function): T;
|
||||
delete(params: Object, data: Object, success?: Function, error?: Function): T;
|
||||
}
|
||||
|
||||
// Instance calls always return the the promise of the request which retrieved the object
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
|
||||
interface IResource<T> {
|
||||
$get(): ng.IPromise<T>;
|
||||
$get(params?: Object, success?: Function, error?: Function): ng.IPromise<T>;
|
||||
$get(success: Function, error?: Function): ng.IPromise<T>;
|
||||
|
||||
$query(): ng.IPromise<IResourceArray<T>>;
|
||||
$query(params?: Object, success?: Function, error?: Function): ng.IPromise<IResourceArray<T>>;
|
||||
$query(success: Function, error?: Function): ng.IPromise<IResourceArray<T>>;
|
||||
|
||||
$save(): ng.IPromise<T>;
|
||||
$save(params?: Object, success?: Function, error?: Function): ng.IPromise<T>;
|
||||
$save(success: Function, error?: Function): ng.IPromise<T>;
|
||||
|
||||
$remove(): ng.IPromise<T>;
|
||||
$remove(params?: Object, success?: Function, error?: Function): ng.IPromise<T>;
|
||||
$remove(success: Function, error?: Function): ng.IPromise<T>;
|
||||
|
||||
$delete(): ng.IPromise<T>;
|
||||
$delete(params?: Object, success?: Function, error?: Function): ng.IPromise<T>;
|
||||
$delete(success: Function, error?: Function): ng.IPromise<T>;
|
||||
|
||||
/** the promise of the original server interaction that created this instance. **/
|
||||
$promise : ng.IPromise<T>;
|
||||
$resolved : boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Really just a regular Array object with $promise and $resolve attached to it
|
||||
*/
|
||||
interface IResourceArray<T> extends Array<T> {
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
$promise : ng.IPromise<IResourceArray<T>>;
|
||||
$resolved : boolean;
|
||||
}
|
||||
|
||||
/** when creating a resource factory via IModule.factory */
|
||||
interface IResourceServiceFactoryFunction<T> {
|
||||
($resource: ng.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: ng.resource.IResourceService): U;
|
||||
}
|
||||
}
|
||||
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
declare module ng {
|
||||
|
||||
interface IModule {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
}
|
||||
|
||||
interface Array<T>
|
||||
{
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
$promise : ng.IPromise<Array<T>>;
|
||||
$resolved : boolean;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="angular-route-1.2.d.ts" />
|
||||
|
||||
/**
|
||||
* @license HTTP Auth Interceptor Module for AngularJS
|
||||
* (c) 2013 Jonathan Park @ Daptiv Solutions Inc
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
declare var $routeProvider: ng.route.IRouteProvider;
|
||||
$routeProvider
|
||||
.when('/projects/:projectId/dashboard',{
|
||||
controller: '',
|
||||
templateUrl: '',
|
||||
caseInsensitiveMatch: true,
|
||||
reloadOnSearch: false
|
||||
})
|
||||
.otherwise({redirectTo: '/'});
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// Type definitions for Angular JS 1.2 (ngRoute module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Jonathan Park <https://github.com/park9140>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngRoute module (angular-route.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng.route {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// RouteParamsService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$routeParams
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRouteParamsService {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// RouteService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$route
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngRoute/provider/$routeProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRouteService {
|
||||
/**
|
||||
* Causes $route service to reload the current route even if $location hasn't changed.
|
||||
* As a result of that, ngView creates new scope, reinstantiates the controller.
|
||||
*/
|
||||
reload(): void;
|
||||
|
||||
/**
|
||||
* Object with all route configuration Objects as its properties.
|
||||
*/
|
||||
routes: any;
|
||||
|
||||
// May not always be available. For instance, current will not be available
|
||||
// to a controller that was not initialized as a result of a route maching.
|
||||
current?: ICurrentRoute;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* see https://code.angularjs.org/1.2.26/docs/api/ngRoute/provider/$routeProvider#when for API documentation
|
||||
*/
|
||||
interface IRoute {
|
||||
/**
|
||||
* {(string|function()=}
|
||||
* Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string.
|
||||
*/
|
||||
controller?: any;
|
||||
/**
|
||||
* A controller alias name. If present the controller will be published to scope under the controllerAs name.
|
||||
*/
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* Undocumented?
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* {string=|function()=}
|
||||
* Html template as a string or a function that returns an html template as a string which should be used by ngView or ngInclude directives. This property takes precedence over templateUrl.
|
||||
*
|
||||
* If template is a function, it will be called with the following parameters:
|
||||
*
|
||||
* {Array.<Object>} - route parameters extracted from the current $location.path() by applying the current route
|
||||
*/
|
||||
template?: string;
|
||||
/**
|
||||
* {string=|function()=}
|
||||
* Path or function that returns a path to an html template that should be used by ngView.
|
||||
*
|
||||
* If templateUrl is a function, it will be called with the following parameters:
|
||||
*
|
||||
* {Array.<Object>} - route parameters extracted from the current $location.path() by applying the current route
|
||||
*/
|
||||
templateUrl?: any;
|
||||
/**
|
||||
* {Object.<string, function>=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is:
|
||||
*
|
||||
* - key - {string}: a name of a dependency to be injected into the controller.
|
||||
* - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead.
|
||||
*/
|
||||
resolve?: {[key: string]: any};
|
||||
/**
|
||||
* {(string|function())=}
|
||||
* Value to update $location path with and trigger route redirection.
|
||||
*
|
||||
* If redirectTo is a function, it will be called with the following parameters:
|
||||
*
|
||||
* - {Object.<string>} - route parameters extracted from the current $location.path() by applying the current route templateUrl.
|
||||
* - {string} - current $location.path()
|
||||
* - {Object} - current $location.search()
|
||||
* - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search().
|
||||
*/
|
||||
redirectTo?: any;
|
||||
/**
|
||||
* Reload route when only $location.search() or $location.hash() changes.
|
||||
*
|
||||
* This option defaults to true. If the option is set to false and url in the browser changes, then $routeUpdate event is broadcasted on the root scope.
|
||||
*/
|
||||
reloadOnSearch?: boolean;
|
||||
/**
|
||||
* Match routes without being case sensitive
|
||||
*
|
||||
* This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive
|
||||
*/
|
||||
caseInsensitiveMatch?: boolean;
|
||||
}
|
||||
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngRoute/service/$route#current
|
||||
interface ICurrentRoute extends IRoute {
|
||||
locals: {
|
||||
$scope: IScope;
|
||||
$template: string;
|
||||
};
|
||||
|
||||
params: any;
|
||||
}
|
||||
|
||||
interface IRouteProvider extends IServiceProvider {
|
||||
/**
|
||||
* Sets route definition that will be used on route change when no other route definition is matched.
|
||||
*
|
||||
* @params Mapping information to be assigned to $route.current.
|
||||
*/
|
||||
otherwise(params: IRoute): IRouteProvider;
|
||||
/**
|
||||
* Adds a new route definition to the $route service.
|
||||
*
|
||||
* @param path Route path (matched against $location.path). If $location.path contains redundant trailing slash or is missing one, the route will still match and the $location.path will be updated to add or drop the trailing slash to exactly match the route definition.
|
||||
*
|
||||
* - path can contain named groups starting with a colon: e.g. :name. All characters up to the next slash are matched and stored in $routeParams under the given name when the route matches.
|
||||
* - path can contain named groups starting with a colon and ending with a star: e.g.:name*. All characters are eagerly stored in $routeParams under the given name when the route matches.
|
||||
* - path can contain optional named groups with a question mark: e.g.:name?.
|
||||
*
|
||||
* For example, routes like /color/:color/largecode/:largecode*\/edit will match /color/brown/largecode/code/with/slashes/edit and extract: color: brown and largecode: code/with/slashes.
|
||||
*
|
||||
* @param route Mapping information to be assigned to $route.current on route match.
|
||||
*/
|
||||
when(path: string, route: IRoute): IRouteProvider;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="angular-sanitize-1.2.d.ts" />
|
||||
|
||||
var shouldBeString: string;
|
||||
|
||||
declare var $sanitizeService: ng.sanitize.ISanitizeService;
|
||||
shouldBeString = $sanitizeService(shouldBeString);
|
||||
|
||||
declare var $linky: ng.sanitize.filter.ILinky;
|
||||
shouldBeString = $linky(shouldBeString);
|
||||
shouldBeString = $linky(shouldBeString, shouldBeString);
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// Type definitions for Angular JS 1.2 (ngSanitize module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
/// <reference path="angular-1.2.d.ts" />
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// ngSanitize module (angular-sanitize.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare module ng.sanitize {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SanitizeService
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/service/$sanitize
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ISanitizeService {
|
||||
(html: string): string;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Filters included with the ngSanitize
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/filter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
export module filter {
|
||||
|
||||
// Finds links in text input and turns them into html links.
|
||||
// Supports http/https/ftp/mailto and plain email address links.
|
||||
// see https://code.angularjs.org/1.2.26/docs/api/ngSanitize/filter/linky
|
||||
interface ILinky {
|
||||
(text: string, target?: string): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Scenario Testing
|
||||
// Type definitions for Angular Scenario Testing 1.0 (ngScenario module)
|
||||
// Project: [http://angularjs.org]
|
||||
// Definitions by: [RomanoLindano]
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
// Type definitions for Angular Scenario Testing 1.2 (ngScenario module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: RomanoLindano <https://github.com/RomanoLindano>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../../jquery/jquery.d.ts" />
|
||||
|
||||
declare module ng {
|
||||
export interface IAngularStatic {
|
||||
scenario: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module angularScenario {
|
||||
|
||||
export interface RunFunction {
|
||||
(functionToRun: any): any;
|
||||
}
|
||||
export interface RunFunctionWithDescription {
|
||||
(description: string, functionToRun: any): any;
|
||||
}
|
||||
|
||||
export interface PauseFunction {
|
||||
(): any;
|
||||
}
|
||||
|
||||
export interface SleepFunction {
|
||||
(seconds: number): any;
|
||||
}
|
||||
|
||||
export interface Future {
|
||||
}
|
||||
|
||||
export interface testWindow {
|
||||
href(): Future;
|
||||
path(): Future;
|
||||
search(): Future;
|
||||
hash(): Future;
|
||||
}
|
||||
|
||||
export interface testLocation {
|
||||
url(): Future;
|
||||
path(): Future;
|
||||
search(): Future;
|
||||
hash(): Future;
|
||||
}
|
||||
|
||||
export interface Browser {
|
||||
navigateTo(url: string): void;
|
||||
navigateTo(urlDescription: string, urlFunction: () => string): void;
|
||||
reload(): void;
|
||||
window(): testWindow;
|
||||
location(): testLocation;
|
||||
}
|
||||
|
||||
export interface Matchers {
|
||||
toEqual(value: any): void;
|
||||
toBe(value: any): void;
|
||||
toBeDefined(): void;
|
||||
toBeTruthy(): void;
|
||||
toBeFalsy(): void;
|
||||
toMatch(regularExpression: any): void;
|
||||
toBeNull(): void;
|
||||
toContain(value: any): void;
|
||||
toBeLessThan(value: any): void;
|
||||
toBeGreaterThan(value: any): void;
|
||||
}
|
||||
|
||||
export interface CustomMatchers extends Matchers {
|
||||
}
|
||||
|
||||
export interface Expect extends CustomMatchers {
|
||||
not(): angularScenario.CustomMatchers;
|
||||
}
|
||||
|
||||
export interface UsingFunction {
|
||||
(selector: string, selectorDescription?: string): void;
|
||||
}
|
||||
|
||||
export interface BindingFunction {
|
||||
(bracketBindingExpression: string): Future;
|
||||
}
|
||||
|
||||
export interface Input {
|
||||
enter(value: any): any;
|
||||
check(): any;
|
||||
select(radioButtonValue: any): any;
|
||||
val(): Future;
|
||||
}
|
||||
|
||||
export interface Repeater {
|
||||
count(): Future;
|
||||
row(index: number): Future;
|
||||
column(ngBindingExpression: string): Future;
|
||||
}
|
||||
|
||||
export interface Select {
|
||||
option(value: any): any;
|
||||
option(...listOfValues: any[]): any;
|
||||
}
|
||||
|
||||
export interface Element {
|
||||
count(): Future;
|
||||
click(): any;
|
||||
dblclick(): any;
|
||||
mouseover(): any;
|
||||
mousedown(): any;
|
||||
mouseup(): any;
|
||||
query(callback: (selectedDOMElements: JQuery, callbackWhenDone: (objNull: any, futureValue: any) => any) => any): any;
|
||||
val(): Future;
|
||||
text(): Future;
|
||||
html(): Future;
|
||||
height(): Future;
|
||||
innerHeight(): Future;
|
||||
outerHeight(): Future;
|
||||
width(): Future;
|
||||
innerWidth(): Future;
|
||||
outerWidth(): Future;
|
||||
position(): Future;
|
||||
scrollLeft(): Future;
|
||||
scrollTop(): Future;
|
||||
offset(): Future;
|
||||
|
||||
val(value: any): void;
|
||||
text(value: any): void;
|
||||
html(value: any): void;
|
||||
height(value: any): void;
|
||||
innerHeight(value: any): void;
|
||||
outerHeight(value: any): void;
|
||||
width(value: any): void;
|
||||
innerWidth(value: any): void;
|
||||
outerWidth(value: any): void;
|
||||
position(value: any): void;
|
||||
scrollLeft(value: any): void;
|
||||
scrollTop(value: any): void;
|
||||
offset(value: any): void;
|
||||
|
||||
attr(key: any): Future;
|
||||
prop(key: any): Future;
|
||||
css(key: any): Future;
|
||||
|
||||
attr(key: any, value: any): void;
|
||||
prop(key: any, value: any): void;
|
||||
css(key: any, value: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare var describe: angularScenario.RunFunctionWithDescription;
|
||||
declare var ddescribe: angularScenario.RunFunctionWithDescription;
|
||||
declare var xdescribe: angularScenario.RunFunctionWithDescription;
|
||||
declare var beforeEach: angularScenario.RunFunction;
|
||||
declare var afterEach: angularScenario.RunFunction;
|
||||
declare var it: angularScenario.RunFunctionWithDescription;
|
||||
declare var iit: angularScenario.RunFunctionWithDescription;
|
||||
declare var xit: angularScenario.RunFunctionWithDescription;
|
||||
declare var pause: angularScenario.PauseFunction;
|
||||
declare var sleep: angularScenario.SleepFunction;
|
||||
declare function browser(): angularScenario.Browser;
|
||||
declare function expect(expectation: angularScenario.Future): angularScenario.Expect;
|
||||
declare var using: angularScenario.UsingFunction;
|
||||
declare var binding: angularScenario.BindingFunction;
|
||||
declare function input(ngModelBinding: string): angularScenario.Input;
|
||||
declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater;
|
||||
declare function select(ngModelBinding: string): angularScenario.Select;
|
||||
declare function element(selector: string, elementDescription?: string): angularScenario.Element;
|
||||
declare var angular: ng.IAngularStatic;
|
||||
Vendored
+1
@@ -57,6 +57,7 @@ declare module assert {
|
||||
// export = assert;
|
||||
// }
|
||||
|
||||
// move to power-assert.d.ts. do not use this definition file.
|
||||
declare module "power-assert" {
|
||||
export = assert;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for assertion-error 1.0 0
|
||||
// Type definitions for assertion-error 1.0.0
|
||||
// Project: https://github.com/chaijs/assertion-error
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
Vendored
+19
-1
@@ -31,6 +31,23 @@ interface AsyncQueue<T> {
|
||||
kill(): void;
|
||||
}
|
||||
|
||||
interface AsyncPriorityQueue<T> {
|
||||
length(): number;
|
||||
concurrency: number;
|
||||
started: boolean;
|
||||
paused: boolean;
|
||||
push(task: T, priority: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
push(task: T[], priority: number, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
saturated: () => any;
|
||||
empty: () => any;
|
||||
drain: () => any;
|
||||
running(): number;
|
||||
idle(): boolean;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
kill(): void;
|
||||
}
|
||||
|
||||
interface Async {
|
||||
|
||||
// Collections
|
||||
@@ -56,7 +73,7 @@ interface Async {
|
||||
some<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
any<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: AsyncMultipleResultsCallback<T>): any;
|
||||
every<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
all<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
all<T>(arr: T[], iterator: AsyncIterator<T, boolean>, callback: (result: boolean) => any): any;
|
||||
concat<T, R>(arr: T[], iterator: AsyncIterator<T, R[]>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
concatSeries<T, R>(arr: T[], iterator: AsyncIterator<T, R[]>, callback: AsyncMultipleResultsCallback<R>): any;
|
||||
|
||||
@@ -72,6 +89,7 @@ interface Async {
|
||||
waterfall<T>(tasks: T[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
waterfall<T>(tasks: T, callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
queue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncQueue<T>;
|
||||
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
|
||||
// auto(tasks: any[], callback?: AsyncMultipleResultsCallback<T>): void;
|
||||
auto(tasks: any, callback?: AsyncMultipleResultsCallback<any>): void;
|
||||
iterator(tasks: Function[]): Function;
|
||||
|
||||
Vendored
+4
@@ -48,6 +48,10 @@ declare module "aws-sdk" {
|
||||
public client: s3.Client;
|
||||
}
|
||||
|
||||
export class DynamoDB {
|
||||
constructor(options?: any);
|
||||
}
|
||||
|
||||
export module Sqs {
|
||||
|
||||
export interface Client {
|
||||
|
||||
@@ -0,0 +1,882 @@
|
||||
/// <reference path="bluebird-1.0.d.ts" />
|
||||
|
||||
// Tests by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
|
||||
// Note: replicate changes to all overloads in both definition and test file
|
||||
// Note: keep both static and instance members inline (so similar)
|
||||
|
||||
// Note: try to maintain the ordering and separators, and keep to the pattern
|
||||
|
||||
var obj: Object;
|
||||
var bool: boolean;
|
||||
var num: number;
|
||||
var str: string;
|
||||
var err: Error;
|
||||
var x: any;
|
||||
var f: Function;
|
||||
var func: Function;
|
||||
var arr: any[];
|
||||
var exp: RegExp;
|
||||
var anyArr: any[];
|
||||
var strArr: string[];
|
||||
var numArr: number[];
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
var value: any;
|
||||
var reason: any;
|
||||
var insanity: any;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
interface Foo {
|
||||
foo(): string;
|
||||
}
|
||||
interface Bar {
|
||||
bar(): string;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
interface StrFooMap {
|
||||
[key:string]:Foo;
|
||||
}
|
||||
|
||||
interface StrBarMap {
|
||||
[key:string]:Bar;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
interface StrFooArrMap {
|
||||
[key:string]:Foo[];
|
||||
}
|
||||
|
||||
interface StrBarArrMap {
|
||||
[key:string]:Bar[];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var foo: Foo;
|
||||
var bar: Bar;
|
||||
|
||||
var fooArr: Foo[];
|
||||
var barArr: Bar[];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var numProm: Promise<number>;
|
||||
var strProm: Promise<string>;
|
||||
var anyProm: Promise<any>;
|
||||
var boolProm: Promise<boolean>;
|
||||
var objProm: Promise<Object>;
|
||||
var voidProm: Promise<void>;
|
||||
|
||||
var fooProm: Promise<Foo>;
|
||||
var barProm: Promise<Bar>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
var numThen: Promise.Thenable<number>;
|
||||
var strThen: Promise.Thenable<string>;
|
||||
var anyThen: Promise.Thenable<any>;
|
||||
var boolThen: Promise.Thenable<boolean>;
|
||||
var objThen: Promise.Thenable<Object>;
|
||||
var voidThen: Promise.Thenable<void>;
|
||||
|
||||
var fooThen: Promise.Thenable<Foo>;
|
||||
var barThen: Promise.Thenable<Bar>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var numArrProm: Promise<number[]>;
|
||||
var strArrProm: Promise<string[]>;
|
||||
var anyArrProm: Promise<any[]>;
|
||||
|
||||
var fooArrProm: Promise<Foo[]>;
|
||||
var barArrProm: Promise<Bar[]>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
var numArrThen: Promise.Thenable<number[]>;
|
||||
var strArrThen: Promise.Thenable<string[]>;
|
||||
var anyArrThen: Promise.Thenable<any[]>;
|
||||
|
||||
var fooArrThen: Promise.Thenable<Foo[]>;
|
||||
var barArrThen: Promise.Thenable<Bar[]>;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var numPromArr: Promise<number>[];
|
||||
var strPromArr: Promise<string>[];
|
||||
var anyPromArr: Promise<any>[];
|
||||
|
||||
var fooPromArr: Promise<Foo>[];
|
||||
var barPromArr: Promise<Bar>[];
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
var numThenArr: Promise.Thenable<number>[];
|
||||
var strThenArr: Promise.Thenable<string>[];
|
||||
var anyThenArr: Promise.Thenable<any>[];
|
||||
|
||||
var fooThenArr: Promise.Thenable<Foo>[];
|
||||
var barThenArr: Promise.Thenable<Bar>[];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// booya!
|
||||
var fooThenArrThen: Promise.Thenable<Promise.Thenable<Foo>[]>;
|
||||
var barThenArrThen: Promise.Thenable<Promise.Thenable<Bar>[]>;
|
||||
|
||||
var fooResolver: Promise.Resolver<Foo>;
|
||||
var barResolver: Promise.Resolver<Bar>;
|
||||
|
||||
var fooInspection: Promise.Inspection<Foo>;
|
||||
var barInspection: Promise.Inspection<Bar>;
|
||||
|
||||
var fooInspectionArrProm: Promise<Promise.Inspection<Foo>[]>;
|
||||
var barInspectionArrProm: Promise<Promise.Inspection<Bar>[]>;
|
||||
|
||||
var BlueBird: typeof Promise;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooThen = fooProm;
|
||||
barThen = barProm;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = new Promise((resolve: (value: Foo) => void, reject: (reason: any) => void) => {
|
||||
if (bool) {
|
||||
resolve(foo);
|
||||
}
|
||||
else {
|
||||
reject(new Error(str));
|
||||
}
|
||||
});
|
||||
fooProm = new Promise((resolve: (value: Foo) => void) => {
|
||||
if (bool) {
|
||||
resolve(foo);
|
||||
}
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// needs a hint when used untyped?
|
||||
fooProm = new Promise<Foo>((resolve, reject) => {
|
||||
if (bool) {
|
||||
resolve(fooThen);
|
||||
}
|
||||
else {
|
||||
reject(new Error(str));
|
||||
}
|
||||
});
|
||||
fooProm = new Promise<Foo>((resolve) => {
|
||||
resolve(fooThen);
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooResolver.resolve(foo);
|
||||
|
||||
fooResolver.reject(err);
|
||||
|
||||
fooResolver.progress(bar);
|
||||
|
||||
fooResolver.callback = (err: any, value: Foo) => {
|
||||
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool = fooInspection.isFulfilled();
|
||||
|
||||
bool = fooInspection.isRejected();
|
||||
|
||||
bool = fooInspection.isPending();
|
||||
|
||||
foo = fooInspection.value();
|
||||
|
||||
x = fooInspection.error();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.then((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catch((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
barProm = fooProm.catch((reason: any) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught((reason: any) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.catch(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.error((reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.finally((value: Foo) => {
|
||||
// return is ignored
|
||||
return foo;
|
||||
});
|
||||
fooProm = fooProm.finally((value: Foo) => {
|
||||
// return is ignored
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.finally((value: Foo) => {
|
||||
// return is ignored
|
||||
});
|
||||
fooProm = fooProm.finally(() => {
|
||||
// return is ignored
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.lastly((value: Foo) => {
|
||||
// return is ignored
|
||||
return foo;
|
||||
});
|
||||
fooProm = fooProm.lastly((value: Foo) => {
|
||||
// return is ignored
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.lastly((value: Foo) => {
|
||||
// return is ignored
|
||||
});
|
||||
fooProm = fooProm.lastly(() => {
|
||||
// return is ignored
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.bind(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.progressed((note: any) => {
|
||||
return foo;
|
||||
});
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.delay(num);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.timeout(num);
|
||||
fooProm = fooProm.timeout(num, str);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm.nodeify();
|
||||
fooProm = fooProm.nodeify((err: any) => {
|
||||
|
||||
});
|
||||
fooProm = fooProm.nodeify((err: any, foo?: Foo) => {
|
||||
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
});
|
||||
barProm = fooProm.fork((value: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.cancel<Bar>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.cancellable();
|
||||
fooProm = fooProm.uncancellable();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool = fooProm.isCancellable();
|
||||
bool = fooProm.isFulfilled();
|
||||
bool = fooProm.isRejected();
|
||||
bool = fooProm.isPending();
|
||||
bool = fooProm.isResolved();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooInspection = fooProm.inspect();
|
||||
|
||||
anyProm = fooProm.call(str);
|
||||
anyProm = fooProm.call(str, 1, 2, 3);
|
||||
|
||||
//TODO enable get() test when implemented
|
||||
// barProm = fooProm.get(str);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.return(bar);
|
||||
barProm = fooProm.thenReturn(bar);
|
||||
|
||||
voidProm = fooProm.return();
|
||||
voidProm = fooProm.thenReturn();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooProm
|
||||
fooProm = fooProm.throw(err);
|
||||
fooProm = fooProm.thenThrow(err);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
str = fooProm.toString();
|
||||
|
||||
obj = fooProm.toJSON();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar, twotwo: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
});
|
||||
barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar, twotwo: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO fix collection inference
|
||||
|
||||
barArrProm = fooProm.all<Bar>();
|
||||
|
||||
objProm = fooProm.props();
|
||||
|
||||
barInspectionArrProm = fooProm.settle<Bar>();
|
||||
|
||||
barProm = fooProm.any<Bar>();
|
||||
|
||||
barArrProm = fooProm.some<Bar>(num);
|
||||
|
||||
barProm = fooProm.race<Bar>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO fix collection inference
|
||||
|
||||
barArrProm = fooProm.map<Foo, Bar>((item: Foo, index: number, arrayLength: number) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = fooProm.map<Foo, Bar>((item: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.reduce<Foo, Bar>((memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return memo;
|
||||
});
|
||||
barProm = fooProm.reduce<Foo, Bar>((memo: Bar, item: Foo) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooArrProm = fooArrProm.filter<Foo>((item: Foo, index: number, arrayLength: number) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = fooArrProm.filter<Foo>((item: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
});
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
}, arr);
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = Promise.try(() => {
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = Promise.try(() => {
|
||||
return fooThen;
|
||||
}, arr);
|
||||
fooProm = Promise.try(() => {
|
||||
return fooThen;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = Promise.attempt(() => {
|
||||
return foo;
|
||||
});
|
||||
fooProm = Promise.attempt(() => {
|
||||
return foo;
|
||||
}, arr);
|
||||
fooProm = Promise.attempt(() => {
|
||||
return foo;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = Promise.attempt(() => {
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = Promise.attempt(() => {
|
||||
return fooThen;
|
||||
}, arr);
|
||||
fooProm = Promise.attempt(() => {
|
||||
return fooThen;
|
||||
}, arr, x);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
func = Promise.method(function () {
|
||||
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = Promise.resolve(foo);
|
||||
fooProm = Promise.resolve(fooThen);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
voidProm = Promise.reject(reason);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooResolver = Promise.defer<Foo>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = Promise.cast(foo);
|
||||
fooProm = Promise.cast(fooThen);
|
||||
|
||||
voidProm = Promise.bind(x);
|
||||
|
||||
bool = Promise.is(value);
|
||||
|
||||
Promise.longStackTraces();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO enable delay
|
||||
|
||||
fooProm = Promise.delay(fooThen, num);
|
||||
fooProm = Promise.delay(foo, num);
|
||||
voidProm = Promise.delay(num);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
func = Promise.promisify(f);
|
||||
func = Promise.promisify(f, obj);
|
||||
;
|
||||
|
||||
obj = Promise.promisifyAll(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO enable generator
|
||||
/*
|
||||
func = Promise.coroutine(f);
|
||||
|
||||
barProm = Promise.spawn<number>(f);
|
||||
*/
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
BlueBird = Promise.noConflict();
|
||||
|
||||
Promise.onPossiblyUnhandledRejection((reason: any) => {
|
||||
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooArrProm = Promise.all(fooThenArrThen);
|
||||
fooArrProm = Promise.all(fooArrProm);
|
||||
fooArrProm = Promise.all(fooThenArr);
|
||||
fooArrProm = Promise.all(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
objProm = Promise.props(objProm);
|
||||
objProm = Promise.props(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooInspectionArrProm = Promise.settle(fooThenArrThen);
|
||||
fooInspectionArrProm = Promise.settle(fooArrProm);
|
||||
fooInspectionArrProm = Promise.settle(fooThenArr);
|
||||
fooInspectionArrProm = Promise.settle(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooProm = Promise.any(fooThenArrThen);
|
||||
fooProm = Promise.any(fooArrProm);
|
||||
fooProm = Promise.any(fooThenArr);
|
||||
fooProm = Promise.any(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooProm = Promise.race(fooThenArrThen);
|
||||
fooProm = Promise.race(fooArrProm);
|
||||
fooProm = Promise.race(fooThenArr);
|
||||
fooProm = Promise.race(fooArr);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
//TODO expand tests to overloads
|
||||
fooArrProm = Promise.some(fooThenArrThen, num);
|
||||
fooArrProm = Promise.some(fooArrThen, num);
|
||||
fooArrProm = Promise.some(fooThenArr, num);
|
||||
fooArrProm = Promise.some(fooArr, num);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooArrProm = Promise.join(foo, foo, foo);
|
||||
fooArrProm = Promise.join(fooThen, fooThen, fooThen);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// map()
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArrThen
|
||||
|
||||
barArrProm = Promise.map(fooThenArrThen, (item: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooThenArrThen, (item: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArrThen
|
||||
|
||||
barArrProm = Promise.map(fooArrThen, (item: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooArrThen, (item: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArr
|
||||
|
||||
barArrProm = Promise.map(fooThenArr, (item: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooThenArr, (item: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArr
|
||||
|
||||
barArrProm = Promise.map(fooArr, (item: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooArr, (item: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bar;
|
||||
});
|
||||
barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// reduce()
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArrThen
|
||||
|
||||
barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooThenArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArrThen
|
||||
|
||||
barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooArrThen, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArr
|
||||
|
||||
barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooThenArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArr
|
||||
|
||||
barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return memo;
|
||||
}, bar);
|
||||
barProm = Promise.reduce(fooArr, (memo: Bar, item: Foo, index: number, arrayLength: number) => {
|
||||
return barThen;
|
||||
}, bar);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// filter()
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArrThen
|
||||
|
||||
fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => {
|
||||
return boolThen;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return boolThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArrThen
|
||||
|
||||
fooArrProm = Promise.filter(fooArrThen, (item: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooArrThen, (item: Foo) => {
|
||||
return boolThen;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => {
|
||||
return boolThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArr
|
||||
|
||||
fooArrProm = Promise.filter(fooThenArr, (item: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooThenArr, (item: Foo) => {
|
||||
return boolThen;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return boolThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArr
|
||||
|
||||
fooArrProm = Promise.filter(fooArr, (item: Foo) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooArr, (item: Foo) => {
|
||||
return boolThen;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return bool;
|
||||
});
|
||||
fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => {
|
||||
return boolThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Vendored
+670
@@ -0,0 +1,670 @@
|
||||
// Type definitions for bluebird 1.0.0
|
||||
// Project: https://github.com/petkaantonov/bluebird
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// ES6 model with generics overload was sourced and trans-multiplied from es6-promises.d.ts
|
||||
// By: Campredon <https://github.com/fdecampredon/>
|
||||
|
||||
// Warning: recommended to use `tsc > v0.9.7` (critical bugs in earlier generic code):
|
||||
// - https://github.com/borisyankov/DefinitelyTyped/issues/1563
|
||||
|
||||
// Note: replicate changes to all overloads in both definition and test file
|
||||
// Note: keep both static and instance members inline (so similar)
|
||||
|
||||
// TODO fix remaining TODO annotations in both definition and test
|
||||
|
||||
// TODO verify support to have no return statement in handlers to get a Promise<void> (more overloads?)
|
||||
|
||||
declare class Promise<R> implements Promise.Thenable<R> {
|
||||
/**
|
||||
* Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise.
|
||||
*/
|
||||
constructor(callback: (resolve: (thenable: Promise.Thenable<R>) => void, reject: (error: any) => void) => void);
|
||||
constructor(callback: (resolve: (result: R) => void, reject: (error: any) => void) => void);
|
||||
|
||||
/**
|
||||
* Promises/A+ `.then()` with progress handler. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
|
||||
*/
|
||||
then<U>(onFulfill: (value: R) => Promise.Thenable<U>, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => Promise.Thenable<U>, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill: (value: R) => U, onReject: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
then<U>(onFulfill?: (value: R) => U, onReject?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
catch<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
caught<U>(onReject?: (error: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
|
||||
*
|
||||
* This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called.
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(predicate: (error: any) => boolean, onReject: (error: any) => U): Promise<U>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => Promise.Thenable<U>): Promise<U>;
|
||||
|
||||
catch<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
caught<U>(ErrorClass: Function, onReject: (error: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections.
|
||||
*/
|
||||
error<U>(onReject: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
error<U>(onReject: (reason: any) => U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler.
|
||||
*
|
||||
* Alias `.lastly();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
finally(handler: (value: R) => Promise.Thenable<R>): Promise<R>;
|
||||
finally(handler: (value: R) => R): Promise<R>;
|
||||
finally(handler: (value: R) => void): Promise<R>;
|
||||
|
||||
lastly(handler: (value: R) => Promise.Thenable<R>): Promise<R>;
|
||||
lastly(handler: (value: R) => R): Promise<R>;
|
||||
lastly(handler: (value: R) => void): Promise<R>;
|
||||
|
||||
/**
|
||||
* Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
|
||||
*/
|
||||
bind(thisArg: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error.
|
||||
*/
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise.
|
||||
*/
|
||||
progressed(handler: (note: any) => any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.delay(this, ms)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
delay(ms: number): Promise<R>;
|
||||
|
||||
/**
|
||||
* Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. However, if this promise is not fulfilled or rejected within `ms` milliseconds, the returned promise is rejected with a `Promise.TimeoutError` instance.
|
||||
*
|
||||
* You may specify a custom error message with the `message` parameter.
|
||||
*/
|
||||
timeout(ms: number, message?: string): Promise<R>;
|
||||
|
||||
/**
|
||||
* Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success.
|
||||
* Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything.
|
||||
*/
|
||||
nodeify(callback: (err: any, value?: R) => void): Promise<R>;
|
||||
nodeify(...sink: any[]): void;
|
||||
|
||||
/**
|
||||
* Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise.
|
||||
*/
|
||||
cancellable(): Promise<R>;
|
||||
|
||||
/**
|
||||
* Cancel this promise. The cancellation will propagate to farthest cancellable ancestor promise which is still pending.
|
||||
*
|
||||
* That ancestor will then be rejected with a `CancellationError` (get a reference from `Promise.CancellationError`) object as the rejection reason.
|
||||
*
|
||||
* In a promise rejection handler you may check for a cancellation by seeing if the reason object has `.name === "Cancel"`.
|
||||
*
|
||||
* Promises are by default not cancellable. Use `.cancellable()` to mark a promise as cancellable.
|
||||
*/
|
||||
// TODO what to do with this?
|
||||
cancel<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* Like `.then()`, but cancellation of the the returned promise or any of its descendant will not propagate cancellation to this promise or this promise's ancestors.
|
||||
*/
|
||||
fork<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
fork<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
fork<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
fork<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
|
||||
/**
|
||||
* Create an uncancellable promise based on this promise.
|
||||
*/
|
||||
uncancellable(): Promise<R>;
|
||||
|
||||
/**
|
||||
* See if this promise can be cancelled.
|
||||
*/
|
||||
isCancellable(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` has been fulfilled.
|
||||
*/
|
||||
isFulfilled(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` has been rejected.
|
||||
*/
|
||||
isRejected(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` is still defer.
|
||||
*/
|
||||
isPending(): boolean;
|
||||
|
||||
/**
|
||||
* See if this `promise` is resolved -> either fulfilled or rejected.
|
||||
*/
|
||||
isResolved(): boolean;
|
||||
|
||||
/**
|
||||
* Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`.
|
||||
*/
|
||||
inspect(): Promise.Inspection<R>;
|
||||
|
||||
/**
|
||||
* This is a convenience method for doing:
|
||||
*
|
||||
* <code>
|
||||
* promise.then(function(obj){
|
||||
* return obj[propertyName].call(obj, arg...);
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
call(propertyName: string, ...args: any[]): Promise<any>;
|
||||
|
||||
/**
|
||||
* This is a convenience method for doing:
|
||||
*
|
||||
* <code>
|
||||
* promise.then(function(obj){
|
||||
* return obj[propertyName];
|
||||
* });
|
||||
* </code>
|
||||
*/
|
||||
// TODO find way to fix get()
|
||||
// get<U>(propertyName: string): Promise<U>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .then(function() {
|
||||
* return value;
|
||||
* });
|
||||
* </code>
|
||||
*
|
||||
* in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()`
|
||||
*
|
||||
* Alias `.thenReturn();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
return(): Promise<any>;
|
||||
thenReturn(): Promise<any>;
|
||||
return<U>(value: U): Promise<U>;
|
||||
thenReturn<U>(value: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Convenience method for:
|
||||
*
|
||||
* <code>
|
||||
* .then(function() {
|
||||
* throw reason;
|
||||
* });
|
||||
* </code>
|
||||
* Same limitations apply as with `.return()`.
|
||||
*
|
||||
* Alias `.thenThrow();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
throw(reason: Error): Promise<R>;
|
||||
thenThrow(reason: Error): Promise<R>;
|
||||
|
||||
/**
|
||||
* Convert to String.
|
||||
*/
|
||||
toString(): string;
|
||||
|
||||
/**
|
||||
* This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`.
|
||||
*/
|
||||
toJSON(): Object;
|
||||
|
||||
/**
|
||||
* Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers.
|
||||
*/
|
||||
// TODO how to model instance.spread()? like Q?
|
||||
spread<U>(onFulfill: Function, onReject?: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
spread<U>(onFulfill: Function, onReject?: (reason: any) => U): Promise<U>;
|
||||
/*
|
||||
// TODO or something like this?
|
||||
spread<U, W>(onFulfill: (...values: W[]) => Promise.Thenable<U>, onReject?: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => Promise.Thenable<U>, onReject?: (reason: any) => U): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => Promise.Thenable<U>): Promise<U>;
|
||||
spread<U, W>(onFulfill: (...values: W[]) => U, onReject?: (reason: any) => U): Promise<U>;
|
||||
*/
|
||||
/**
|
||||
* Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
all<U>(): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO how to model instance.props()?
|
||||
props(): Promise<Object>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.settle(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
settle<U>(): Promise<Promise.Inspection<U>[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
any<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
some<U>(count: number): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
race<U>(): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO type inference from array-resolving promise?
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<U[]>;
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => boolean): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
|
||||
*
|
||||
* Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call.
|
||||
*
|
||||
* Alias for `attempt();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
static try<R>(fn: () => Promise.Thenable<R>, args?: any[], ctx?: any): Promise<R>;
|
||||
static try<R>(fn: () => R, args?: any[], ctx?: any): Promise<R>;
|
||||
|
||||
static attempt<R>(fn: () => Promise.Thenable<R>, args?: any[], ctx?: any): Promise<R>;
|
||||
static attempt<R>(fn: () => R, args?: any[], ctx?: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
|
||||
* This method is convenient when a function can sometimes return synchronously or throw synchronously.
|
||||
*/
|
||||
static method(fn: Function): Function;
|
||||
|
||||
/**
|
||||
* Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state.
|
||||
*/
|
||||
static resolve(): Promise<void>;
|
||||
static resolve<R>(value: Promise.Thenable<R>): Promise<R>;
|
||||
static resolve<R>(value: R): Promise<R>;
|
||||
|
||||
/**
|
||||
* Create a promise that is rejected with the given `reason`.
|
||||
*/
|
||||
static reject(reason: any): Promise<any>;
|
||||
static reject<R>(reason: any): Promise<R>;
|
||||
|
||||
/**
|
||||
* Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution).
|
||||
*/
|
||||
static defer<R>(): Promise.Resolver<R>;
|
||||
|
||||
/**
|
||||
* Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable.
|
||||
*/
|
||||
static cast<R>(value: Promise.Thenable<R>): Promise<R>;
|
||||
static cast<R>(value: R): Promise<R>;
|
||||
|
||||
/**
|
||||
* Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`.
|
||||
*/
|
||||
static bind(thisArg: any): Promise<void>;
|
||||
|
||||
/**
|
||||
* See if `value` is a trusted Promise.
|
||||
*/
|
||||
static is(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have alread been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency.
|
||||
*/
|
||||
static longStackTraces(): void;
|
||||
|
||||
/**
|
||||
* Returns a promise that will be fulfilled with `value` (or `undefined`) after given `ms` milliseconds. If `value` is a promise, the delay will start counting down when it is fulfilled and the returned promise will be fulfilled with the fulfillment value of the `value` promise.
|
||||
*/
|
||||
// TODO enable more overloads
|
||||
static delay<R>(value: Promise.Thenable<R>, ms: number): Promise<R>;
|
||||
static delay<R>(value: R, ms: number): Promise<R>;
|
||||
static delay(ms: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument.
|
||||
*
|
||||
* If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them.
|
||||
*
|
||||
* If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`.
|
||||
*/
|
||||
// TODO how to model promisify?
|
||||
static promisify(nodeFunction: Function, receiver?: any): Function;
|
||||
|
||||
/**
|
||||
* Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object.
|
||||
*
|
||||
* Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method.
|
||||
*/
|
||||
// TODO how to model promisifyAll?
|
||||
static promisifyAll(target: Object): Object;
|
||||
|
||||
/**
|
||||
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
*/
|
||||
// TODO fix coroutine GeneratorFunction
|
||||
static coroutine<R>(generatorFunction: Function): Function;
|
||||
|
||||
/**
|
||||
* Spawn a coroutine which may yield promises to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
|
||||
*/
|
||||
// TODO fix spawn GeneratorFunction
|
||||
static spawn<R>(generatorFunction: Function): Promise<R>;
|
||||
|
||||
/**
|
||||
* This is relevant to browser environments with no module loader.
|
||||
*
|
||||
* Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else.
|
||||
*/
|
||||
static noConflict(): typeof Promise;
|
||||
|
||||
/**
|
||||
* Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers.
|
||||
*
|
||||
* Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections.
|
||||
*/
|
||||
static onPossiblyUnhandledRejection(handler: (reason: any) => any): void;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason.
|
||||
*/
|
||||
// TODO enable more overloads
|
||||
// promise of array with promises of value
|
||||
static all<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R[]>;
|
||||
// promise of array with values
|
||||
static all<R>(values: Promise.Thenable<R[]>): Promise<R[]>;
|
||||
// array with promises of value
|
||||
static all<R>(values: Promise.Thenable<R>[]): Promise<R[]>;
|
||||
// array with values
|
||||
static all<R>(values: R[]): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason.
|
||||
*
|
||||
* If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties.
|
||||
*
|
||||
* *The original object is not modified.*
|
||||
*/
|
||||
// TODO verify this is correct
|
||||
// trusted promise for object
|
||||
static props(object: Promise<Object>): Promise<Object>;
|
||||
// object
|
||||
static props(object: Object): Promise<Object>;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are either fulfilled or rejected. The fulfillment value is an array of ``PromiseInspection`` instances at respective positions in relation to the input array.
|
||||
*
|
||||
* *original: The array is not modified. The input array sparsity is retained in the resulting array.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static settle<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<Promise.Inspection<R>[]>;
|
||||
// promise of array with values
|
||||
static settle<R>(values: Promise.Thenable<R[]>): Promise<Promise.Inspection<R>[]>;
|
||||
// array with promises of value
|
||||
static settle<R>(values: Promise.Thenable<R>[]): Promise<Promise.Inspection<R>[]>;
|
||||
// array with values
|
||||
static settle<R>(values: R[]): Promise<Promise.Inspection<R>[]>;
|
||||
|
||||
/**
|
||||
* Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static any<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R>;
|
||||
// promise of array with values
|
||||
static any<R>(values: Promise.Thenable<R[]>): Promise<R>;
|
||||
// array with promises of value
|
||||
static any<R>(values: Promise.Thenable<R>[]): Promise<R>;
|
||||
// array with values
|
||||
static any<R>(values: R[]): Promise<R>;
|
||||
|
||||
/**
|
||||
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value.
|
||||
*
|
||||
* **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static race<R>(values: Promise.Thenable<Promise.Thenable<R>[]>): Promise<R>;
|
||||
// promise of array with values
|
||||
static race<R>(values: Promise.Thenable<R[]>): Promise<R>;
|
||||
// array with promises of value
|
||||
static race<R>(values: Promise.Thenable<R>[]): Promise<R>;
|
||||
// array with values
|
||||
static race<R>(values: R[]): Promise<R>;
|
||||
|
||||
/**
|
||||
* Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.
|
||||
*
|
||||
* If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in.
|
||||
*
|
||||
* *The original array is not modified.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static some<R>(values: Promise.Thenable<Promise.Thenable<R>[]>, count: number): Promise<R[]>;
|
||||
// promise of array with values
|
||||
static some<R>(values: Promise.Thenable<R[]>, count: number): Promise<R[]>;
|
||||
// array with promises of value
|
||||
static some<R>(values: Promise.Thenable<R>[], count: number): Promise<R[]>;
|
||||
// array with values
|
||||
static some<R>(values: R[], count: number): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* Like `Promise.all()` but instead of having to pass an array, the array is generated from the passed variadic arguments.
|
||||
*/
|
||||
// variadic array with promises of value
|
||||
static join<R>(...values: Promise.Thenable<R>[]): Promise<R[]>;
|
||||
// variadic array with values
|
||||
static join<R>(...values: R[]): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well.
|
||||
*
|
||||
* *The original array is not modified.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static map<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
// promise of array with values
|
||||
static map<R, U>(values: Promise.Thenable<R[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: Promise.Thenable<R[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
// array with promises of value
|
||||
static map<R, U>(values: Promise.Thenable<R>[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: Promise.Thenable<R>[], mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
// array with values
|
||||
static map<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable<U>): Promise<U[]>;
|
||||
static map<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
*
|
||||
* *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.*
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static reduce<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
// promise of array with values
|
||||
static reduce<R, U>(values: Promise.Thenable<R[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: Promise.Thenable<R[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
// array with promises of value
|
||||
static reduce<R, U>(values: Promise.Thenable<R>[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: Promise.Thenable<R>[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
// array with values
|
||||
static reduce<R, U>(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => Promise.Thenable<U>, initialValue?: U): Promise<U>;
|
||||
static reduce<R, U>(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U, initialValue?: U): Promise<U>;
|
||||
|
||||
/**
|
||||
* Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result.
|
||||
*
|
||||
* *The original array is not modified.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static filter<R>(values: Promise.Thenable<Promise.Thenable<R>[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: Promise.Thenable<Promise.Thenable<R>[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
|
||||
// promise of array with values
|
||||
static filter<R>(values: Promise.Thenable<R[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: Promise.Thenable<R[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
|
||||
// array with promises of value
|
||||
static filter<R>(values: Promise.Thenable<R>[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: Promise.Thenable<R>[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
|
||||
// array with values
|
||||
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>): Promise<R[]>;
|
||||
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise<R[]>;
|
||||
}
|
||||
|
||||
declare module Promise {
|
||||
export interface RangeError extends Error {
|
||||
}
|
||||
export interface CancellationError extends Error {
|
||||
}
|
||||
export interface TimeoutError extends Error {
|
||||
}
|
||||
export interface TypeError extends Error {
|
||||
}
|
||||
export interface RejectionError extends Error {
|
||||
}
|
||||
|
||||
export interface Thenable<R> {
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected?: (error: any) => U): Thenable<U>;
|
||||
then<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): Thenable<U>;
|
||||
}
|
||||
|
||||
export interface Resolver<R> {
|
||||
/**
|
||||
* Returns a reference to the controlled promise that can be passed to clients.
|
||||
*/
|
||||
promise: Promise<R>;
|
||||
|
||||
/**
|
||||
* Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state.
|
||||
*/
|
||||
resolve(value: R): void;
|
||||
resolve(): void;
|
||||
|
||||
/**
|
||||
* Reject the underlying promise with `reason` as the rejection reason.
|
||||
*/
|
||||
reject(reason: any): void;
|
||||
|
||||
/**
|
||||
* Progress the underlying promise with `value` as the progression value.
|
||||
*/
|
||||
progress(value: any): void;
|
||||
|
||||
/**
|
||||
* Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions.
|
||||
*
|
||||
* If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values.
|
||||
*/
|
||||
// TODO specify resolver callback
|
||||
callback: (err: any, value: R, ...values: R[]) => void;
|
||||
}
|
||||
|
||||
export interface Inspection<R> {
|
||||
/**
|
||||
* See if the underlying promise was fulfilled at the creation time of this inspection object.
|
||||
*/
|
||||
isFulfilled(): boolean;
|
||||
|
||||
/**
|
||||
* See if the underlying promise was rejected at the creation time of this inspection object.
|
||||
*/
|
||||
isRejected(): boolean;
|
||||
|
||||
/**
|
||||
* See if the underlying promise was defer at the creation time of this inspection object.
|
||||
*/
|
||||
isPending(): boolean;
|
||||
|
||||
/**
|
||||
* Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
value(): R;
|
||||
|
||||
/**
|
||||
* Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
error(): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'bluebird' {
|
||||
export = Promise;
|
||||
}
|
||||
+44
-29
@@ -20,6 +20,7 @@ var exp: RegExp;
|
||||
var anyArr: any[];
|
||||
var strArr: string[];
|
||||
var numArr: number[];
|
||||
var voidVar: void;
|
||||
|
||||
// - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -199,7 +200,7 @@ bool = fooInspection.isPending();
|
||||
|
||||
foo = fooInspection.value();
|
||||
|
||||
x = fooInspection.error();
|
||||
x = fooInspection.reason();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -244,9 +245,15 @@ barProm = fooProm.caught((reason: any) => {
|
||||
barProm = fooProm.catch(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.catch(Promise.CancellationError, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Error, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.caught(Promise.CancellationError, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@@ -256,36 +263,28 @@ barProm = fooProm.error((reason: any) => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.finally((value: Foo) => {
|
||||
// return is ignored
|
||||
return foo;
|
||||
});
|
||||
fooProm = fooProm.finally((value: Foo) => {
|
||||
// return is ignored
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.finally((value: Foo) => {
|
||||
// return is ignored
|
||||
fooProm = fooProm.finally(() => {
|
||||
// non-Thenable return is ignored
|
||||
return "foo";
|
||||
});
|
||||
fooProm = fooProm.finally(() => {
|
||||
// return is ignored
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.finally(() => {
|
||||
// non-Thenable return is ignored
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.lastly((value: Foo) => {
|
||||
// return is ignored
|
||||
return foo;
|
||||
});
|
||||
fooProm = fooProm.lastly((value: Foo) => {
|
||||
// return is ignored
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.lastly((value: Foo) => {
|
||||
// return is ignored
|
||||
fooProm = fooProm.lastly(() => {
|
||||
// non-Thenable return is ignored
|
||||
return "foo";
|
||||
});
|
||||
fooProm = fooProm.lastly(() => {
|
||||
// return is ignored
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.lastly(() => {
|
||||
// non-Thenable return is ignored
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -294,40 +293,56 @@ fooProm = fooProm.bind(obj);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
}, (reason: any) => {
|
||||
return bar;
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return bar;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
}, (note: any) => {
|
||||
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
}, (reason: any) => {
|
||||
return barThen;
|
||||
});
|
||||
barProm = fooProm.done((value: Foo) => {
|
||||
voidVar = fooProm.done((value: Foo) => {
|
||||
return barThen;
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.tap((value: Foo) => {
|
||||
// non-Thenable return is ignored
|
||||
return "foo";
|
||||
});
|
||||
fooProm = fooProm.tap((value: Foo) => {
|
||||
return fooThen;
|
||||
});
|
||||
fooProm = fooProm.tap((value: Foo) => {
|
||||
return voidThen;
|
||||
});
|
||||
fooProm = fooProm.tap(() => {
|
||||
// non-Thenable return is ignored
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooProm = fooProm.progressed((note: any) => {
|
||||
|
||||
Vendored
+53
-13
@@ -1,4 +1,4 @@
|
||||
// Type definitions for bluebird 1.0.0
|
||||
// Type definitions for bluebird 2.0.0
|
||||
// Project: https://github.com/petkaantonov/bluebird
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
// TODO verify support to have no return statement in handlers to get a Promise<void> (more overloads?)
|
||||
|
||||
declare class Promise<R> implements Promise.Thenable<R> {
|
||||
declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
/**
|
||||
* Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise.
|
||||
*/
|
||||
@@ -72,13 +72,11 @@ declare class Promise<R> implements Promise.Thenable<R> {
|
||||
*
|
||||
* Alias `.lastly();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
finally(handler: (value: R) => Promise.Thenable<R>): Promise<R>;
|
||||
finally(handler: (value: R) => R): Promise<R>;
|
||||
finally(handler: (value: R) => void): Promise<R>;
|
||||
finally<U>(handler: () => Promise.Thenable<U>): Promise<R>;
|
||||
finally<U>(handler: () => U): Promise<R>;
|
||||
|
||||
lastly(handler: (value: R) => Promise.Thenable<R>): Promise<R>;
|
||||
lastly(handler: (value: R) => R): Promise<R>;
|
||||
lastly(handler: (value: R) => void): Promise<R>;
|
||||
lastly<U>(handler: () => Promise.Thenable<U>): Promise<R>;
|
||||
lastly<U>(handler: () => U): Promise<R>;
|
||||
|
||||
/**
|
||||
* Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
|
||||
@@ -88,10 +86,16 @@ declare class Promise<R> implements Promise.Thenable<R> {
|
||||
/**
|
||||
* Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error.
|
||||
*/
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): Promise<U>;
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): void;
|
||||
done<U>(onFulfilled: (value: R) => Promise.Thenable<U>, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void;
|
||||
done<U>(onFulfilled: (value: R) => U, onRejected: (error: any) => Promise.Thenable<U>, onProgress?: (note: any) => any): void;
|
||||
done<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U, onProgress?: (note: any) => any): void;
|
||||
|
||||
/**
|
||||
* Like `.finally()`, but not called for rejections.
|
||||
*/
|
||||
tap<U>(onFulFill: (value: R) => Promise.Thenable<U>): Promise<R>;
|
||||
tap<U>(onFulfill: (value: R) => U): Promise<R>;
|
||||
|
||||
/**
|
||||
* Shorthand for `.then(null, null, handler);`. Attach a progress handler that will be called if this promise is progressed. Returns a new promise chained from this promise.
|
||||
@@ -172,6 +176,20 @@ declare class Promise<R> implements Promise.Thenable<R> {
|
||||
*/
|
||||
isResolved(): boolean;
|
||||
|
||||
/**
|
||||
* Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
value(): R;
|
||||
|
||||
/**
|
||||
* Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet.
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
reason(): any;
|
||||
|
||||
/**
|
||||
* Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of the promise as snapshotted at the time of calling `.inspect()`.
|
||||
*/
|
||||
@@ -594,6 +612,20 @@ declare module Promise {
|
||||
}
|
||||
export interface RejectionError extends Error {
|
||||
}
|
||||
export interface OperationalError extends Error {
|
||||
}
|
||||
|
||||
// Ideally, we'd define e.g. "export class RangeError extends Error {}",
|
||||
// but as Error is defined as an interface (not a class), TypeScript doesn't
|
||||
// allow extending Error, only implementing it.
|
||||
// However, if we want to catch() only a specific error type, we need to pass
|
||||
// a constructor function to it. So, as a workaround, we define them here as such.
|
||||
export function RangeError(): RangeError;
|
||||
export function CancellationError(): CancellationError;
|
||||
export function TimeoutError(): TimeoutError;
|
||||
export function TypeError(): TypeError;
|
||||
export function RejectionError(): RejectionError;
|
||||
export function OperationalError(): OperationalError;
|
||||
|
||||
export interface Thenable<R> {
|
||||
then<U>(onFulfilled: (value: R) => Thenable<U>, onRejected: (error: any) => Thenable<U>): Thenable<U>;
|
||||
@@ -661,8 +693,16 @@ declare module Promise {
|
||||
*
|
||||
* throws `TypeError`
|
||||
*/
|
||||
error(): any;
|
||||
reason(): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes how bluebird schedules calls a-synchronously.
|
||||
*
|
||||
* @param scheduler Should be a function that asynchronously schedules
|
||||
* the calling of the passed in function
|
||||
*/
|
||||
export function setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void;
|
||||
}
|
||||
|
||||
declare module 'bluebird' {
|
||||
|
||||
Vendored
+4
-1
@@ -376,6 +376,7 @@ declare module breeze {
|
||||
clear(): void;
|
||||
createEmptyCopy(): EntityManager;
|
||||
createEntity(typeName: string, config?: {}, entityState?: EntityStateSymbol) : Entity;
|
||||
createEntity(typeName: string, config?: {}, entityState?: EntityStateSymbol, mergeStrategy?: StrategySymbol): Entity;
|
||||
createEntity(entityType: EntityType, config?: {}, entityState?: EntityStateSymbol): Entity;
|
||||
detachEntity(entity: Entity): boolean;
|
||||
executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Q.Promise<QueryResult>;
|
||||
@@ -525,6 +526,7 @@ declare module breeze {
|
||||
where(property: string, operator: string, value: any): EntityQuery;
|
||||
where(property: string, operator: FilterQueryOpSymbol, value: any): EntityQuery;
|
||||
where(predicate: FilterQueryOpSymbol): EntityQuery;
|
||||
where(property: string, filterop: FilterQueryOpSymbol, property2: string, filterop2: FilterQueryOpSymbol,value:any): EntityQuery;
|
||||
withParameters(params: Object): EntityQuery;
|
||||
}
|
||||
|
||||
@@ -617,6 +619,7 @@ declare module breeze {
|
||||
LessThanOrEqual: FilterQueryOpSymbol;
|
||||
NotEquals: FilterQueryOpSymbol;
|
||||
StartsWith: FilterQueryOpSymbol;
|
||||
Any: FilterQueryOpSymbol;
|
||||
}
|
||||
var FilterQueryOp: FilterQueryOp;
|
||||
|
||||
@@ -651,7 +654,7 @@ declare module breeze {
|
||||
getEntityTypes(): IStructuralType[];
|
||||
hasMetadataFor(serviceName: string): boolean;
|
||||
static importMetadata(exportedString: string): MetadataStore;
|
||||
importMetadata(exportedString: string): MetadataStore;
|
||||
importMetadata(exportedString: string, allowMerge?: boolean): MetadataStore;
|
||||
isEmpty(): boolean;
|
||||
registerEntityTypeCtor(entityTypeName: string, entityCtor: Function, initializationFn?: (entity: Entity) =>void ): void;
|
||||
trackUnmappedType(entityCtor: Function, interceptor?: Function): void;
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import browserify = require("browserify");
|
||||
import fs = require("fs");
|
||||
|
||||
var b = browserify();
|
||||
b.add('./browser/main.js');
|
||||
b.transform('deamdify');
|
||||
b.bundle().pipe(fs.createWriteStream('bundle.js'));
|
||||
/// <reference path="browserify.d.ts"/>
|
||||
|
||||
import browserify = require("browserify");
|
||||
import fs = require("fs");
|
||||
|
||||
var b: BrowserifyObject = browserify();
|
||||
b.add('./browser/main.js');
|
||||
b.transform('deamdify');
|
||||
b.bundle().pipe(fs.createWriteStream('bundle.js'));
|
||||
|
||||
var customBrowsify: Browserify = require("browserify");
|
||||
customBrowsify({entries: []});
|
||||
|
||||
Vendored
+41
-38
@@ -1,38 +1,41 @@
|
||||
// Type definitions for Browserify
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file: string): BrowserifyObject;
|
||||
require(file: string, opts?: {
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?: {
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?: (err: any, src: any) => void): NodeJS.ReadableStream;
|
||||
|
||||
external(file: string): BrowserifyObject;
|
||||
ignore(file: string): BrowserifyObject;
|
||||
transform(tr: string): BrowserifyObject;
|
||||
transform(tr: Function): BrowserifyObject;
|
||||
plugin(plugin: string, opts?: any): BrowserifyObject;
|
||||
plugin(plugin: Function, opts?: any): BrowserifyObject;
|
||||
}
|
||||
|
||||
declare module "browserify" {
|
||||
function browserify(): BrowserifyObject;
|
||||
function browserify(files: string[]): BrowserifyObject;
|
||||
function browserify(opts: {
|
||||
entries?: string[];
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
|
||||
export = browserify;
|
||||
}
|
||||
// Type definitions for Browserify
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file:string): BrowserifyObject;
|
||||
require(file:string, opts?:{
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?:{
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?:(err:any, src:any) => void): NodeJS.ReadableStream;
|
||||
|
||||
external(file:string): BrowserifyObject;
|
||||
ignore(file:string): BrowserifyObject;
|
||||
transform(tr:string): BrowserifyObject;
|
||||
transform(tr:Function): BrowserifyObject;
|
||||
plugin(plugin:string, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:Function, opts?:any): BrowserifyObject;
|
||||
}
|
||||
|
||||
interface Browserify {
|
||||
(): BrowserifyObject;
|
||||
(files:string[]): BrowserifyObject;
|
||||
(opts:{
|
||||
entries?: string[];
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
}
|
||||
|
||||
declare module "browserify" {
|
||||
var browserify: Browserify;
|
||||
export = browserify;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for buffer-equal 1.0 0
|
||||
// Type definitions for buffer-equal 0.0.1
|
||||
// Project: https://github.com/substack/node-buffer-equal
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="./bunyan-logentries.d.ts" />
|
||||
/// <reference path="../bunyan/bunyan.d.ts" />
|
||||
|
||||
import bunyan = require("bunyan");
|
||||
import bunyanLogentries = require("bunyan-logentries");
|
||||
|
||||
var logger: bunyan.Logger = bunyan.createLogger({
|
||||
name: "foobar",
|
||||
streams: [{
|
||||
level: "info",
|
||||
stream: bunyanLogentries.createStream({token: "foobar"}),
|
||||
type: "raw"
|
||||
}]
|
||||
});
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for node-bunyan-logentries v0.1.0
|
||||
// Project: https://github.com/nemtsov/node-bunyan-logentries
|
||||
// Definitions by: Aymeric Beaumet <http://aymericbeaumet.me>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bunyan/bunyan.d.ts" />
|
||||
|
||||
declare module "bunyan-logentries" {
|
||||
import bunyan = require("bunyan");
|
||||
|
||||
interface StreamOptions {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export function createStream(options: StreamOptions): NodeJS.WritableStream;
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
/// <reference path="bunyan.d.ts" />
|
||||
|
||||
import bunyan = require('bunyan');
|
||||
|
||||
var ringBufferOptions:bunyan.RingBufferOptions = {
|
||||
limit: 100
|
||||
};
|
||||
var ringBuffer:bunyan.RingBuffer = new bunyan.RingBuffer(ringBufferOptions);
|
||||
ringBuffer.write("hello");
|
||||
ringBuffer.end();
|
||||
ringBuffer.destroy();
|
||||
ringBuffer.destroySoon();
|
||||
|
||||
var level:number;
|
||||
level = bunyan.resolveLevel("trace");
|
||||
level = bunyan.resolveLevel("debug");
|
||||
level = bunyan.resolveLevel("info");
|
||||
level = bunyan.resolveLevel("warn");
|
||||
level = bunyan.resolveLevel("error");
|
||||
level = bunyan.resolveLevel("fatal");
|
||||
level = bunyan.resolveLevel(bunyan.TRACE);
|
||||
level = bunyan.resolveLevel(bunyan.DEBUG);
|
||||
level = bunyan.resolveLevel(bunyan.INFO);
|
||||
level = bunyan.resolveLevel(bunyan.WARN);
|
||||
level = bunyan.resolveLevel(bunyan.ERROR);
|
||||
level = bunyan.resolveLevel(bunyan.FATAL);
|
||||
|
||||
var options:bunyan.LoggerOptions = {
|
||||
name: 'test-logger',
|
||||
streams: [{
|
||||
type: 'stream',
|
||||
stream: process.stdout,
|
||||
level: bunyan.TRACE
|
||||
}, {
|
||||
type: 'file',
|
||||
path: '/tmp/test.log',
|
||||
level: bunyan.DEBUG,
|
||||
closeOnExit: true
|
||||
}, {
|
||||
type: 'rotating-file',
|
||||
path: '/tmp/test2.log',
|
||||
level: bunyan.INFO,
|
||||
closeOnExit: false
|
||||
}, {
|
||||
type: 'raw',
|
||||
stream: process.stderr,
|
||||
level: bunyan.WARN
|
||||
}, {
|
||||
type: 'raw',
|
||||
stream: ringBuffer,
|
||||
level: bunyan.ERROR
|
||||
}]
|
||||
};
|
||||
|
||||
var log = bunyan.createLogger(options);
|
||||
|
||||
log.addSerializers(bunyan.stdSerializers);
|
||||
var child = log.child({name: 'child'});
|
||||
child.reopenFileStreams();
|
||||
log.addStream({path: '/dev/null', name: 'stream1'});
|
||||
child.level(bunyan.DEBUG);
|
||||
child.level('debug');
|
||||
child.levels(0, bunyan.ERROR);
|
||||
child.levels(0, 'error');
|
||||
child.levels('stream1', bunyan.FATAL);
|
||||
child.levels('stream1', 'fatal');
|
||||
|
||||
var buffer = new Buffer(0);
|
||||
var error = new Error('');
|
||||
var object = {
|
||||
test: 123
|
||||
};
|
||||
|
||||
log.trace(buffer);
|
||||
log.trace(error);
|
||||
log.trace(object);
|
||||
log.trace('Hello, %s', 'world!');
|
||||
log.debug(buffer);
|
||||
log.debug(error);
|
||||
log.debug(object);
|
||||
log.debug('Hello, %s', 'world!');
|
||||
log.info(buffer);
|
||||
log.info(error);
|
||||
log.info(object);
|
||||
log.info('Hello, %s', 'world!');
|
||||
log.warn(buffer);
|
||||
log.warn(error);
|
||||
log.warn(object);
|
||||
log.warn('Hello, %s', 'world!');
|
||||
log.error(buffer);
|
||||
log.error(error);
|
||||
log.error(object);
|
||||
log.error('Hello, %s', 'world!');
|
||||
log.fatal(buffer);
|
||||
log.fatal(error);
|
||||
log.fatal(object);
|
||||
log.fatal('Hello, %s', 'world!');
|
||||
|
||||
var recursive: any = {
|
||||
hello: 'world',
|
||||
whats: {
|
||||
huh: recursive
|
||||
}
|
||||
}
|
||||
|
||||
JSON.stringify(recursive, bunyan.safeCycles());
|
||||
Vendored
+101
@@ -0,0 +1,101 @@
|
||||
// Type definitions for node-bunyan
|
||||
// Project: https://github.com/trentm/node-bunyan
|
||||
// Definitions by: Alex Mikhalev <https://github.com/amikhalev>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "bunyan" {
|
||||
import events = require('events');
|
||||
import EventEmitter = events.EventEmitter;
|
||||
import WritableStream = NodeJS.WritableStream;
|
||||
|
||||
class Logger extends EventEmitter {
|
||||
constructor(options:LoggerOptions);
|
||||
addStream(stream:Stream):void;
|
||||
addSerializers(serializers:Serializers):void;
|
||||
child(options:LoggerOptions, simple?:boolean):Logger;
|
||||
child(obj:Object, simple?:boolean):Logger;
|
||||
reopenFileStreams():void;
|
||||
|
||||
level(value:any /* number | string */):void;
|
||||
levels(name:any /* number | string */, value:any /* number | string */):void;
|
||||
|
||||
trace(error:Error, format?:any, ...params:any[]):void;
|
||||
trace(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
trace(obj:Object, format?:any, ...params:any[]):void;
|
||||
trace(format:string, ...params:any[]):void;
|
||||
debug(error:Error, format?:any, ...params:any[]):void;
|
||||
debug(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
debug(obj:Object, format?:any, ...params:any[]):void;
|
||||
debug(format:string, ...params:any[]):void;
|
||||
info(error:Error, format?:any, ...params:any[]):void;
|
||||
info(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
info(obj:Object, format?:any, ...params:any[]):void;
|
||||
info(format:string, ...params:any[]):void;
|
||||
warn(error:Error, format?:any, ...params:any[]):void;
|
||||
warn(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
warn(obj:Object, format?:any, ...params:any[]):void;
|
||||
warn(format:string, ...params:any[]):void;
|
||||
error(error:Error, format?:any, ...params:any[]):void;
|
||||
error(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
error(obj:Object, format?:any, ...params:any[]):void;
|
||||
error(format:string, ...params:any[]):void;
|
||||
fatal(error:Error, format?:any, ...params:any[]):void;
|
||||
fatal(buffer:Buffer, format?:any, ...params:any[]):void;
|
||||
fatal(obj:Object, format?:any, ...params:any[]):void;
|
||||
fatal(format:string, ...params:any[]):void;
|
||||
}
|
||||
|
||||
interface LoggerOptions {
|
||||
name: string;
|
||||
streams?: Stream[];
|
||||
level?: string;
|
||||
stream?: WritableStream;
|
||||
serializers?: Serializers;
|
||||
src?: boolean;
|
||||
}
|
||||
|
||||
interface Serializers {
|
||||
[key:string]: (input:any) => string;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
type?: string;
|
||||
level?: any; // number | string
|
||||
path?: string;
|
||||
stream?: WritableStream;
|
||||
closeOnExit?: boolean;
|
||||
}
|
||||
|
||||
export var stdSerializers:Serializers;
|
||||
|
||||
export var TRACE:number;
|
||||
export var DEBUG:number;
|
||||
export var INFO:number;
|
||||
export var WARN:number;
|
||||
export var ERROR:number;
|
||||
export var FATAL:number;
|
||||
|
||||
export function resolveLevel(value:any /* number | string */):number;
|
||||
|
||||
export function createLogger(options:LoggerOptions):Logger;
|
||||
|
||||
class RingBuffer extends EventEmitter {
|
||||
constructor(options:RingBufferOptions);
|
||||
|
||||
writable:boolean;
|
||||
records:any[];
|
||||
|
||||
write(record:any):void;
|
||||
end(record?:any):void;
|
||||
destroy():void;
|
||||
destroySoon():void;
|
||||
}
|
||||
|
||||
interface RingBufferOptions {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export function safeCycles():(key:string, value:any) => any;
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for business-rules-engine - v1.0.20
|
||||
// Type definitions for business-rules-engine v1.0.20
|
||||
// Project: https://github.com/rsamec/form
|
||||
// Definitions by: Roman Samec <https://github.com/rsamec>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
@@ -31,8 +31,8 @@ caml = new CamlBuilder().Where()
|
||||
)
|
||||
.ToString();
|
||||
|
||||
caml = new CamlBuilder().Where()
|
||||
.LookupIdField("Category").In([2, 3, 10])
|
||||
var caml = new CamlBuilder().Where()
|
||||
.LookupField("Category").Id().In([2, 3, 10])
|
||||
.And()
|
||||
.DateField("ExpirationDate").GreaterThan(CamlBuilder.CamlValues.Now)
|
||||
.OrderBy("ExpirationDate")
|
||||
|
||||
Vendored
+78
-58
@@ -4,48 +4,14 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module Sys {
|
||||
class StringBuilder {
|
||||
/** Appends a string to the string builder */
|
||||
public append(s: string): void;
|
||||
/** Appends a line to the string builder */
|
||||
public appendLine(s: string): void;
|
||||
/** Clears the contents of the string builder */
|
||||
public clear(): void;
|
||||
/** Indicates wherever the string builder is empty */
|
||||
public isEmpty(): boolean;
|
||||
/** Gets the contents of the string builder as a string */
|
||||
public toString(): string;
|
||||
}
|
||||
}
|
||||
declare module SP {
|
||||
/** Defines a writer that provides a set of methods to append text in XML format. Use the static SP.XmlWriter.create(sb) Method to create an SP.XmlWriter object with the Sys.StringBuilder object you pass in. */
|
||||
class XmlWriter {
|
||||
/** Creates a new instance of the XmlWriter class with the specified string builder. */
|
||||
static create(sb: Sys.StringBuilder): XmlWriter;
|
||||
/** Appends a start element tag with the specified name in XML format to the object?s string builder. */
|
||||
public writeStartElement(tagName: string): void;
|
||||
/** Appends an element with the specified tag name and value in XML format to the string builder. */
|
||||
public writeElementString(tagName: string, value: string): void;
|
||||
/** Appends an end element tag in XML format to the object?s string builder. This method appends the end element tag ?/>? if the start element tag is not closed; otherwise, it appends a full end element tag ?</tagName>? to the string builder. */
|
||||
public writeEndElement(): void;
|
||||
/** Appends an attribute with the specified name and value in XML format to the object?s string builder. */
|
||||
public writeAttributeString(localName: string, value: string): void;
|
||||
/** This method only appends the name of the attribute. You can append the value of the attribute by calling the SP.XmlWriter.writeString(value) Method, and close the attribute by calling the SP.XmlWriter.writeEndAttribute() Method. */
|
||||
public writeStartAttribute(localName: string): void;
|
||||
/** Appends an end of an attribute in XML format to the object?s string builder. */
|
||||
public writeEndAttribute(): void;
|
||||
/** Appends the specified value for an element tag or attribute to the object?s string builder. */
|
||||
public writeString(value: string): void;
|
||||
/** Appends the specified text to the object?s string builder. */
|
||||
public writeRaw(xml: string): void;
|
||||
/** This member is reserved for internal use and is not intended to be used directly from your code. */
|
||||
public close(): void;
|
||||
}
|
||||
}
|
||||
declare class CamlBuilder {
|
||||
constructor();
|
||||
/** Generate CAML Query, starting from <Where> tag */
|
||||
public 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;
|
||||
/** Use for:
|
||||
1. SPServices CAMLQuery attribute
|
||||
2. Creating partial expressions
|
||||
@@ -54,8 +20,40 @@ declare class CamlBuilder {
|
||||
static Expression(): CamlBuilder.IFieldExpression;
|
||||
}
|
||||
declare module CamlBuilder {
|
||||
interface IView {
|
||||
interface IView extends IJoinable, IFinalizable {
|
||||
Query(): IQuery;
|
||||
RowLimit(limit: number, paged?: boolean): IView;
|
||||
Scope(scope: ViewScope): IView;
|
||||
}
|
||||
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 */
|
||||
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 */
|
||||
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. */
|
||||
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. */
|
||||
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
|
||||
}
|
||||
enum ViewScope {
|
||||
/** */
|
||||
Recursive = 0,
|
||||
/** */
|
||||
RecursiveAll = 1,
|
||||
/** */
|
||||
FilesOnly = 2,
|
||||
}
|
||||
interface IQuery {
|
||||
Where(): IFieldExpression;
|
||||
@@ -63,6 +61,8 @@ declare module CamlBuilder {
|
||||
interface IFinalizable {
|
||||
/** Get the resulting CAML query as string */
|
||||
ToString(): string;
|
||||
/** Get the resulting CAML query as SP.CamlQuery object */
|
||||
ToCamlQuery(): any;
|
||||
}
|
||||
interface ISortable extends IFinalizable {
|
||||
/** Adds OrderBy clause to the query
|
||||
@@ -81,7 +81,7 @@ declare module CamlBuilder {
|
||||
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. */
|
||||
GroupBy(fieldInternalName): IGroupedQuery;
|
||||
GroupBy(fieldInternalName: any): IGroupedQuery;
|
||||
}
|
||||
interface IExpression extends IGroupable {
|
||||
/** Adds And clause to the query. */
|
||||
@@ -122,12 +122,10 @@ declare module CamlBuilder {
|
||||
UserField(internalName: string): IUserFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Lookup */
|
||||
LookupField(internalName: string): ILookupFieldExpression;
|
||||
/** DEPRECATED. Please use LookupField(...).Id() instead */
|
||||
LookupIdField(internalName: string): INumberFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is LookupMulti */
|
||||
LookupMultiField(internalName: string): ILookupMultiFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is UserMulti */
|
||||
UserMultiField(internalName: string): ILookupMultiFieldExpression;
|
||||
UserMultiField(internalName: string): IUserMultiFieldExpression;
|
||||
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Date */
|
||||
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 */
|
||||
@@ -289,30 +287,52 @@ declare module CamlBuilder {
|
||||
ValueAsBoolean(): IBooleanFieldExpression;
|
||||
}
|
||||
interface ILookupMultiFieldExpression {
|
||||
/** Checks whether the value of the field is equal to the specified value */
|
||||
EqualTo(value: string): IExpression;
|
||||
/** Checks whether the value of the field is not equal to the specified value */
|
||||
NotEqualTo(value: string): IExpression;
|
||||
/** Checks whether the values of the field includes the specified value */
|
||||
Includes(value): IExpression;
|
||||
/** Checks whether the values of the field not includes the specified value */
|
||||
NotIncludes(value): IExpression;
|
||||
/** Checks a condition against every item in the multi lookup value */
|
||||
IncludesSuchItemThat(): ILookupFieldExpression;
|
||||
/** Checks whether the field values collection is empty */
|
||||
IsNull(): IExpression;
|
||||
/** Checks whether the field values collection is not empty */
|
||||
IsNotNull(): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().EqualTo(value)" instead. */
|
||||
Includes(value: any): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().NotEqualTo(value)" instead. */
|
||||
NotIncludes(value: any): IExpression;
|
||||
/** DEPRECATED: "Eq" operation in CAML works exactly the same as "Includes". To avoid confusion, please use Includes. */
|
||||
EqualTo(value: any): IExpression;
|
||||
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
|
||||
NotEqualTo(value: any): IExpression;
|
||||
}
|
||||
interface IUserMultiFieldExpression {
|
||||
/** Checks a condition against every item in the multi lookup value */
|
||||
IncludesSuchItemThat(): IUserFieldExpression;
|
||||
/** Checks whether the field values collection is empty */
|
||||
IsNull(): IExpression;
|
||||
/** Checks whether the field values collection is not empty */
|
||||
IsNotNull(): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().EqualTo(value)" instead. */
|
||||
Includes(value: any): IExpression;
|
||||
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().NotEqualTo(value)" instead. */
|
||||
NotIncludes(value: any): IExpression;
|
||||
/** DEPRECATED: "Eq" operation in CAML works exactly the same as "Includes". To avoid confusion, please use Includes. */
|
||||
EqualTo(value: any): IExpression;
|
||||
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
|
||||
NotEqualTo(value: any): IExpression;
|
||||
}
|
||||
enum DateRangesOverlapType {
|
||||
/** Returns events for today */
|
||||
Now,
|
||||
Now = 0,
|
||||
/** Returns events for one day, specified by CalendarDate in QueryOptions */
|
||||
Day,
|
||||
Day = 1,
|
||||
/** Returns events for one week, specified by CalendarDate in QueryOptions */
|
||||
Week,
|
||||
Week = 2,
|
||||
/** Returns events for one month, specified by CalendarDate in QueryOptions.
|
||||
Caution: usually also returns few days from previous and next months */
|
||||
Month,
|
||||
Month = 3,
|
||||
/** Returns events for one year, specified by CalendarDate in QueryOptions */
|
||||
Year,
|
||||
Year = 4,
|
||||
}
|
||||
class Internal {
|
||||
static createView(): IView;
|
||||
static createView(viewFields?: string[]): IView;
|
||||
static createWhere(): IFieldExpression;
|
||||
static createExpression(): IFieldExpression;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for CanvasJS v1.5.1 GA
|
||||
// Type definitions for CanvasJS v1.5.1
|
||||
// Project: http://canvasjs.com/
|
||||
// Definitions by: Mark Overholt <https://github.com/mover5>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for CasperJS v1.0.0 API
|
||||
// Type definitions for CasperJS v1.0.0
|
||||
// Project: http://casperjs.org/
|
||||
// Definitions by: Jed Hunsaker <https://github.com/jedhunsaker>
|
||||
// Definitions by: Jed Mao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../phantomjs/phantomjs.d.ts" />
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for chai-fuzzy 1.3.0 assert style
|
||||
// Type definitions for chai-fuzzy 1.3.0
|
||||
// Project: http://chaijs.com/plugins/chai-fuzzy
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
Vendored
+1
@@ -94,6 +94,7 @@ declare module chai {
|
||||
that: Expect;
|
||||
and: Expect;
|
||||
have: Expect;
|
||||
has: Expect;
|
||||
with: Expect;
|
||||
at: Expect;
|
||||
of: Expect;
|
||||
|
||||
Vendored
+1
@@ -41,6 +41,7 @@ declare module Chalk {
|
||||
cyan: ChalkChain;
|
||||
white: ChalkChain;
|
||||
gray: ChalkChain;
|
||||
grey: ChalkChain;
|
||||
|
||||
// Background colors
|
||||
bgBlack: ChalkChain;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path="change-case.d.ts"/>
|
||||
|
||||
import changeCase = require("change-case");
|
||||
|
||||
var s: string;
|
||||
var b: boolean;
|
||||
|
||||
s = changeCase.dot(s);
|
||||
s = changeCase.dotCase(s);
|
||||
s = changeCase.swap(s);
|
||||
s = changeCase.swapCase(s);
|
||||
s = changeCase.path(s);
|
||||
s = changeCase.pathCase(s);
|
||||
s = changeCase.upper(s);
|
||||
s = changeCase.upperCase(s);
|
||||
s = changeCase.lower(s);
|
||||
s = changeCase.lowerCase(s);
|
||||
s = changeCase.camel(s);
|
||||
s = changeCase.camelCase(s);
|
||||
s = changeCase.snake(s);
|
||||
s = changeCase.snakeCase(s);
|
||||
s = changeCase.title(s);
|
||||
s = changeCase.titleCase(s);
|
||||
s = changeCase.param(s);
|
||||
s = changeCase.paramCase(s);
|
||||
s = changeCase.pascal(s);
|
||||
s = changeCase.pascalCase(s);
|
||||
s = changeCase.constant(s);
|
||||
s = changeCase.constantCase(s);
|
||||
s = changeCase.sentence(s);
|
||||
s = changeCase.sentenceCase(s);
|
||||
b = changeCase.isUpper(s);
|
||||
b = changeCase.isUpperCase(s);
|
||||
b = changeCase.isLower(s);
|
||||
b = changeCase.isLowerCase(s);
|
||||
s = changeCase.ucFirst(s);
|
||||
s = changeCase.upperCaseFirst(s);
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// Type definitions for change-case
|
||||
// Project: https://github.com/blakeembrey/change-case
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "change-case" {
|
||||
function dot(s: string): string;
|
||||
function dotCase(s: string): string;
|
||||
function swap(s: string): string;
|
||||
function swapCase(s: string): string;
|
||||
function path(s: string): string;
|
||||
function pathCase(s: string): string;
|
||||
function upper(s: string): string;
|
||||
function upperCase(s: string): string;
|
||||
function lower(s: string): string;
|
||||
function lowerCase(s: string): string;
|
||||
function camel(s: string): string;
|
||||
function camelCase(s: string): string;
|
||||
function snake(s: string): string;
|
||||
function snakeCase(s: string): string;
|
||||
function title(s: string): string;
|
||||
function titleCase(s: string): string;
|
||||
function param(s: string): string;
|
||||
function paramCase(s: string): string;
|
||||
function pascal(s: string): string;
|
||||
function pascalCase(s: string): string;
|
||||
function constant(s: string): string;
|
||||
function constantCase(s: string): string;
|
||||
function sentence(s: string): string;
|
||||
function sentenceCase(s: string): string;
|
||||
function isUpper(s: string): boolean;
|
||||
function isUpperCase(s: string): boolean;
|
||||
function isLower(s: string): boolean;
|
||||
function isLowerCase(s: string): boolean;
|
||||
function ucFirst(s: string): string;
|
||||
function upperCaseFirst(s: string): string;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/// <reference path="checksum.d.ts" />
|
||||
|
||||
import checksum = require("checksum");
|
||||
|
||||
var s: string = checksum("abcd");
|
||||
var t: string = checksum("abcd", { algorithm: 'sha1' });
|
||||
|
||||
checksum.file("myfile.txt", (error: Error, hash: string): void => {
|
||||
// do nothing
|
||||
});
|
||||
|
||||
checksum.file("myfile.txt", { algorithm: 'sha1' }, (error: Error, hash: string): void => {
|
||||
// do nothing
|
||||
});
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for checksum 0.1.1
|
||||
// Project: https://github.com/dshaw/checksum
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "checksum" {
|
||||
|
||||
module checksum {
|
||||
/**
|
||||
* Options object for all functions
|
||||
*/
|
||||
interface ChecksumOptions {
|
||||
/**
|
||||
* Algorithm to use, default 'sha1'
|
||||
* Can be 'sha1' or 'md5' (see module 'crypto').
|
||||
*/
|
||||
algorithm?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, callback: (error: Error, hash: string) => void): void;
|
||||
/**
|
||||
* Generate the checksum for a file on disk
|
||||
* @param filename The file name
|
||||
* @param options Options object to indicate hash algo
|
||||
* @param callback Callback which is called with the result or an error
|
||||
*/
|
||||
function file(filename: string, options: ChecksumOptions, callback: (error: Error, hash: string) => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a checksum for the given value
|
||||
* @param value Any value
|
||||
* @param options Allows to set the algorithm
|
||||
* @returns Checksum
|
||||
*/
|
||||
function checksum(value: any, options?: checksum.ChecksumOptions): string;
|
||||
|
||||
export = checksum;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import runtime = chrome.app.runtime;
|
||||
import cwindow = chrome.app.window;
|
||||
|
||||
var createOptions: cwindow.CreateOptions = {
|
||||
var createOptions: cwindow.CreateWindowOptions = {
|
||||
id: "My Window",
|
||||
bounds: {
|
||||
left: 0,
|
||||
@@ -26,6 +26,35 @@ chrome.app.runtime.onRestarted.addListener(function () { return; });
|
||||
// Get Current Window
|
||||
var currentWindow: cwindow.AppWindow = chrome.app.window.current();
|
||||
|
||||
// FileSystem
|
||||
// https://developer.chrome.com/apps/fileSystem
|
||||
|
||||
function test_fileSystem(): void {
|
||||
var accepts: chrome.fileSystem.AcceptOptions[] = [
|
||||
{mimeTypes: ["text/*"], extensions: ['js', 'css', 'txt', 'html', 'xml', 'tsv', 'csv', 'rtf']}
|
||||
];
|
||||
var chooseOption: chrome.fileSystem.ChooseEntryOptions = {
|
||||
type: "openFile",
|
||||
suggestedName: "foo.txt",
|
||||
accepts: accepts,
|
||||
acceptsAllTypes: false,
|
||||
acceptsMultiple: false
|
||||
};
|
||||
chrome.fileSystem.chooseEntry(chooseOption, (entry: Entry) => {
|
||||
chrome.fileSystem.getDisplayPath(entry, (displayPath: string) => { });
|
||||
|
||||
var retainedId = chrome.fileSystem.retainEntry(entry);
|
||||
chrome.fileSystem.isRestorable(retainedId, (isRestorable: boolean) => {
|
||||
if(isRestorable){
|
||||
chrome.fileSystem.restoreEntry(retainedId, (restoredEntry: Entry) => { });
|
||||
}
|
||||
});
|
||||
|
||||
chrome.fileSystem.getWritableEntry(entry, (writableEntry: Entry) => {});
|
||||
chrome.fileSystem.isWritableEntry(entry, (isWritable: boolean) => {});
|
||||
});
|
||||
}
|
||||
|
||||
// Sockets
|
||||
// https://developer.chrome.com/apps/sockets_tcp
|
||||
function test_socketsTcp(): void {
|
||||
|
||||
Vendored
+111
-22
@@ -1,8 +1,10 @@
|
||||
// Type definitions for Chrome packaged application development
|
||||
// Project: http://developer.chrome.com/apps/
|
||||
// Definitions by: Adam Lay <https://github.com/AdamLay>, MIZUNE Pine <https://github.com/pine613>
|
||||
// Definitions by: Adam Lay <https://github.com/AdamLay>, MIZUNE Pine <https://github.com/pine613>, MIZUSHIMA Junki <https://github.com/mzsm>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path='../filesystem/filesystem.d.ts'/>
|
||||
|
||||
////////////////////
|
||||
// App Runtime
|
||||
////////////////////
|
||||
@@ -21,11 +23,11 @@ declare module chrome.app.runtime {
|
||||
}
|
||||
|
||||
interface LaunchedEvent {
|
||||
addListener(callback: (launchData: LaunchData) => void);
|
||||
addListener(callback: (launchData: LaunchData) => void): void;
|
||||
}
|
||||
|
||||
interface RestartedEvent {
|
||||
addListener(callback: () => void);
|
||||
addListener(callback: () => void): void;
|
||||
}
|
||||
|
||||
var onLaunched: LaunchedEvent;
|
||||
@@ -36,13 +38,65 @@ declare module chrome.app.runtime {
|
||||
// App Window
|
||||
////////////////////
|
||||
declare module chrome.app.window {
|
||||
interface Bounds {
|
||||
interface ContentBounds {
|
||||
left?: number;
|
||||
top?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
interface BoundsSpecification {
|
||||
left?: number;
|
||||
top?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
}
|
||||
|
||||
interface Bounds {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
setPosition(left: number, top: number): void;
|
||||
setSize(width: number, height: number): void;
|
||||
setMinimumSize(minWidth: number, minHeight: number): void;
|
||||
setMaximumSize(maxWidth: number, maxHeight: number): void;
|
||||
}
|
||||
interface FrameOptions {
|
||||
type?: string;
|
||||
color?: string;
|
||||
activeColor?: string;
|
||||
inactiveColor?: string;
|
||||
}
|
||||
|
||||
interface CreateWindowOptions {
|
||||
id?: string;
|
||||
innerBounds?: BoundsSpecification;
|
||||
outerBounds?: BoundsSpecification;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
frame?: any; // string ("none", "chrome") or FrameOptions
|
||||
bounds?: ContentBounds;
|
||||
alphaEnabled?: boolean;
|
||||
state?: string; // "normal", "fullscreen", "maximized", "minimized"
|
||||
hidden?: boolean;
|
||||
resizable?: boolean;
|
||||
singleton?: boolean;
|
||||
alwaysOnTop?: boolean;
|
||||
focused?: boolean;
|
||||
visibleOnAllWorkspaces?: boolean;
|
||||
}
|
||||
|
||||
interface AppWindow {
|
||||
focus: () => void;
|
||||
fullscreen: () => void;
|
||||
@@ -59,27 +113,18 @@ declare module chrome.app.window {
|
||||
close: () => void;
|
||||
show: () => void;
|
||||
hide: () => void;
|
||||
getBounds: () => Bounds;
|
||||
setBounds: (bounds: Bounds) => void;
|
||||
getBounds: () => ContentBounds;
|
||||
setBounds: (bounds: ContentBounds) => void;
|
||||
isAlwaysOnTop: () => boolean;
|
||||
setAlwaysOnTop: (alwaysOnTop: boolean) => void;
|
||||
setVisibleOnAllWorkspaces: (alwaysVisible: boolean) => void;
|
||||
contentWindow: Window;
|
||||
id: string;
|
||||
innerBounds: Bounds;
|
||||
outerBounds: Bounds;
|
||||
}
|
||||
|
||||
interface CreateOptions {
|
||||
id?: string;
|
||||
minWidth?: number;
|
||||
minHeight?: number;
|
||||
maxWidth?: number;
|
||||
maxHeight?: number;
|
||||
frame?: string; // "none", "chrome"
|
||||
bounds?: Bounds;
|
||||
transparentBackground?: boolean;
|
||||
state?: string; // "normal", "fullscreen", "maximized", "minimized"
|
||||
hidden?: boolean;
|
||||
resizable?: boolean;
|
||||
singleton?: boolean;
|
||||
}
|
||||
|
||||
export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void;
|
||||
export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void;
|
||||
export function current(): AppWindow;
|
||||
|
||||
interface WindowEvent {
|
||||
@@ -94,6 +139,50 @@ declare module chrome.app.window {
|
||||
var onRestored: WindowEvent;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// fileSystem
|
||||
////////////////////
|
||||
declare module chrome.fileSystem {
|
||||
|
||||
interface ChildChangeInfo {
|
||||
entry: Entry;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface EntryChangedEvent {
|
||||
target: Entry;
|
||||
childChanges?: ChildChangeInfo[];
|
||||
}
|
||||
|
||||
interface EntryRemovedEvent {
|
||||
target: Entry;
|
||||
}
|
||||
|
||||
interface AcceptOptions {
|
||||
description?: string;
|
||||
mimeTypes?: string[];
|
||||
extensions?: string[];
|
||||
}
|
||||
|
||||
interface ChooseEntryOptions {
|
||||
type?: string;
|
||||
suggestedName?: string;
|
||||
accepts?: AcceptOptions[];
|
||||
acceptsAllTypes?: boolean;
|
||||
acceptsMultiple?: boolean;
|
||||
}
|
||||
|
||||
export function getDisplayPath(entry: Entry, callback: (displayPath: string) => void): void;
|
||||
export function getWritableEntry(entry: Entry, callback: (entry: Entry) => void): void;
|
||||
export function isWritableEntry(entry: Entry, callback: (isWritable: boolean) => void): void;
|
||||
export function chooseEntry(callback: (entry: Entry) => void): void;
|
||||
export function chooseEntry(callback: (fileEntries: FileEntry[]) => void): void;
|
||||
export function chooseEntry(options: ChooseEntryOptions, callback: (entry: Entry) => void): void;
|
||||
export function chooseEntry(options: ChooseEntryOptions, callback: (fileEntries: FileEntry[]) => void): void;
|
||||
export function restoreEntry(id: string, callback: (entry: Entry) => void): void;
|
||||
export function isRestorable(id: string, callback: (isRestorable: boolean) => void): void;
|
||||
export function retainEntry(entry: Entry): string;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Sockets
|
||||
|
||||
+22
-1
@@ -152,4 +152,25 @@ function printPage() {
|
||||
var action_url = "javascript:window.print();";
|
||||
chrome.tabs.update(tab.id, { url: action_url });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// https://developer.chrome.com/extensions/examples/extensions/catblock/background.js
|
||||
function catBlock () {
|
||||
var loldogs: string[];
|
||||
chrome.webRequest.onBeforeRequest.addListener(
|
||||
function(info) {
|
||||
console.log("Cat intercepted: " + info.url);
|
||||
// Redirect the lolcal request to a random loldog URL.
|
||||
var i = Math.round(Math.random() * loldogs.length);
|
||||
return {redirectUrl: loldogs[i]};
|
||||
},
|
||||
// filters
|
||||
{
|
||||
urls: [
|
||||
"https://i.chzbgr.com/*"
|
||||
],
|
||||
types: ["image"]
|
||||
},
|
||||
// extraInfoSpec
|
||||
["blocking"]);
|
||||
}
|
||||
|
||||
Vendored
+22
-12
@@ -1053,6 +1053,7 @@ declare module chrome.identity {
|
||||
declare module chrome.i18n {
|
||||
export function getMessage(messageName: string, substitutions?: any): string;
|
||||
export function getAcceptLanguages(callback: (languages: string[]) => void): void;
|
||||
export function getUILanguage(): string;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -1616,8 +1617,8 @@ declare module chrome.runtime {
|
||||
var onStartup: RuntimeStartupEvent;
|
||||
var onInstalled: RuntimeInstalledEvent;
|
||||
var onSuspendCanceled: RuntimeSuspendCanceledEvent;
|
||||
var onMessage: RuntimeMessageEvent;
|
||||
var onMessageExternal: RuntimeMessageEvent;
|
||||
var onMessage: ExtensionMessageEvent;
|
||||
var onMessageExternal: ExtensionMessageExternalEvent;
|
||||
var onRestartRequired: RuntimeRestartRequiredEvent;
|
||||
var onUpdateAvailable: RuntimeUpdateAvailableEvent;
|
||||
|
||||
@@ -1948,7 +1949,7 @@ declare module chrome.tabs {
|
||||
export function reload(tabId?: number, reloadProperties?: ReloadProperties, func?: Function): void;
|
||||
export function duplicate(tabId: number, callback?: (tab?: Tab) => void): void;
|
||||
export function sendMessage(tabId: number, message: any, responseCallback?: (response: any) => void): void;
|
||||
export function connect(tabId: number, connectInfo?: ConnectInfo): void;
|
||||
export function connect(tabId: number, connectInfo?: ConnectInfo): runtime.Port;
|
||||
export function insertCSS(tabId: number, details: InjectDetails, callback?: Function): void;
|
||||
export function highlight(highlightInfo: HighlightInfo, callback: (window: chrome.windows.Window) => void): void;
|
||||
export function query(queryInfo: QueryInfo, callback: (result: Tab[]) => void): void;
|
||||
@@ -2247,7 +2248,7 @@ declare module chrome.webRequest {
|
||||
|
||||
interface RequestFilter {
|
||||
tabId?: number;
|
||||
types?: string;
|
||||
types?: string[];
|
||||
urls: string[];
|
||||
windowId?: number;
|
||||
}
|
||||
@@ -2395,39 +2396,48 @@ declare module chrome.webRequest {
|
||||
}
|
||||
|
||||
interface WebRequestCompletedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnCompletedDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnCompletedDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnCompletedDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestHeadersReceivedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnHeadersReceivedDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnHeadersReceivedDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnHeadersReceivedDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestBeforeRedirectEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnBeforeRedirectDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnBeforeRedirectDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnBeforeRedirectDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestAuthRequiredEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]) => void): void;
|
||||
removeListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void): void;
|
||||
}
|
||||
|
||||
interface WebRequestBeforeSendHeadersEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnBeforeSendHeadersDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnBeforeSendHeadersDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnBeforeSendHeadersDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestErrorOccurredEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnErrorOccurredDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnErrorOccurredDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnErrorOccurredDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestResponseStartedEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnResponseStartedDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnResponseStartedDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnResponseStartedDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestSendHeadersEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnSendHeadersDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnSendHeadersDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnSendHeadersDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
interface WebRequestBeforeRequestEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: OnBeforeRequestDetails) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
addListener(callback: (details: OnBeforeRequestDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void;
|
||||
removeListener(callback: (details: OnBeforeRequestDetails) => BlockingResponse): void;
|
||||
}
|
||||
|
||||
var MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: number;
|
||||
|
||||
@@ -251,4 +251,53 @@ function test_dom_window() {
|
||||
var size = win.getViewPaneSize();
|
||||
alert(size.width);
|
||||
alert(size.height);
|
||||
}
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_path() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', this.path + 'dialogs/abbr.js' );
|
||||
}
|
||||
|
||||
function test_adding_dialog_by_definition() {
|
||||
CKEDITOR.dialog.add( 'abbrDialog', function ( editor: CKEDITOR.editor ) {
|
||||
return {
|
||||
title: 'Abbreviation Properties',
|
||||
minWidth: 400,
|
||||
minHeight: 200,
|
||||
|
||||
contents: [
|
||||
{
|
||||
id: 'tab-basic',
|
||||
label: 'Basic Settings',
|
||||
elements: <any[]>[]
|
||||
},
|
||||
{
|
||||
id: 'tab-adv',
|
||||
label: 'Advanced Settings',
|
||||
elements: []
|
||||
}
|
||||
]
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_plugin() {
|
||||
CKEDITOR.plugins.add( 'abbr', {
|
||||
icons: 'abbr',
|
||||
init: function( editor: CKEDITOR.editor ) {
|
||||
// empty logic
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function test_adding_widget() {
|
||||
function wrapper(editor: CKEDITOR.editor) {
|
||||
editor.widgets.add("widgetty", {
|
||||
button: "Activate widgetty",
|
||||
template: "<imaginary-element>",
|
||||
dialog: "widgetty",
|
||||
init: function() {
|
||||
// no logic
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+178
-6
@@ -9,6 +9,7 @@ declare module CKEDITOR {
|
||||
|
||||
// Config options
|
||||
var disableAutoInline: boolean;
|
||||
var disableObjectResizing: boolean;
|
||||
var replaceClass: string;
|
||||
var skinName: string;
|
||||
|
||||
@@ -549,11 +550,28 @@ declare module CKEDITOR {
|
||||
|
||||
}
|
||||
|
||||
interface toolbarGroups {
|
||||
name?: string;
|
||||
groups?: string[];
|
||||
}
|
||||
|
||||
interface config {
|
||||
startupMode: string;
|
||||
removeButtons: string;
|
||||
startupMode?: string;
|
||||
removeButtons?: string;
|
||||
removePlugins?: string;
|
||||
toolbar?: any;
|
||||
toolbarGroups?: toolbarGroups[];
|
||||
skin?: string;
|
||||
language?: string;
|
||||
plugins?: string;
|
||||
font_names?: string;
|
||||
font_defaultLabel?: string;
|
||||
fontSize_sizes?: string;
|
||||
fontSize_defaultLabel?: string;
|
||||
colorButton_enableMore?: boolean;
|
||||
colorButton_colors?: string;
|
||||
startupFocus?: boolean;
|
||||
on?: any;
|
||||
}
|
||||
|
||||
|
||||
@@ -602,11 +620,134 @@ declare module CKEDITOR {
|
||||
|
||||
|
||||
module widget {
|
||||
class repository {
|
||||
interface IWidget {
|
||||
allowedContent: any;
|
||||
button: string;
|
||||
contentForms: Object;
|
||||
contentTransformations: Object;
|
||||
data: Function;
|
||||
defaults: Object;
|
||||
dialog: String;
|
||||
downcast: any; // should be string | Function
|
||||
downcasts: Object;
|
||||
draggable: boolean;
|
||||
editables: Object;
|
||||
init: Function;
|
||||
inline: Boolean;
|
||||
insert: Function;
|
||||
mask: Boolean;
|
||||
name: String;
|
||||
parts: Object;
|
||||
pathName: string;
|
||||
requiredContent: any;
|
||||
styleToAllowedContentRules: Function;
|
||||
styleableElements: string;
|
||||
template: string;
|
||||
upcast: any; // should be string | Function
|
||||
upcasts: Object;
|
||||
|
||||
addClass(className: string): void;
|
||||
applyStyle(style: any): void; // any should be CKEDITOR.style
|
||||
capture(): void;
|
||||
checkStyleActive(style: any): boolean; // any should be CKEDITOR.style
|
||||
define(name: string, meta: {errorProof?: boolean}): void;
|
||||
destroy(offline?: boolean): void;
|
||||
destroyEditable(editableName:string, offline?: boolean): void;
|
||||
edit(): boolean;
|
||||
fire(eventName: string, data?: Object, editor?: editor): any; // should be boolean | Object
|
||||
fireOnce(eventName: string, data?: Object, editor?: editor): any; // should be boolean | Object
|
||||
focus(): void;
|
||||
getClasses(): Object;
|
||||
hasClass(className: string, Whether: boolean): void;
|
||||
hasListeners(eventName: string): boolean;
|
||||
initEditable(editableName: string, definition: any): boolean; // any should be CKEDITOR.plugins.widget.nestedEditable.definition
|
||||
isInited(): boolean;
|
||||
isReady(): boolean;
|
||||
on(eventName: string, listenerFunction: Function,
|
||||
scopeObj: Object, listenerData: Object, priority: number): Object;
|
||||
once(): void;
|
||||
removeAllListeners(): void;
|
||||
removeClass(className: string): void;
|
||||
removeListener(evnetName: string, listenerFunction: Function): void;
|
||||
removeStyle(style: any): void; // any should be CKEDITOR.style
|
||||
setData(keyOrData: any, value?: Object): IWidget; // any should be string | Object
|
||||
setFocused(selected: boolean): IWidget;
|
||||
setSelected(selected: boolean): IWidget;
|
||||
toFeature(): any; // should be CKEDITOR.feature
|
||||
updateDragHandlerPosition(): void;
|
||||
}
|
||||
|
||||
interface IWidgetDefinition {
|
||||
allowedContent?: any;
|
||||
button?: string;
|
||||
contentForms?: Object;
|
||||
contentTransformations?: Object;
|
||||
data?: Function;
|
||||
defaults?: Object;
|
||||
dialog?: String;
|
||||
downcast?: any; // should be string | Function
|
||||
downcasts?: Object;
|
||||
draggable?: boolean;
|
||||
edit?: Function;
|
||||
editables?: Object;
|
||||
init?: Function;
|
||||
inline?: Boolean;
|
||||
insert?: Function;
|
||||
mask?: Boolean;
|
||||
name?: String;
|
||||
parts?: Object;
|
||||
pathName?: string;
|
||||
requiredContent?: any;
|
||||
styleToAllowedContentRules?: Function;
|
||||
styleableElements?: string;
|
||||
template?: string;
|
||||
upcast?: any; // should be string | Function
|
||||
upcasts?: Object;
|
||||
toFeature?(): any; // should be CKEDITOR.feature
|
||||
}
|
||||
|
||||
class repository {
|
||||
add(name: string, widgetDef: IWidgetDefinition): void;
|
||||
addUpcastCallback(callback: Function): void;
|
||||
capture(): void;
|
||||
checkSelection(): void;
|
||||
checkWidgets(options?: {initOnlyNew?: boolean; focusInited?: boolean}): void;
|
||||
define(name: string, meta?: {errorProof?: boolean}): void;
|
||||
del(widget: IWidget): void;
|
||||
destroy(widget: IWidget, offline?: boolean): void;
|
||||
destroyAll(offline?: boolean): void;
|
||||
finalizeCreation(container: any): void;
|
||||
fire(eventName: string, data: Object, editor: editor): any; // should be boolean | Object
|
||||
getByElement(element: any, checkWrapperOnly: boolean): IWidget;
|
||||
hasListeners(eventName: string): boolean;
|
||||
initOn(element: any, widgetDef?: IWidgetDefinition, startupData?: Object): IWidget;
|
||||
initOnAll(container?: any): IWidget[];
|
||||
on(eventName: string, listenerFunction: Function, scopeObj?: Object, listenerData?: Object, priority?: number): Object;
|
||||
once(): void;
|
||||
parseElementClasses(classes: string): Object;
|
||||
removeAllListeners(eventName: string, listenerFunction: Function): void;
|
||||
wrapElement(element: any, widgetName?: string): any;
|
||||
}
|
||||
}
|
||||
|
||||
interface IPluginDefinition {
|
||||
hidpi?: boolean;
|
||||
lang?: any; // should be string | string[]
|
||||
requires?: any; // should be string | string[]a
|
||||
afterInit?(editor: editor): any;
|
||||
beforeInit?(editor: editor): any;
|
||||
init?(editor: editor): any;
|
||||
onLoad?(): any;
|
||||
}
|
||||
|
||||
function add(name: string, definition?: IPluginDefinition): void;
|
||||
function addExternal(name: string, path: string, fileName: string): void;
|
||||
function get(name: string): any;
|
||||
function getFilePath(name: string): string;
|
||||
function getPath(name: string): string;
|
||||
function load(name: string, callback: string, scope: any): void;
|
||||
function setLang(pluginName: string, languageCode: string, languageEntries: any): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -666,7 +807,7 @@ declare module CKEDITOR {
|
||||
getClipboardData(options: Object, callback: Function): void;
|
||||
getColorFromDialog(callback: Function, scope?: Object): void;
|
||||
getCommand(commandName: string): command;
|
||||
getData(noEvents: Object): string;
|
||||
getData(noEvents?: Object): string;
|
||||
getMenuItem(name: string): Object;
|
||||
getResizable(forContents: boolean): dom.element;
|
||||
getSelection(forceRealSelection?: boolean): dom.selection;
|
||||
@@ -695,7 +836,7 @@ declare module CKEDITOR {
|
||||
selectionChange(checkNow?: boolean): void;
|
||||
setActiveEnterMode(enterMode: number, shiftEnterMode: number): void;
|
||||
setActiveFilter(filter: filter): void;
|
||||
setData(data: string, callback: Function, internal: boolean): void;
|
||||
setData(data: string, options?: { internal?: boolean; callback?: Function; noSnapshot?: boolean; }): void;
|
||||
setKeystroke(keystroke: number, behavior?: string): void;
|
||||
setKeystroke(keystroke: any[], behavior?: string): void;
|
||||
setKeystroke(keystroke: number, behavior?: boolean): void;
|
||||
@@ -951,4 +1092,35 @@ declare module CKEDITOR {
|
||||
addFocusable(element: CKEDITOR.dom.element, index: number): void;
|
||||
}
|
||||
|
||||
}
|
||||
module tools {
|
||||
var callFunction: Function;
|
||||
}
|
||||
|
||||
module dialog {
|
||||
interface IDialogDefinition {
|
||||
buttons?: any[];
|
||||
contents?: any[];
|
||||
height?: number;
|
||||
minHeight?: number;
|
||||
minWidth?: number;
|
||||
onCancel?: Function;
|
||||
onLoad?: Function;
|
||||
onOk?: Function;
|
||||
onShow?: Function;
|
||||
resizable?: number;
|
||||
title?: string;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
function add(name: string, path: string): void;
|
||||
function add(name: string, dialogDefinition: IDialogDefinition): void;
|
||||
function addIframe(name: string, title: string, minWidth: number,
|
||||
minHeight: number, onContentLoad: Function, userDefinition: any): void;
|
||||
function addUIElement(typeName: string, builder: Function): void;
|
||||
function cancelButton(): void;
|
||||
function exists(name: string): void;
|
||||
function getCurrent(): void;
|
||||
function isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean;
|
||||
function okButton(): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@ var original = {
|
||||
|
||||
var copy = clone(original);
|
||||
copy = clone(original, false);
|
||||
copy = clone(original, true);
|
||||
copy = clone(original, true, 1);
|
||||
copy = clone.clonePrototype(original);
|
||||
|
||||
Vendored
+11
-3
@@ -8,10 +8,18 @@
|
||||
*/
|
||||
declare module "clone" {
|
||||
/**
|
||||
* @param parent
|
||||
* @param circular If not given, defaults to true in JS lib.
|
||||
* @param val the value that you want to clone, any type allowed
|
||||
* @param circular Call clone with circular set to false if you are certain that obj contains no circular references. This will give better performance if needed. There is no error if undefined or null is passed as obj.
|
||||
* @param depth to wich the object is to be cloned (optional, defaults to infinity)
|
||||
*/
|
||||
function clone(parent: Object, circular?: boolean): Object
|
||||
function clone<T>(val: T, circular?: boolean, depth?: number): T;
|
||||
|
||||
module clone {
|
||||
/**
|
||||
* @param obj the object that you want to clone
|
||||
*/
|
||||
function clonePrototype<T>(obj: T): T;
|
||||
}
|
||||
|
||||
export = clone
|
||||
}
|
||||
|
||||
@@ -1,50 +1,100 @@
|
||||
///<reference path="commander.d.ts"/>
|
||||
|
||||
//
|
||||
// TODO: improve tests
|
||||
// [the code below was extracted from the documentation and examples, but does not seem to cover all cases]
|
||||
//
|
||||
// NOTE: import statement can not use in TypeScript 1.0.1
|
||||
var program:commander.IExportedCommand = require('commander');
|
||||
|
||||
import program = require("commander");
|
||||
declare module commander {
|
||||
interface IExportedCommand {
|
||||
peppers:boolean;
|
||||
pineapple:boolean;
|
||||
bbq:boolean;
|
||||
cheese:string;
|
||||
}
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path [./deploy.conf]')
|
||||
.option('-T, --no-tests', 'ignore test hook')
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbq) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
|
||||
function range(val:string) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val:string) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val:string, memo:string[]) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v:any, total:number) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
declare module commander {
|
||||
interface IExportedCommand {
|
||||
integer:number;
|
||||
float:number;
|
||||
optional:string;
|
||||
range:number[];
|
||||
list:string[];
|
||||
collect:string[];
|
||||
verbose:number;
|
||||
}
|
||||
}
|
||||
|
||||
// $ deploy setup stage
|
||||
// $ deploy setup
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.action(function (env?) {
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s)', env);
|
||||
});
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
|
||||
|
||||
// $ deploy stage
|
||||
// $ deploy production
|
||||
program
|
||||
.command('*')
|
||||
.action(function (env?) {
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
program.option('-p, --pepper', 'add pepper');
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.option('-C, --chdir <path>', 'change the working directory');
|
||||
|
||||
program.prompt('Username: ', function (name) {
|
||||
console.log('hi %s', name);
|
||||
program.on('--help', () => {
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.prompt('Description:', function (desc) {
|
||||
console.log('description was "%s"', desc.trim());
|
||||
});
|
||||
program.parse(process.argv);
|
||||
|
||||
program.promptForNumber("Enter a number:", (n) => { });
|
||||
|
||||
program.confirm("Confirm? ", (f) => { });
|
||||
|
||||
program.choose(["a", "b", "c"], (i) => { });
|
||||
console.log('stuff');
|
||||
|
||||
Vendored
+383
-209
@@ -1,228 +1,402 @@
|
||||
// Type definitions for commanderjs 1.1.1
|
||||
// Type definitions for commanderjs 2.3.0
|
||||
// Project: https://github.com/visionmedia/commander.js
|
||||
// Definitions by: Marcelo Dezem <http://github.com/mdezem>
|
||||
// Definitions by: Marcelo Dezem <http://github.com/mdezem>, vvakame <http://github.com/vvakame>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "commander" {
|
||||
export interface Command {
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module commander {
|
||||
interface ICommandStatic {
|
||||
/**
|
||||
* The command name.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
//
|
||||
//
|
||||
// NOTE: the methods below are COPIED to the module
|
||||
// as functions exports. If changes need to be made here,
|
||||
// remember to re-paste the definitions in the module.
|
||||
// Read below to know why such ugly thing is required.
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Register callback fn for the command.
|
||||
*/
|
||||
action(fn: (...args: any[]) => any): Command;
|
||||
|
||||
/**
|
||||
* Define option with flags, description and optional coercion function and default value.
|
||||
* The flags string should contain both the short and long flags
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when --help is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @param flags the option flags.
|
||||
* @param description the option description. The description is printed when "--help" is used.
|
||||
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
|
||||
* @param defaultValue (optional) specifies a default value.
|
||||
*/
|
||||
option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command version
|
||||
*/
|
||||
version(version: string): Command;
|
||||
|
||||
/**
|
||||
* Parse the arguments array and invokes the commands passing the parsed options.
|
||||
* @param argv the arguments array.
|
||||
*/
|
||||
parse(argv: string[]): Command;
|
||||
|
||||
/**
|
||||
* Gets or sets the command description.
|
||||
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
|
||||
*/
|
||||
description(description: string): Command;
|
||||
description(): string;
|
||||
|
||||
/**
|
||||
* Gets or sets the usage help string.
|
||||
*/
|
||||
usage(usage: string): Command;
|
||||
usage(): string;
|
||||
|
||||
/*
|
||||
* Prompt the user for a value, calling the callback function.
|
||||
*
|
||||
* Supports single-line and multi-line prompts.
|
||||
* To issue a single-line prompt simply add a whitespace
|
||||
* to the end of label, something like "name: ", whereas
|
||||
* for a multi-line prompt omit this "description:".
|
||||
* @param label the label string to be printed in console.
|
||||
* @param callback a callback function to handle the inputed string.
|
||||
*/
|
||||
prompt(label: string, callback: (value: string) => any): void;
|
||||
|
||||
promptForNumber(label: string, callback: (value: number) => any): void;
|
||||
promptForDate(label: string, callback: (value: Date) => any): void;
|
||||
promptSingleLine(label: string, callback: (value: string) => any): void;
|
||||
promptMultiLine(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with a label, a optional mask char and callback function.
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
password(label: string, mask: string, callback: (value: string) => any): void;
|
||||
password(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompts the user for a confirmation.
|
||||
*/
|
||||
confirm(label: string, callback: (flag: boolean) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with str, mask char and callback fn(val).
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
choose(options: string[], callback: (idx: number) => any): void;
|
||||
choose(options: any[], callback: (idx: number) => any): void;
|
||||
|
||||
/**
|
||||
* Add command with the specified name. Returns a new instance of Command.
|
||||
*
|
||||
* The .action() callback is invoked when the
|
||||
* command name is specified via ARGV,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
|
||||
* When the name is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of ARGV remaining.
|
||||
*
|
||||
* @param name the name of the command. Pass "*" to trap un-matched commands.
|
||||
*/
|
||||
command(name: string): Command;
|
||||
* Initialize a new `Command`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api public
|
||||
*/
|
||||
new (name?:string):ICommand;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// since TypeScript (and ECMA6) does not supports module.exports,
|
||||
// there is no way to set the default Command instance as the module itself.
|
||||
// It's ugly but the only way is to copy all the methods from Command
|
||||
// and paste it in the module as functions exports.
|
||||
//
|
||||
//
|
||||
interface ICommand extends NodeJS.EventEmitter {
|
||||
args: string[];
|
||||
_args: { required:boolean; name: string; }[];
|
||||
|
||||
/**
|
||||
* Register callback fn for the command.
|
||||
*/
|
||||
export function action(fn: (...args: any[]) => any): Command;
|
||||
/**
|
||||
* Add command `name`.
|
||||
*
|
||||
* The `.action()` callback is invoked when the
|
||||
* command `name` is specified via __ARGV__,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
*
|
||||
* When the `name` is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of __ARGV__ remaining.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .version('0.0.1')
|
||||
* .option('-C, --chdir <path>', 'change the working directory')
|
||||
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
* .option('-T, --no-tests', 'ignore test hook')
|
||||
*
|
||||
* program
|
||||
* .command('setup')
|
||||
* .description('run remote setup commands')
|
||||
* .action(function(){
|
||||
* console.log('setup');
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('exec <cmd>')
|
||||
* .description('run the given remote command')
|
||||
* .action(function(cmd){
|
||||
* console.log('exec "%s"', cmd);
|
||||
* });
|
||||
*
|
||||
* program
|
||||
* .command('*')
|
||||
* .description('deploy the given env')
|
||||
* .action(function(env){
|
||||
* console.log('deploying "%s"', env);
|
||||
* });
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} [desc]
|
||||
* @return {Command} the new command
|
||||
* @api public
|
||||
*/
|
||||
command(name:string, desc?:string):ICommand;
|
||||
|
||||
/**
|
||||
* Define option with flags, description and optional coercion function and default value.
|
||||
* The flags string should contain both the short and long flags
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when --help is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @param flags the option flags.
|
||||
* @param description the option description. The description is printed when "--help" is used.
|
||||
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
|
||||
* @param defaultValue (optional) specifies a default value.
|
||||
*/
|
||||
export function option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;
|
||||
/**
|
||||
* Add an implicit `help [cmd]` subcommand
|
||||
* which invokes `--help` for the given command.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
addImplicitHelpCommand():void;
|
||||
|
||||
/**
|
||||
* Parse expected `args`.
|
||||
*
|
||||
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
parseExpectedArgs(args:string[]):ICommand;
|
||||
|
||||
/**
|
||||
* Sets the command version
|
||||
*/
|
||||
export function version(version: string): Command;
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function(){
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
action(fn:(...args:any[])=>void):ICommand;
|
||||
|
||||
/**
|
||||
* Parse the arguments array and invokes the commands passing the parsed options.
|
||||
* @param argv the arguments array.
|
||||
*/
|
||||
export function parse(argv: string[]): Command;
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @param {Function|Mixed} fn or default
|
||||
* @param {Mixed} defaultValue
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
option(flags:string, description?:string, fn?:(arg1:any, arg2:any)=>void, defaultValue?:any):ICommand;
|
||||
option(flags:string, description?:string, defaultValue?:any):ICommand;
|
||||
|
||||
/**
|
||||
* Gets or sets the command description.
|
||||
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
|
||||
*/
|
||||
export function description(description: string): Command;
|
||||
export function description(): string;
|
||||
/**
|
||||
* Parse `argv`, settings options and invoking commands when defined.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
parse(argv:string[]):ICommand;
|
||||
|
||||
/**
|
||||
* Gets or sets the usage help string.
|
||||
*/
|
||||
export function usage(usage: string): Command;
|
||||
export function usage(): string;
|
||||
/**
|
||||
* Execute a sub-command executable.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @param {Array} args
|
||||
* @param {Array} unknown
|
||||
* @api private
|
||||
*/
|
||||
executeSubCommand(argv:string[], args:string[], unknown:string[]):any; /* child_process.ChildProcess */
|
||||
|
||||
/*
|
||||
* Prompt the user for a value, calling the callback function.
|
||||
*
|
||||
* Supports single-line and multi-line prompts.
|
||||
* To issue a single-line prompt simply add a whitespace
|
||||
* to the end of label, something like "name: ", whereas
|
||||
* for a multi-line prompt omit this "description:".
|
||||
* @param label the label string to be printed in console.
|
||||
* @param callback a callback function to handle the inputed string.
|
||||
*/
|
||||
export function prompt(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Normalize `args`, splitting joined short flags. For example
|
||||
* the arg "-abc" is equivalent to "-a -b -c".
|
||||
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Array}
|
||||
* @api private
|
||||
*/
|
||||
normalize(args:string[]):string[];
|
||||
|
||||
export function promptForNumber(label: string, callback: (value: number) => any): void;
|
||||
export function promptForDate(label: string, callback: (value: Date) => any): void;
|
||||
export function promptSingleLine(label: string, callback: (value: string) => any): void;
|
||||
export function promptMultiLine(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Prompt for password with a label, a optional mask char and callback function.
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
export function password(label: string, mask: string, callback: (value: string) => any): void;
|
||||
export function password(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Parse command `args`.
|
||||
*
|
||||
* When listener(s) are available those
|
||||
* callbacks are invoked, otherwise the "*"
|
||||
* event is emitted and those actions are invoked.
|
||||
*
|
||||
* @param {Array} args
|
||||
* @return {Command} for chaining
|
||||
* @api private
|
||||
*/
|
||||
parseArgs(args:string[], unknown:string[]):ICommand;
|
||||
|
||||
/**
|
||||
* Prompts the user for a confirmation.
|
||||
*/
|
||||
export function confirm(label: string, callback: (flag: boolean) => any): void;
|
||||
/**
|
||||
* Return an option matching `arg` if any.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Option}
|
||||
* @api private
|
||||
*/
|
||||
optionFor(arg:string):IOption;
|
||||
|
||||
/**
|
||||
* Prompt for password with str, mask char and callback fn(val).
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
export function choose(options: string[], callback: (idx: number) => any): void;
|
||||
export function choose(options: any[], callback: (idx: number) => any): void;
|
||||
/**
|
||||
* Parse options from `argv` returning `argv`
|
||||
* void of these options.
|
||||
*
|
||||
* @param {Array} argv
|
||||
* @return {Array}
|
||||
* @api public
|
||||
*/
|
||||
parseOptions(argv:string[]): {args:string[]; unknown:string[];};
|
||||
|
||||
/**
|
||||
* Add command with the specified name. Returns a new instance of Command.
|
||||
*
|
||||
* The .action() callback is invoked when the
|
||||
* command name is specified via ARGV,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
/**
|
||||
* Return an object containing options as key-value pairs
|
||||
*
|
||||
* @return {Object}
|
||||
* @api public
|
||||
*/
|
||||
opts():any;
|
||||
|
||||
* When the name is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of ARGV remaining.
|
||||
*
|
||||
* @param name the name of the command. Pass "*" to trap un-matched commands.
|
||||
*/
|
||||
export function command(name: string): Command;
|
||||
}
|
||||
/**
|
||||
* Argument `name` is missing.
|
||||
*
|
||||
* @param {String} name
|
||||
* @api private
|
||||
*/
|
||||
missingArgument(name:string):void;
|
||||
|
||||
/**
|
||||
* `Option` is missing an argument, but received `flag` or nothing.
|
||||
*
|
||||
* @param {String} option
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
optionMissingArgument(option:{flags:string;}, flag?:string):void;
|
||||
|
||||
/**
|
||||
* Unknown option `flag`.
|
||||
*
|
||||
* @param {String} flag
|
||||
* @api private
|
||||
*/
|
||||
unknownOption(flag:string):void;
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* @param {String} str
|
||||
* @param {String} flags
|
||||
* @return {Command} for chaining
|
||||
* @api public
|
||||
*/
|
||||
version(str:string, flags?:string):ICommand;
|
||||
|
||||
/**
|
||||
* Set the description to `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
description(str:string):ICommand;
|
||||
description():string;
|
||||
|
||||
/**
|
||||
* Set an alias for the command
|
||||
*
|
||||
* @param {String} alias
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
alias(alias:string):ICommand;
|
||||
alias():string;
|
||||
|
||||
/**
|
||||
* Set / get the command usage `str`.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
usage(str:string):ICommand;
|
||||
usage():string;
|
||||
|
||||
/**
|
||||
* Get the name of the command
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {String|Command}
|
||||
* @api public
|
||||
*/
|
||||
name():string;
|
||||
|
||||
/**
|
||||
* Return the largest option length.
|
||||
*
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
largestOptionLength():number;
|
||||
|
||||
/**
|
||||
* Return help for options.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
optionHelp():string;
|
||||
|
||||
/**
|
||||
* Return command help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
commandHelp():string;
|
||||
|
||||
/**
|
||||
* Return program help documentation.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
helpInformation():string;
|
||||
|
||||
/**
|
||||
* Output help information for this command
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
outputHelp():void;
|
||||
|
||||
/**
|
||||
* Output help information and exit.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
help():void;
|
||||
}
|
||||
|
||||
interface IOptionStatic {
|
||||
/**
|
||||
* Initialize a new `Option` with the given `flags` and `description`.
|
||||
*
|
||||
* @param {String} flags
|
||||
* @param {String} description
|
||||
* @api public
|
||||
*/
|
||||
new (flags:string, description?:string):IOption;
|
||||
}
|
||||
|
||||
interface IOption {
|
||||
flags:string;
|
||||
required:boolean;
|
||||
optional:boolean;
|
||||
bool:boolean;
|
||||
short?:string;
|
||||
long:string;
|
||||
description:string;
|
||||
|
||||
/**
|
||||
* Return option name.
|
||||
*
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
name():string;
|
||||
|
||||
/**
|
||||
* Check if `arg` matches the short or long flag.
|
||||
*
|
||||
* @param {String} arg
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
is(arg:string):boolean;
|
||||
}
|
||||
|
||||
interface IExportedCommand extends ICommand {
|
||||
Command: commander.ICommandStatic;
|
||||
Option: commander.IOptionStatic;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "commander" {
|
||||
var _tmp:commander.IExportedCommand;
|
||||
export = _tmp;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/// <reference path="content-type.d.ts" />
|
||||
|
||||
import MediaType = require('content-type');
|
||||
|
||||
// https://github.com/deoxxa/content-type/blob/master/README.md
|
||||
function new_test(): void {
|
||||
var p = new MediaType('text/html;level=1;q=0.5');
|
||||
p.q === 0.5;
|
||||
p.params.level === "1";
|
||||
|
||||
var q = new MediaType('application/json', { profile: 'http://example.com/schema.json' });
|
||||
q.type === "application/json";
|
||||
q.params.profile === "http://example.com/schema.json";
|
||||
|
||||
q.q = 1;
|
||||
q.toString() === 'application/json;q=1;profile="http://example.com/schema.json"';
|
||||
}
|
||||
|
||||
function mediaCmp_test(): void {
|
||||
MediaType.mediaCmp(MediaType.parseMedia('text/html'), MediaType.parseMedia('text/html')) === 0;
|
||||
MediaType.mediaCmp(MediaType.parseMedia('*/*'), MediaType.parseMedia('text/html')) === 1;
|
||||
MediaType.mediaCmp(MediaType.parseMedia('text/html;level=1'), MediaType.parseMedia('text/html')) === -1;
|
||||
MediaType.mediaCmp(MediaType.parseMedia('application/json;profile="v1.json"'), MediaType.parseMedia('application/json;profile="v2.json"')) === null;
|
||||
}
|
||||
|
||||
// https://github.com/deoxxa/content-type/blob/master/example.js
|
||||
function example(): void {
|
||||
var representations = [
|
||||
'application/json',
|
||||
'text/html',
|
||||
'application/json;profile="schema.json"',
|
||||
'application/json;profile="different.json"',
|
||||
];
|
||||
|
||||
var accept = [
|
||||
'text/html;q=0.50',
|
||||
'*/*;q=0.01',
|
||||
'application/json;profile=different.json',
|
||||
'application/json;profile="a,b;c.json?d=1;f=2";q=0.2',
|
||||
];
|
||||
|
||||
console.log('Formats:\n\t' + representations.map(MediaType.parseMedia).join('\n\t'));
|
||||
|
||||
console.log('Accept:\n\t' + accept.map(MediaType.parseMedia).join('\n\t'));
|
||||
|
||||
console.log('Selected:', (MediaType.select(representations.map(MediaType.parseMedia), accept.map(MediaType.parseMedia)) || 'None').toString());
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for content-type v0.0.1
|
||||
// Project: https://github.com/deoxxa/content-type
|
||||
// Definitions by: Pine Mizune <https://github.com/pine613>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ContentType {
|
||||
interface MediaType {
|
||||
type: string;
|
||||
q?: number;
|
||||
params: any;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
interface SelectOptions {
|
||||
sortAvailable?: boolean;
|
||||
sortAccepted?: boolean;
|
||||
}
|
||||
|
||||
interface MediaTypeStatic {
|
||||
new (s: string, p?: any): MediaType;
|
||||
parseMedia(type: string): MediaType;
|
||||
splitQuotedString(str: string, delimiter?: string, quote?: string): string[];
|
||||
splitContentTypes(str: string): string[];
|
||||
select(availableTypes: MediaType[], acceptedTypes: MediaType[], options?: SelectOptions): string;
|
||||
mediaCmp(a: MediaType, b: MediaType): number;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "content-type" {
|
||||
var x: ContentType.MediaTypeStatic;
|
||||
export = x;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="cookie.d.ts" />
|
||||
|
||||
import cookie = require('cookie');
|
||||
|
||||
function test_serialize(): void {
|
||||
var retVal: string;
|
||||
|
||||
retVal = cookie.serialize('foo', 'bar');
|
||||
retVal = cookie.serialize('foo', 'bar', { httpOnly: true });
|
||||
}
|
||||
|
||||
function test_parse(): void {
|
||||
var retVal: { [key: string]: string };
|
||||
|
||||
retVal = cookie.parse('foo=bar; bar=baz;');
|
||||
retVal = cookie.parse('foo=bar; bar=baz', { decode: x => x });
|
||||
}
|
||||
|
||||
function test_options(): void {
|
||||
var serializeOptions: CookieSerializeOptions = {
|
||||
encode: (x: string) => x,
|
||||
path: '/',
|
||||
expires: new Date(),
|
||||
maxAge: 200,
|
||||
domain: 'example.com',
|
||||
secure: false,
|
||||
httpOnly: false
|
||||
};
|
||||
|
||||
var parseOptios: CookieParseOptions = {
|
||||
decode: (x: string) => x
|
||||
};
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for cookie v0.1.2
|
||||
// Project: https://github.com/jshttp/cookie
|
||||
// Definitions by: Pine Mizune <https://github.com/pine613>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface CookieSerializeOptions {
|
||||
encode?: (val: string) => string;
|
||||
path?: string;
|
||||
expires?: Date;
|
||||
maxAge?: number;
|
||||
domain?: string;
|
||||
secure?: boolean;
|
||||
httpOnly?: boolean;
|
||||
}
|
||||
|
||||
interface CookieParseOptions {
|
||||
decode?: (val: string) => string;
|
||||
}
|
||||
|
||||
interface CookieStatic {
|
||||
serialize(name: string, val: string, options?: CookieSerializeOptions): string;
|
||||
parse(str: string, options?: CookieParseOptions): { [key: string]: string };
|
||||
}
|
||||
|
||||
declare module "cookie" {
|
||||
var cookie: CookieStatic;
|
||||
export = cookie;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/// <reference path="cookiejs.d.ts" />
|
||||
|
||||
// Based on https://github.com/js-coder/cookie.js/blob/gh-pages/tests/spec.js
|
||||
|
||||
cookie.set({a: '1', b: '2', c: '3'});
|
||||
|
||||
cookie;
|
||||
cookie.enabled();
|
||||
|
||||
cookie.set('n', '5');
|
||||
|
||||
cookie.get('a');
|
||||
cookie.get('__undef__');
|
||||
cookie.get('__undef__', 'fallback');
|
||||
cookie.get(['a', 'b']);
|
||||
cookie.get(['a', '__undef__'], 'fallback');
|
||||
|
||||
cookie('a');
|
||||
cookie('__undef__');
|
||||
cookie('__undef__', 'fallback');
|
||||
cookie(['a', 'b']);
|
||||
cookie(['a', '__undef__'], 'fallback');
|
||||
|
||||
cookie.remove('a');
|
||||
cookie.remove('a', 'b');
|
||||
cookie.remove(['a', 'b']);
|
||||
|
||||
cookie.empty();
|
||||
|
||||
cookie.all();
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for cookie.js v1.0.0
|
||||
// Project: https://github.com/js-coder/cookie.js
|
||||
// Definitions by: Boltmade <https://github.com/Boltmade>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function cookie(key : string, fallback?: string) : string;
|
||||
declare function cookie(keys : string[], fallback?: string) : string;
|
||||
|
||||
declare module cookie {
|
||||
export function set(key : string, value : string, options? : any) : void;
|
||||
export function set(obj : any, options? : any) : void;
|
||||
export function remove(key : string) : void;
|
||||
export function remove(keys : string[]) : void;
|
||||
export function remove(...args : string[]) : void;
|
||||
export function empty() : void;
|
||||
export function get(key : string, fallback?: string) : string;
|
||||
export function get(keys : string[], fallback?: string) : string;
|
||||
export function all() : any;
|
||||
export function enabled() : boolean;
|
||||
}
|
||||
|
||||
declare module "cookiejs" {
|
||||
export = cookie;
|
||||
}
|
||||
Vendored
+10
-8
@@ -7,14 +7,16 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
interface Window {
|
||||
plugins: {
|
||||
/**
|
||||
* This plugin allows to receive push notifications. The Android implementation uses
|
||||
* Google's GCM (Google Cloud Messaging) service,
|
||||
* whereas the iOS version is based on Apple APNS Notifications
|
||||
*/
|
||||
pushNotification: PushNotification
|
||||
}
|
||||
plugins: Plugins
|
||||
}
|
||||
|
||||
interface Plugins {
|
||||
/**
|
||||
* This plugin allows to receive push notifications. The Android implementation uses
|
||||
* Google's GCM (Google Cloud Messaging) service,
|
||||
* whereas the iOS version is based on Apple APNS Notifications
|
||||
*/
|
||||
pushNotification: PushNotification
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+14
-2
@@ -9,6 +9,10 @@ declare module D3 {
|
||||
* Select an element from the current document
|
||||
*/
|
||||
select: {
|
||||
/**
|
||||
* Returns the empty selection
|
||||
*/
|
||||
(): Selection;
|
||||
/**
|
||||
* Selects the first element that matches the specified selector string
|
||||
*
|
||||
@@ -89,7 +93,7 @@ declare module D3 {
|
||||
* @param arr Array to search
|
||||
* @param map Accsessor function
|
||||
*/
|
||||
min<T, U>(arr: T[], map: (v: T) => U): U;
|
||||
min<T, U>(arr: T[], map: (v?: T, i?: number) => U): U;
|
||||
/**
|
||||
* Find the minimum value in an array
|
||||
*
|
||||
@@ -102,7 +106,7 @@ declare module D3 {
|
||||
* @param arr Array to search
|
||||
* @param map Accsessor function
|
||||
*/
|
||||
max<T, U>(arr: T[], map: (v: T) => U): U;
|
||||
max<T, U>(arr: T[], map: (v?: T, i?: number) => U): U;
|
||||
/**
|
||||
* Find the maximum value in an array
|
||||
*
|
||||
@@ -233,6 +237,13 @@ declare module D3 {
|
||||
*/
|
||||
transpose(matrix: any[]): any[];
|
||||
/**
|
||||
* Creates an array containing tuples of adjacent pairs
|
||||
*
|
||||
* @param arr An array containing entries to pair
|
||||
* @returns any[][] An array of 2-element tuples for each pair
|
||||
*/
|
||||
pairs(arr: any[]): any[][];
|
||||
/**
|
||||
* List the keys of an associative array.
|
||||
*
|
||||
* @param map Array of objects to get the key values from
|
||||
@@ -719,6 +730,7 @@ declare module D3 {
|
||||
(name: string): string;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(classValueMap: Object): Selection;
|
||||
};
|
||||
|
||||
style: {
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
/////////////////////////////////////////////////////////////
|
||||
// http://workshop.chromeexperiments.com/examples/gui/
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/// <reference path="dat-gui.d.ts" />
|
||||
|
||||
|
||||
// ------------ config
|
||||
var FizzyText = function () {
|
||||
return {
|
||||
message: 'dat.gui',
|
||||
speed: 0.8,
|
||||
displayOutline: false,
|
||||
explode: function () {},
|
||||
noiseStrength: 0.5
|
||||
// Define render logic ...
|
||||
}
|
||||
};
|
||||
|
||||
// ------------ 1. Basic Usage
|
||||
() => {
|
||||
window.onload = function () {
|
||||
var text = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
gui.add(text, 'message');
|
||||
gui.add(text, 'speed', -5, 5);
|
||||
gui.add(text, 'displayOutline');
|
||||
gui.add(text, 'explode');
|
||||
};
|
||||
}
|
||||
// ------------ 2. Constraining Input
|
||||
() => {
|
||||
var text = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
gui.add(text, 'noiseStrength').step(5); // Increment amount
|
||||
gui.add(text, 'growthSpeed', -5, 5); // Min and max
|
||||
gui.add(text, 'maxSize').min(0).step(0.25); // Mix and match
|
||||
|
||||
// Choose from accepted values
|
||||
gui.add(text, 'message', ['pizza', 'chrome', 'hooray']);
|
||||
|
||||
// Choose from named values
|
||||
gui.add(text, 'speed', {Stopped: 0, Slow: 0.1, Fast: 5});
|
||||
}
|
||||
// ------------ 3. Folders
|
||||
() => {
|
||||
var text = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
|
||||
var f1 = gui.addFolder('Flow Field');
|
||||
f1.add(text, 'speed');
|
||||
f1.add(text, 'noiseStrength');
|
||||
|
||||
var f2 = gui.addFolder('Letters');
|
||||
f2.add(text, 'growthSpeed');
|
||||
f2.add(text, 'maxSize');
|
||||
f2.add(text, 'message');
|
||||
|
||||
f2.open();
|
||||
}
|
||||
// ------------ 4. Color Controllers
|
||||
() => {
|
||||
var FizzyText = function () {
|
||||
return {
|
||||
color0: "#ffae23", // CSS string
|
||||
color1: [0, 128, 255], // RGB array
|
||||
color2: [0, 128, 255, 0.3], // RGB with alpha
|
||||
color3: {h: 350, s: 0.9, v: 0.3} // Hue, saturation, value
|
||||
|
||||
// Define render logic ...
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function () {
|
||||
|
||||
var text = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
|
||||
gui.addColor(text, 'color0');
|
||||
gui.addColor(text, 'color1');
|
||||
gui.addColor(text, 'color2');
|
||||
gui.addColor(text, 'color3');
|
||||
|
||||
};
|
||||
}
|
||||
// ------------ 5. Saving Values
|
||||
() => {
|
||||
var fizzyText = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
|
||||
gui.remember(fizzyText);
|
||||
}
|
||||
|
||||
// ------------ 6. Presets
|
||||
() => {
|
||||
var gui = new dat.GUI({
|
||||
load: JSON,
|
||||
preset: 'Flow'
|
||||
});
|
||||
}
|
||||
|
||||
// ------------ 7. Events
|
||||
() => {
|
||||
var fizzyText = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
var controller = gui.add(fizzyText, 'maxSize', 0, 10);
|
||||
|
||||
controller.onChange(function (value) {
|
||||
// Fires on every change, drag, keypress, etc.
|
||||
});
|
||||
|
||||
controller.onFinishChange(function (value) {
|
||||
// Fires when a controller loses focus.
|
||||
alert("The new value is " + value);
|
||||
});
|
||||
}
|
||||
|
||||
// ------------ 8. Custom Placement
|
||||
() => {
|
||||
var gui = new dat.GUI({autoPlace: false});
|
||||
|
||||
var customContainer = document.getElementById('my-gui-container');
|
||||
customContainer.appendChild(gui.domElement);
|
||||
}
|
||||
// ------------ 9. Updating the Display Automatically
|
||||
() => {
|
||||
var fizzyText = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
|
||||
gui.add(fizzyText, 'noiseStrength', 0, 100).listen();
|
||||
|
||||
var update = function () {
|
||||
requestAnimationFrame(update);
|
||||
fizzyText.noiseStrength = Math.random();
|
||||
};
|
||||
|
||||
update();
|
||||
}
|
||||
// ------------ 10. Updating the Display Manually
|
||||
() => {
|
||||
var fizzyText = FizzyText();
|
||||
var gui = new dat.GUI();
|
||||
|
||||
gui.add(fizzyText, 'noiseStrength', 0, 100);
|
||||
|
||||
var update = function () {
|
||||
var dt = new Date();
|
||||
requestAnimationFrame(update);
|
||||
fizzyText.noiseStrength = Math.cos(dt.getTime());
|
||||
|
||||
// Iterate over all controllers
|
||||
for (var i in gui.__controllers) {
|
||||
gui.__controllers[i].updateDisplay();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
update();
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for dat.GUI v0.5
|
||||
// Project: https://github.com/dataarts/dat.gui
|
||||
// Definitions by: Satoru Kimura <https://github.com/gyohk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module dat {
|
||||
export class GUI {
|
||||
constructor(option?: GUIParams);
|
||||
|
||||
__controllers: GUIController[];
|
||||
__folders: GUI[];
|
||||
domElement: HTMLElement;
|
||||
|
||||
add(target: Object, propName:string): GUIController;
|
||||
add(target: Object, propName:string, min: number, max: number): GUIController;
|
||||
add(target: Object, propName:string, status: boolean): GUIController;
|
||||
add(target: Object, propName:string, items:string[]): GUIController;
|
||||
add(target: Object, propName:string, items:number[]): GUIController;
|
||||
add(target: Object, propName:string, items:Object): GUIController;
|
||||
|
||||
addColor(target: Object, propName:string): GUIController;
|
||||
addColor(target: Object, propName:string, color: string): GUIController;
|
||||
addColor(target: Object, propName:string, rgba: number[]): GUIController; // rgb or rgba
|
||||
addColor(target: Object, propName:string, hsv:{h:number; s:number; v:number}): GUIController;
|
||||
|
||||
addFolder(propName:string): GUI;
|
||||
|
||||
close(): void;
|
||||
open(): void;
|
||||
remember(target: Object): void;
|
||||
}
|
||||
|
||||
export interface GUIParams{
|
||||
autoPlace?: boolean;
|
||||
closed?: boolean;
|
||||
load?: any;
|
||||
name?: string;
|
||||
preset?: string;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export class GUIController {
|
||||
destroy(): void;
|
||||
fire(): GUIController;
|
||||
getValue(): any;
|
||||
isModified(): boolean;
|
||||
listen(): GUIController;
|
||||
min(n: number): GUIController;
|
||||
remove(target: GUIController): void;
|
||||
setValue(value: any): GUIController;
|
||||
step(n: number): GUIController;
|
||||
updateDisplay(): void;
|
||||
|
||||
onChange: (value?: any) => void;
|
||||
onFinishChange: (value?: any) => void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="debug.d.ts" />
|
||||
|
||||
import debug = require("debug");
|
||||
|
||||
debug.disable();
|
||||
debug.enable("DefinitelyTyped:*");
|
||||
|
||||
var log: debug.Debugger = debug("DefinitelyTyped:log");
|
||||
|
||||
log("Just text");
|
||||
log("Formatted test (%d arg)", 1);
|
||||
log("Formatted %s (%d args)", "test", 2);
|
||||
|
||||
log("Enabled?: %s", debug.enabled("DefinitelyTyped:log"));
|
||||
log("Namespace: %s", log.namespace);
|
||||
|
||||
var error: debug.Debugger = debug("DefinitelyTyped:error");
|
||||
error.log = console.error.bind(console);
|
||||
error("This should be printed to stderr");
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for debug
|
||||
// Project: https://github.com/visionmedia/debug
|
||||
// Definitions by: Seon-Wook Park <https://github.com/swook>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "debug" {
|
||||
|
||||
function d(namespace: string): d.Debugger;
|
||||
|
||||
module d {
|
||||
export var log: Function;
|
||||
|
||||
function enable(namespaces: string): void;
|
||||
function disable(): void;
|
||||
|
||||
function enabled(namespace: string): boolean;
|
||||
|
||||
export interface Debugger {
|
||||
(formatter: any, ...args: any[]): void;
|
||||
|
||||
enabled: boolean;
|
||||
log: Function;
|
||||
namespace: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = d;
|
||||
|
||||
}
|
||||
|
||||
Vendored
+31
-27
@@ -5,8 +5,8 @@
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
export var rtlEnabled: boolean;
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
interface Endpoint {
|
||||
@@ -84,8 +84,8 @@ export function abstract(): void;
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.data {
|
||||
export interface DataError extends Error {
|
||||
declare module DevExpress.data {
|
||||
export interface DataError extends Error {
|
||||
httpStatus?: number;
|
||||
errorDetails?: any;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export interface DataError extends Error {
|
||||
export module queryAdapters {
|
||||
export function odata(queryOptions: ODataQueryOptions): RemoteQuery;
|
||||
}
|
||||
export interface DataSourceOptions {
|
||||
export interface DataSourceOptions {
|
||||
map? (item: any): any;
|
||||
postProcess? (result: any[]): any;
|
||||
pageSize: number;
|
||||
@@ -245,7 +245,7 @@ export interface DataSourceOptions {
|
||||
load(): JQueryPromise<any>;
|
||||
dispose(): void;
|
||||
}
|
||||
export interface StoreOptions {
|
||||
export interface StoreOptions {
|
||||
key?: any;
|
||||
errorHandler?: ErrorHandler;
|
||||
loaded?: (result: Array<any>) => void;
|
||||
@@ -351,7 +351,11 @@ export interface StoreOptions {
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; };
|
||||
}
|
||||
}
|
||||
declare module DevExpress.ui {
|
||||
declare module DevExpress.ui {
|
||||
export var themes: {
|
||||
current(): string;
|
||||
current(themeName: string): void;
|
||||
};
|
||||
interface ViewportOptions {
|
||||
allowPan?: boolean;
|
||||
allowZoom?: boolean;
|
||||
@@ -407,7 +411,7 @@ declare module DevExpress.ui {
|
||||
export function confirm(options: DialogOptions): JQueryPromise<boolean>;
|
||||
export function confirm(message: string, title?: string): JQueryPromise<boolean>;
|
||||
}
|
||||
export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
items?: Array<any>;
|
||||
itemTemplate?: any;
|
||||
itemRender?: Function;
|
||||
@@ -424,7 +428,7 @@ export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
constructor(element: Element, options?: CollectionContainerWidgetOptions);
|
||||
constructor(element: JQuery, options?: CollectionContainerWidgetOptions);
|
||||
}
|
||||
export interface WidgetOptions extends ComponentOptions {
|
||||
export interface WidgetOptions extends ComponentOptions {
|
||||
contentReadyAction?: any;
|
||||
width?: any;
|
||||
height?: any;
|
||||
@@ -438,7 +442,7 @@ export interface WidgetOptions extends ComponentOptions {
|
||||
repaint(): void;
|
||||
addTemplate(template: ITemplate): void;
|
||||
}
|
||||
export interface dxEditorOptions extends WidgetOptions {
|
||||
export interface dxEditorOptions extends WidgetOptions {
|
||||
value?: any;
|
||||
valueChangeAction?: any;
|
||||
}
|
||||
@@ -447,8 +451,8 @@ export interface dxEditorOptions extends WidgetOptions {
|
||||
constructor(element: JQuery, options?: dxEditorOptions);
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz {
|
||||
export class Chart extends Component {
|
||||
declare module DevExpress.viz {
|
||||
export class Chart extends Component {
|
||||
constructor(element: Element, options?: viz.charts.ChartOptions);
|
||||
constructor(element: JQuery, options?: viz.charts.ChartOptions);
|
||||
clearSelection(): void;
|
||||
@@ -564,8 +568,8 @@ export class Chart extends Component {
|
||||
convertCoordinates(x: number, y: number): Array<number>;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.charts {
|
||||
interface z_BaseLegendOptions {
|
||||
declare module DevExpress.viz.charts {
|
||||
interface z_BaseLegendOptions {
|
||||
backgroundColor?: string;
|
||||
hoverMode?: string;
|
||||
customizeText?: (arg: {
|
||||
@@ -931,8 +935,8 @@ interface z_BaseLegendOptions {
|
||||
asyncSeriesRendering?: boolean;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.charts.series {
|
||||
export interface z_BasePointStyle {
|
||||
declare module DevExpress.viz.charts.series {
|
||||
export interface z_BasePointStyle {
|
||||
color?: string;
|
||||
border?: {
|
||||
visible?: boolean;
|
||||
@@ -1250,8 +1254,8 @@ export interface z_BasePointStyle {
|
||||
isHovered(): boolean;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.common {
|
||||
export interface FontOptions {
|
||||
declare module DevExpress.viz.common {
|
||||
export interface FontOptions {
|
||||
color?: string;
|
||||
family?: string;
|
||||
opacity?: number;
|
||||
@@ -1301,8 +1305,8 @@ export interface FontOptions {
|
||||
}
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.gauges {
|
||||
interface CustomizeTextArgument {
|
||||
declare module DevExpress.viz.gauges {
|
||||
interface CustomizeTextArgument {
|
||||
value: number;
|
||||
valueText: string;
|
||||
color: string;
|
||||
@@ -1538,8 +1542,8 @@ interface CustomizeTextArgument {
|
||||
pathModified?: boolean;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.map {
|
||||
interface TooltipOptions extends common.BaseTooltipOptions {
|
||||
declare module DevExpress.viz.map {
|
||||
interface TooltipOptions extends common.BaseTooltipOptions {
|
||||
customizeText?: (arg: Proxy) => string;
|
||||
customizeTooltip?: (arg: Proxy) => common.CustomizeTooltipResult;
|
||||
borderColor?: string;
|
||||
@@ -1635,8 +1639,8 @@ interface TooltipOptions extends common.BaseTooltipOptions {
|
||||
coordinates(): Array<number>;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.rangeSelector {
|
||||
export interface SelectedRange {
|
||||
declare module DevExpress.viz.rangeSelector {
|
||||
export interface SelectedRange {
|
||||
startValue: any; endValue: any;
|
||||
}
|
||||
interface CustomizeTextArgument {
|
||||
@@ -1765,8 +1769,8 @@ export interface SelectedRange {
|
||||
pathModified?: boolean;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.viz.sparklines {
|
||||
interface z_SparklineTooltipFormatObject {
|
||||
declare module DevExpress.viz.sparklines {
|
||||
interface z_SparklineTooltipFormatObject {
|
||||
firstValue?: string;
|
||||
lastValue?: string;
|
||||
maxValue?: string;
|
||||
@@ -1840,7 +1844,7 @@ interface z_SparklineTooltipFormatObject {
|
||||
}
|
||||
}
|
||||
interface JQuery {
|
||||
dxChart(options?: DevExpress.viz.charts.ChartOptions): JQuery;
|
||||
dxChart(options?: DevExpress.viz.charts.ChartOptions): JQuery;
|
||||
dxChart(method: string, param1?:any, param2?:any): any;
|
||||
dxPieChart(options?: DevExpress.viz.charts.PieOptions): JQuery;
|
||||
dxPieChart(method: string, param1?: any, param2?: any): any;
|
||||
|
||||
Vendored
+99
-94
@@ -5,8 +5,8 @@
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
export var rtlEnabled: boolean;
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
interface Endpoint {
|
||||
@@ -84,8 +84,8 @@ export function abstract(): void;
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.data {
|
||||
export interface DataError extends Error {
|
||||
declare module DevExpress.data {
|
||||
export interface DataError extends Error {
|
||||
httpStatus?: number;
|
||||
errorDetails?: any;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export interface DataError extends Error {
|
||||
export module queryAdapters {
|
||||
export function odata(queryOptions: ODataQueryOptions): RemoteQuery;
|
||||
}
|
||||
export interface DataSourceOptions {
|
||||
export interface DataSourceOptions {
|
||||
map? (item: any): any;
|
||||
postProcess? (result: any[]): any;
|
||||
pageSize: number;
|
||||
@@ -245,7 +245,7 @@ export interface DataSourceOptions {
|
||||
load(): JQueryPromise<any>;
|
||||
dispose(): void;
|
||||
}
|
||||
export interface StoreOptions {
|
||||
export interface StoreOptions {
|
||||
key?: any;
|
||||
errorHandler?: ErrorHandler;
|
||||
loaded?: (result: Array<any>) => void;
|
||||
@@ -351,8 +351,8 @@ export interface StoreOptions {
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; };
|
||||
}
|
||||
}
|
||||
declare module DevExpress.framework {
|
||||
export interface dxViewOptions {
|
||||
declare module DevExpress.framework {
|
||||
export interface dxViewOptions {
|
||||
name: string;
|
||||
title?: string;
|
||||
layout?: string;
|
||||
@@ -690,8 +690,8 @@ export interface dxViewOptions {
|
||||
[key: string]: { execute(e: any): void; }
|
||||
};
|
||||
}
|
||||
declare module DevExpress.framework.html {
|
||||
export interface ILayoutController {
|
||||
declare module DevExpress.framework.html {
|
||||
export interface ILayoutController {
|
||||
viewReleased: JQueryCallback;
|
||||
init(options: InitLayoutControllerOptions): void;
|
||||
activate(): void;
|
||||
@@ -751,8 +751,8 @@ export interface ILayoutController {
|
||||
static create(container: JQuery, options: TransitionExecutorOptions): TransitionExecutor;
|
||||
}
|
||||
export interface ViewEngineOptions {
|
||||
$root?: JQuery;
|
||||
device?: IDevice;
|
||||
$root: JQuery;
|
||||
device: IDevice;
|
||||
commandManager?: CommandManager;
|
||||
templateEngine?: ITemplateEngine;
|
||||
dataOptionsAttributeName?: string;
|
||||
@@ -793,7 +793,11 @@ export interface ILayoutController {
|
||||
viewPort(): JQuery;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.ui {
|
||||
declare module DevExpress.ui {
|
||||
export var themes: {
|
||||
current(): string;
|
||||
current(themeName: string): void;
|
||||
};
|
||||
interface ViewportOptions {
|
||||
allowPan?: boolean;
|
||||
allowZoom?: boolean;
|
||||
@@ -849,7 +853,7 @@ declare module DevExpress.ui {
|
||||
export function confirm(options: DialogOptions): JQueryPromise<boolean>;
|
||||
export function confirm(message: string, title?: string): JQueryPromise<boolean>;
|
||||
}
|
||||
export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
items?: Array<any>;
|
||||
itemTemplate?: any;
|
||||
itemRender?: Function;
|
||||
@@ -866,7 +870,7 @@ export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
constructor(element: Element, options?: CollectionContainerWidgetOptions);
|
||||
constructor(element: JQuery, options?: CollectionContainerWidgetOptions);
|
||||
}
|
||||
export interface WidgetOptions extends ComponentOptions {
|
||||
export interface WidgetOptions extends ComponentOptions {
|
||||
contentReadyAction?: any;
|
||||
width?: any;
|
||||
height?: any;
|
||||
@@ -880,7 +884,7 @@ export interface WidgetOptions extends ComponentOptions {
|
||||
repaint(): void;
|
||||
addTemplate(template: ITemplate): void;
|
||||
}
|
||||
export interface dxEditorOptions extends WidgetOptions {
|
||||
export interface dxEditorOptions extends WidgetOptions {
|
||||
value?: any;
|
||||
valueChangeAction?: any;
|
||||
}
|
||||
@@ -888,7 +892,7 @@ export interface dxEditorOptions extends WidgetOptions {
|
||||
constructor(element: Element, options?: dxEditorOptions);
|
||||
constructor(element: JQuery, options?: dxEditorOptions);
|
||||
}
|
||||
export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
minSearchLength?: number;
|
||||
searchTimeout?: number;
|
||||
placeholder?: string;
|
||||
@@ -904,22 +908,23 @@ export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
constructor(element: Element, options?: dxAutocompleteOptions);
|
||||
constructor(element: JQuery, options?: dxAutocompleteOptions);
|
||||
}
|
||||
export interface dxButtonOptions extends WidgetOptions {
|
||||
export interface dxButtonOptions extends WidgetOptions {
|
||||
type?: string;
|
||||
text?: string;
|
||||
text?: string;
|
||||
icon?: string;
|
||||
iconSrc?: string;
|
||||
clickAction?: any;
|
||||
}
|
||||
export class dxButton extends Widget {
|
||||
constructor(element: Element, options?: dxButtonOptions);
|
||||
constructor(element: JQuery, options?: dxButtonOptions);
|
||||
}
|
||||
export interface dxCheckBoxOptions extends dxEditorOptions { }
|
||||
export interface dxCheckBoxOptions extends dxEditorOptions { }
|
||||
export class dxCheckBox extends dxEditor {
|
||||
constructor(element: Element, options?: dxCheckBoxOptions);
|
||||
constructor(element: JQuery, options?: dxCheckBoxOptions);
|
||||
}
|
||||
export interface dxCalendarOptions extends dxEditorOptions {
|
||||
export interface dxCalendarOptions extends dxEditorOptions {
|
||||
value?: Date;
|
||||
min?: Date;
|
||||
max?: Date;
|
||||
@@ -929,7 +934,7 @@ export interface dxCalendarOptions extends dxEditorOptions {
|
||||
constructor(element: Element, options?: dxEditorOptions);
|
||||
constructor(element: JQuery, options?: dxEditorOptions);
|
||||
}
|
||||
export interface dxDateBoxOptions extends dxTextEditorOptions {
|
||||
export interface dxDateBoxOptions extends dxTextEditorOptions {
|
||||
format?: string;
|
||||
useNativePicker?: boolean;
|
||||
value?: Date;
|
||||
@@ -945,7 +950,7 @@ export interface dxDateBoxOptions extends dxTextEditorOptions {
|
||||
constructor(element: Element, options?: dxDateBoxOptions);
|
||||
constructor(element: JQuery, options?: dxDateBoxOptions);
|
||||
}
|
||||
export interface dxTextEditorOptions extends dxEditorOptions {
|
||||
export interface dxTextEditorOptions extends dxEditorOptions {
|
||||
valueChangeEvent?: string;
|
||||
placeholder?: string;
|
||||
readOnly?: boolean;
|
||||
@@ -969,7 +974,7 @@ export interface dxTextEditorOptions extends dxEditorOptions {
|
||||
focus(): void;
|
||||
blur(): void;
|
||||
}
|
||||
export interface dxListOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxListOptions extends CollectionContainerWidgetOptions {
|
||||
pullRefreshEnabled?: boolean;
|
||||
autoPagingEnabled?: boolean;
|
||||
scrollingEnabled?: boolean;
|
||||
@@ -1035,7 +1040,7 @@ export interface dxListOptions extends CollectionContainerWidgetOptions {
|
||||
scrollTo(targetLocation: number): void;
|
||||
scrollTop(): number;
|
||||
}
|
||||
export interface dxLoadPanelOptions extends dxOverlayOptions {
|
||||
export interface dxLoadPanelOptions extends dxOverlayOptions {
|
||||
message?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -1051,7 +1056,7 @@ export interface dxLoadPanelOptions extends dxOverlayOptions {
|
||||
show(): void;
|
||||
toggle(showing: boolean): void;
|
||||
}
|
||||
export interface dxLookupOptions extends dxEditorOptions {
|
||||
export interface dxLookupOptions extends dxEditorOptions {
|
||||
dataSource?: data.DataSource;
|
||||
displayValue?: string;
|
||||
title?: string;
|
||||
@@ -1103,7 +1108,7 @@ export interface dxLookupOptions extends dxEditorOptions {
|
||||
close(): void;
|
||||
open(): void;
|
||||
}
|
||||
export interface dxMapOptions extends WidgetOptions {
|
||||
export interface dxMapOptions extends WidgetOptions {
|
||||
location?: any;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -1132,12 +1137,12 @@ export interface dxMapOptions extends WidgetOptions {
|
||||
addRoute(routeOptions: any, callback: Function): JQueryPromise<any>;
|
||||
removeRoute(route: any): void;
|
||||
}
|
||||
export interface dxNavBarOptions extends dxTabsOptions { }
|
||||
export interface dxNavBarOptions extends dxTabsOptions { }
|
||||
export class dxNavBar extends dxTabs {
|
||||
constructor(element: Element, options?: dxNavBarOptions);
|
||||
constructor(element: JQuery, options?: dxNavBarOptions);
|
||||
}
|
||||
export interface dxNumberBoxOptions extends dxTextEditorOptions {
|
||||
export interface dxNumberBoxOptions extends dxTextEditorOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
value?: number;
|
||||
@@ -1148,7 +1153,7 @@ export interface dxNumberBoxOptions extends dxTextEditorOptions {
|
||||
constructor(element: Element, options?: dxNumberBoxOptions);
|
||||
constructor(element: JQuery, options?: dxNumberBoxOptions);
|
||||
}
|
||||
export interface dxOverlayOptions extends WidgetOptions {
|
||||
export interface dxOverlayOptions extends WidgetOptions {
|
||||
activeStateEnabled?: boolean;
|
||||
shading?: boolean;
|
||||
closeOnOutsideClick?: boolean;
|
||||
@@ -1170,7 +1175,7 @@ export interface dxOverlayOptions extends WidgetOptions {
|
||||
show(): void;
|
||||
toggle(showing: boolean): void;
|
||||
}
|
||||
export interface dxPopupOptions extends dxOverlayOptions {
|
||||
export interface dxPopupOptions extends dxOverlayOptions {
|
||||
title?: string;
|
||||
showTitle?: boolean;
|
||||
fullScreen?: boolean;
|
||||
@@ -1184,21 +1189,21 @@ export interface dxPopupOptions extends dxOverlayOptions {
|
||||
constructor(element: Element, options?: dxPopupOptions);
|
||||
constructor(element: JQuery, options?: dxPopupOptions);
|
||||
}
|
||||
export interface dxPopoverOptions extends dxPopupOptions {
|
||||
export interface dxPopoverOptions extends dxPopupOptions {
|
||||
target?: any;
|
||||
}
|
||||
export class dxPopover extends dxPopup {
|
||||
constructor(element: Element, options?: dxPopoverOptions);
|
||||
constructor(element: JQuery, options?: dxPopoverOptions);
|
||||
}
|
||||
export interface dxTooltipOptions extends dxPopoverOptions {
|
||||
export interface dxTooltipOptions extends dxPopoverOptions {
|
||||
target?: any;
|
||||
}
|
||||
export class dxTooltip extends dxPopover {
|
||||
constructor(element: Element, options?: dxTooltipOptions);
|
||||
constructor(element: JQuery, options?: dxTooltipOptions);
|
||||
}
|
||||
export interface dxRadioGroupOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxRadioGroupOptions extends CollectionContainerWidgetOptions {
|
||||
layout?: string;
|
||||
name?: string;
|
||||
value?: Object;
|
||||
@@ -1208,7 +1213,7 @@ export interface dxRadioGroupOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxRadioGroupOptions);
|
||||
constructor(element: JQuery, options?: dxRadioGroupOptions);
|
||||
}
|
||||
export interface dxRangeSliderOptions extends dxSliderOptions {
|
||||
export interface dxRangeSliderOptions extends dxSliderOptions {
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
@@ -1216,7 +1221,7 @@ export interface dxRangeSliderOptions extends dxSliderOptions {
|
||||
constructor(element: Element, options?: dxRangeSliderOptions);
|
||||
constructor(element: JQuery, options?: dxRangeSliderOptions);
|
||||
}
|
||||
export interface dxScrollableOptions extends ComponentOptions {
|
||||
export interface dxScrollableOptions extends ComponentOptions {
|
||||
startAction?: any;
|
||||
scrollAction?: any;
|
||||
endAction?: any;
|
||||
@@ -1246,7 +1251,7 @@ export interface dxScrollableOptions extends ComponentOptions {
|
||||
scrollTo(targetLocation: number): void;
|
||||
scrollTo(targetLocation: Object): void;
|
||||
}
|
||||
export interface dxScrollViewOptions extends dxScrollableOptions {
|
||||
export interface dxScrollViewOptions extends dxScrollableOptions {
|
||||
pullingDownText?: string;
|
||||
pulledDownText?: string;
|
||||
refreshingText?: string;
|
||||
@@ -1261,7 +1266,7 @@ export interface dxScrollViewOptions extends dxScrollableOptions {
|
||||
toggleLoading(showOrHide: boolean): void;
|
||||
refresh(): void;
|
||||
}
|
||||
export interface dxSelectBoxOptions extends dxAutocompleteOptions {
|
||||
export interface dxSelectBoxOptions extends dxAutocompleteOptions {
|
||||
fieldTemplate?: any;
|
||||
displayValue?: string;
|
||||
multiSelectEnabled?: boolean;
|
||||
@@ -1273,7 +1278,7 @@ export interface dxSelectBoxOptions extends dxAutocompleteOptions {
|
||||
constructor(element: Element, options?: dxSelectBoxOptions);
|
||||
constructor(element: JQuery, options?: dxSelectBoxOptions);
|
||||
}
|
||||
export interface dxSliderOptions extends dxEditorOptions {
|
||||
export interface dxSliderOptions extends dxEditorOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
@@ -1294,12 +1299,12 @@ export interface dxSliderOptions extends dxEditorOptions {
|
||||
constructor(element: Element, options?: dxSliderOptions);
|
||||
constructor(element: JQuery, options?: dxSliderOptions);
|
||||
}
|
||||
export interface dxTabsOptions extends CollectionContainerWidgetOptions { }
|
||||
export interface dxTabsOptions extends CollectionContainerWidgetOptions { }
|
||||
export class dxTabs extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxTabsOptions);
|
||||
constructor(element: JQuery, options?: dxTabsOptions);
|
||||
}
|
||||
export interface dxTextAreaOptions extends dxTextEditorOptions {
|
||||
export interface dxTextAreaOptions extends dxTextEditorOptions {
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
}
|
||||
@@ -1307,14 +1312,14 @@ export interface dxTextAreaOptions extends dxTextEditorOptions {
|
||||
constructor(element: Element, options?: dxTextAreaOptions);
|
||||
constructor(element: JQuery, options?: dxTextAreaOptions);
|
||||
}
|
||||
export interface dxTextBoxOptions extends dxTextEditorOptions {
|
||||
export interface dxTextBoxOptions extends dxTextEditorOptions {
|
||||
maxLength?: any;
|
||||
}
|
||||
export class dxTextBox extends dxTextEditor {
|
||||
constructor(element: Element, options?: dxTextBoxOptions);
|
||||
constructor(element: JQuery, options?: dxTextBoxOptions);
|
||||
}
|
||||
export interface dxToastOptions extends dxOverlayOptions {
|
||||
export interface dxToastOptions extends dxOverlayOptions {
|
||||
message?: string;
|
||||
type?: string;
|
||||
displayTime?: number;
|
||||
@@ -1323,7 +1328,7 @@ export interface dxToastOptions extends dxOverlayOptions {
|
||||
constructor(element: Element, options?: dxToastOptions);
|
||||
constructor(element: JQuery, options?: dxToastOptions);
|
||||
}
|
||||
export interface dxToolbarOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxToolbarOptions extends CollectionContainerWidgetOptions {
|
||||
menuItemRender?: Function;
|
||||
menuItemTemplate?: any;
|
||||
submenuType?: string;
|
||||
@@ -1333,7 +1338,7 @@ export interface dxToolbarOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxToolbarOptions);
|
||||
constructor(element: JQuery, options?: dxToolbarOptions);
|
||||
}
|
||||
export interface dxDropDownEditorOptions extends dxTextBoxOptions {
|
||||
export interface dxDropDownEditorOptions extends dxTextBoxOptions {
|
||||
closeAction?: any;
|
||||
openAction?: any;
|
||||
}
|
||||
@@ -1341,14 +1346,14 @@ export interface dxDropDownEditorOptions extends dxTextBoxOptions {
|
||||
constructor(element: Element, options?: dxDropDownEditorOptions);
|
||||
constructor(element: JQuery, options?: dxDropDownEditorOptions);
|
||||
}
|
||||
export interface dxLoadIndicatorOptions extends WidgetOptions {
|
||||
export interface dxLoadIndicatorOptions extends WidgetOptions {
|
||||
indicatorSrc?: string;
|
||||
}
|
||||
export class dxLoadIndicator extends Widget {
|
||||
constructor(element: Element, options?: dxLoadIndicatorOptions);
|
||||
constructor(element: JQuery, options?: dxLoadIndicatorOptions);
|
||||
}
|
||||
export interface dxMultiViewOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxMultiViewOptions extends CollectionContainerWidgetOptions {
|
||||
loop?: boolean;
|
||||
swipeEnabled?: boolean;
|
||||
animationEnabled?: boolean;
|
||||
@@ -1358,7 +1363,7 @@ export interface dxMultiViewOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxMultiViewOptions);
|
||||
constructor(element: JQuery, options?: dxMultiViewOptions);
|
||||
}
|
||||
export interface dxGalleryOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxGalleryOptions extends CollectionContainerWidgetOptions {
|
||||
activeStateEnabled?: boolean;
|
||||
animationDuration?: number;
|
||||
loop?: boolean;
|
||||
@@ -1376,7 +1381,7 @@ export interface dxGalleryOptions extends CollectionContainerWidgetOptions {
|
||||
prevItem(animation?: boolean): JQueryPromise<dxGallery>;
|
||||
nextItem(animation?: boolean): JQueryPromise<dxGallery>;
|
||||
}
|
||||
export interface dxActionSheetOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxActionSheetOptions extends CollectionContainerWidgetOptions {
|
||||
usePopover?: boolean;
|
||||
target?: any;
|
||||
title?: string;
|
||||
@@ -1393,7 +1398,7 @@ export interface dxActionSheetOptions extends CollectionContainerWidgetOptions {
|
||||
show(): void;
|
||||
hide(): void;
|
||||
}
|
||||
export interface dxDropDownMenuOptions extends WidgetOptions {
|
||||
export interface dxDropDownMenuOptions extends WidgetOptions {
|
||||
items?: Array<any>;
|
||||
itemClickAction?: any;
|
||||
dataSource?: data.DataSource;
|
||||
@@ -1409,7 +1414,7 @@ export interface dxDropDownMenuOptions extends WidgetOptions {
|
||||
constructor(element: Element, options?: dxDropDownMenuOptions);
|
||||
constructor(element: JQuery, options?: dxDropDownMenuOptions);
|
||||
}
|
||||
export interface dxPanoramaOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxPanoramaOptions extends CollectionContainerWidgetOptions {
|
||||
title?: string;
|
||||
backgroundImage?: any;
|
||||
}
|
||||
@@ -1417,12 +1422,12 @@ export interface dxPanoramaOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxPanoramaOptions);
|
||||
constructor(element: JQuery, options?: dxPanoramaOptions);
|
||||
}
|
||||
export interface dxPivotOptions extends CollectionContainerWidgetOptions { }
|
||||
export interface dxPivotOptions extends CollectionContainerWidgetOptions { }
|
||||
export class dxPivot extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxPivotOptions);
|
||||
constructor(element: JQuery, options?: dxPivotOptions);
|
||||
}
|
||||
export interface dxSwitchOptions extends dxEditorOptions {
|
||||
export interface dxSwitchOptions extends dxEditorOptions {
|
||||
onText?: string;
|
||||
offText?: string;
|
||||
}
|
||||
@@ -1430,7 +1435,7 @@ export interface dxSwitchOptions extends dxEditorOptions {
|
||||
constructor(element: Element, options?: dxSwitchOptions);
|
||||
constructor(element: JQuery, options?: dxSwitchOptions);
|
||||
}
|
||||
export interface dxTileViewOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxTileViewOptions extends CollectionContainerWidgetOptions {
|
||||
bounceEnabled?: boolean;
|
||||
showScrollbar?: boolean;
|
||||
listHeight?: number;
|
||||
@@ -1442,7 +1447,7 @@ export interface dxTileViewOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxTileViewOptions);
|
||||
constructor(element: JQuery, options?: dxTileViewOptions);
|
||||
}
|
||||
export interface dxSlideOutOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxSlideOutOptions extends CollectionContainerWidgetOptions {
|
||||
activeStateEnabled?: boolean;
|
||||
menuItemRender? (itemData: any, itemIndex: number, itemElement: Element): any;
|
||||
menuItemTemplate?: any;
|
||||
@@ -1460,43 +1465,43 @@ export interface dxSlideOutOptions extends CollectionContainerWidgetOptions {
|
||||
toggleMenuVisibility(showing?: boolean): JQueryPromise<dxSlideOut>;
|
||||
}
|
||||
}
|
||||
interface JQuery {
|
||||
dxAutocomplete(options?: DevExpress.ui.dxAutocompleteOptions): JQuery;
|
||||
dxButton(options?: DevExpress.ui.dxButtonOptions): JQuery;
|
||||
dxCheckBox(options?: DevExpress.ui.dxCheckBoxOptions): JQuery;
|
||||
dxCalendar(options?: DevExpress.ui.dxCalendarOptions): JQuery;
|
||||
dxDateBox(options?: DevExpress.ui.dxDateBoxOptions): JQuery;
|
||||
dxTextEditor(options?: DevExpress.ui.dxTextEditorOptions): JQuery;
|
||||
dxList(options?: DevExpress.ui.dxListOptions): JQuery;
|
||||
dxLoadPanel(options?: DevExpress.ui.dxLoadPanelOptions): JQuery;
|
||||
dxLookup(options?: DevExpress.ui.dxLookupOptions): JQuery;
|
||||
dxMap(options?: DevExpress.ui.dxMapOptions): JQuery;
|
||||
dxNavBar(options?: DevExpress.ui.dxNavBarOptions): JQuery;
|
||||
dxNumberBox(options?: DevExpress.ui.dxNumberBoxOptions): JQuery;
|
||||
dxOverlay(options?: DevExpress.ui.dxOverlayOptions): JQuery;
|
||||
dxPopup(options?: DevExpress.ui.dxPopupOptions): JQuery;
|
||||
dxPopover(options?: DevExpress.ui.dxPopoverOptions): JQuery;
|
||||
dxTooltip(options?: DevExpress.ui.dxTooltipOptions): JQuery;
|
||||
dxRadioGroup(options?: DevExpress.ui.dxRadioGroupOptions): JQuery;
|
||||
dxRangeSlider(options?: DevExpress.ui.dxRangeSliderOptions): JQuery;
|
||||
dxScrollable(options?: DevExpress.ui.dxScrollableOptions): JQuery;
|
||||
dxScrollView(options?: DevExpress.ui.dxScrollViewOptions): JQuery;
|
||||
dxSelectBox(options?: DevExpress.ui.dxSelectBoxOptions): JQuery;
|
||||
dxSlider(options?: DevExpress.ui.dxSliderOptions): JQuery;
|
||||
dxTabs(options?: DevExpress.ui.dxTabsOptions): JQuery;
|
||||
dxTextArea(options?: DevExpress.ui.dxTextAreaOptions): JQuery;
|
||||
dxTextBox(options?: DevExpress.ui.dxTextBoxOptions): JQuery;
|
||||
dxToast(options?: DevExpress.ui.dxToastOptions): JQuery;
|
||||
dxToolbar(options?: DevExpress.ui.dxToolbarOptions): JQuery;
|
||||
dxDropDownEditor(options?: DevExpress.ui.dxDropDownEditorOptions): JQuery;
|
||||
dxLoadIndicator(options?: DevExpress.ui.dxLoadIndicatorOptions): JQuery;
|
||||
dxMultiView(options?: DevExpress.ui.dxMultiViewOptions): JQuery;
|
||||
dxGallery(options?: DevExpress.ui.dxGalleryOptions): JQuery;
|
||||
dxActionSheet(options?: DevExpress.ui.dxActionSheetOptions): JQuery;
|
||||
dxDropDownMenu(options?: DevExpress.ui.dxDropDownMenuOptions): JQuery;
|
||||
dxPanorama(options?: DevExpress.ui.dxPanoramaOptions): JQuery;
|
||||
dxPivot(options?: DevExpress.ui.dxPivotOptions): JQuery;
|
||||
dxSwitch(options?: DevExpress.ui.dxSwitchOptions): JQuery;
|
||||
dxTileView(options?: DevExpress.ui.dxTileViewOptions): JQuery;
|
||||
dxSlideOut(options?: DevExpress.ui.dxSlideOutOptions): JQuery;
|
||||
interface JQuery {
|
||||
dxAutocomplete(options?: DevExpress.ui.dxAutocompleteOptions): JQuery;
|
||||
dxButton(options?: DevExpress.ui.dxButtonOptions): JQuery;
|
||||
dxCheckBox(options?: DevExpress.ui.dxCheckBoxOptions): JQuery;
|
||||
dxCalendar(options?: DevExpress.ui.dxCalendarOptions): JQuery;
|
||||
dxDateBox(options?: DevExpress.ui.dxDateBoxOptions): JQuery;
|
||||
dxTextEditor(options?: DevExpress.ui.dxTextEditorOptions): JQuery;
|
||||
dxList(options?: DevExpress.ui.dxListOptions): JQuery;
|
||||
dxLoadPanel(options?: DevExpress.ui.dxLoadPanelOptions): JQuery;
|
||||
dxLookup(options?: DevExpress.ui.dxLookupOptions): JQuery;
|
||||
dxMap(options?: DevExpress.ui.dxMapOptions): JQuery;
|
||||
dxNavBar(options?: DevExpress.ui.dxNavBarOptions): JQuery;
|
||||
dxNumberBox(options?: DevExpress.ui.dxNumberBoxOptions): JQuery;
|
||||
dxOverlay(options?: DevExpress.ui.dxOverlayOptions): JQuery;
|
||||
dxPopup(options?: DevExpress.ui.dxPopupOptions): JQuery;
|
||||
dxPopover(options?: DevExpress.ui.dxPopoverOptions): JQuery;
|
||||
dxTooltip(options?: DevExpress.ui.dxTooltipOptions): JQuery;
|
||||
dxRadioGroup(options?: DevExpress.ui.dxRadioGroupOptions): JQuery;
|
||||
dxRangeSlider(options?: DevExpress.ui.dxRangeSliderOptions): JQuery;
|
||||
dxScrollable(options?: DevExpress.ui.dxScrollableOptions): JQuery;
|
||||
dxScrollView(options?: DevExpress.ui.dxScrollViewOptions): JQuery;
|
||||
dxSelectBox(options?: DevExpress.ui.dxSelectBoxOptions): JQuery;
|
||||
dxSlider(options?: DevExpress.ui.dxSliderOptions): JQuery;
|
||||
dxTabs(options?: DevExpress.ui.dxTabsOptions): JQuery;
|
||||
dxTextArea(options?: DevExpress.ui.dxTextAreaOptions): JQuery;
|
||||
dxTextBox(options?: DevExpress.ui.dxTextBoxOptions): JQuery;
|
||||
dxToast(options?: DevExpress.ui.dxToastOptions): JQuery;
|
||||
dxToolbar(options?: DevExpress.ui.dxToolbarOptions): JQuery;
|
||||
dxDropDownEditor(options?: DevExpress.ui.dxDropDownEditorOptions): JQuery;
|
||||
dxLoadIndicator(options?: DevExpress.ui.dxLoadIndicatorOptions): JQuery;
|
||||
dxMultiView(options?: DevExpress.ui.dxMultiViewOptions): JQuery;
|
||||
dxGallery(options?: DevExpress.ui.dxGalleryOptions): JQuery;
|
||||
dxActionSheet(options?: DevExpress.ui.dxActionSheetOptions): JQuery;
|
||||
dxDropDownMenu(options?: DevExpress.ui.dxDropDownMenuOptions): JQuery;
|
||||
dxPanorama(options?: DevExpress.ui.dxPanoramaOptions): JQuery;
|
||||
dxPivot(options?: DevExpress.ui.dxPivotOptions): JQuery;
|
||||
dxSwitch(options?: DevExpress.ui.dxSwitchOptions): JQuery;
|
||||
dxTileView(options?: DevExpress.ui.dxTileViewOptions): JQuery;
|
||||
dxSlideOut(options?: DevExpress.ui.dxSlideOutOptions): JQuery;
|
||||
}
|
||||
Vendored
+133
-82
@@ -5,8 +5,8 @@
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
declare module DevExpress {
|
||||
export function abstract(): void;
|
||||
export var rtlEnabled: boolean;
|
||||
export var hardwareBackButton: JQueryCallback;
|
||||
interface Endpoint {
|
||||
@@ -84,8 +84,8 @@ export function abstract(): void;
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.data {
|
||||
export interface DataError extends Error {
|
||||
declare module DevExpress.data {
|
||||
export interface DataError extends Error {
|
||||
httpStatus?: number;
|
||||
errorDetails?: any;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ export interface DataError extends Error {
|
||||
export module queryAdapters {
|
||||
export function odata(queryOptions: ODataQueryOptions): RemoteQuery;
|
||||
}
|
||||
export interface DataSourceOptions {
|
||||
export interface DataSourceOptions {
|
||||
map? (item: any): any;
|
||||
postProcess? (result: any[]): any;
|
||||
pageSize: number;
|
||||
@@ -245,7 +245,7 @@ export interface DataSourceOptions {
|
||||
load(): JQueryPromise<any>;
|
||||
dispose(): void;
|
||||
}
|
||||
export interface StoreOptions {
|
||||
export interface StoreOptions {
|
||||
key?: any;
|
||||
errorHandler?: ErrorHandler;
|
||||
loaded?: (result: Array<any>) => void;
|
||||
@@ -351,8 +351,8 @@ export interface StoreOptions {
|
||||
objectLink(entityAlias: string, key: any): { __metadata: { uri: string }; };
|
||||
}
|
||||
}
|
||||
declare module DevExpress.framework {
|
||||
export interface dxViewOptions {
|
||||
declare module DevExpress.framework {
|
||||
export interface dxViewOptions {
|
||||
name: string;
|
||||
title?: string;
|
||||
layout?: string;
|
||||
@@ -690,8 +690,8 @@ export interface dxViewOptions {
|
||||
[key: string]: { execute(e: any): void; }
|
||||
};
|
||||
}
|
||||
declare module DevExpress.framework.html {
|
||||
export interface ILayoutController {
|
||||
declare module DevExpress.framework.html {
|
||||
export interface ILayoutController {
|
||||
viewReleased: JQueryCallback;
|
||||
init(options: InitLayoutControllerOptions): void;
|
||||
activate(): void;
|
||||
@@ -751,8 +751,8 @@ export interface ILayoutController {
|
||||
static create(container: JQuery, options: TransitionExecutorOptions): TransitionExecutor;
|
||||
}
|
||||
export interface ViewEngineOptions {
|
||||
$root?: JQuery;
|
||||
device?: IDevice;
|
||||
$root: JQuery;
|
||||
device: IDevice;
|
||||
commandManager?: CommandManager;
|
||||
templateEngine?: ITemplateEngine;
|
||||
dataOptionsAttributeName?: string;
|
||||
@@ -793,7 +793,11 @@ export interface ILayoutController {
|
||||
viewPort(): JQuery;
|
||||
}
|
||||
}
|
||||
declare module DevExpress.ui {
|
||||
declare module DevExpress.ui {
|
||||
export var themes: {
|
||||
current(): string;
|
||||
current(themeName: string): void;
|
||||
};
|
||||
interface ViewportOptions {
|
||||
allowPan?: boolean;
|
||||
allowZoom?: boolean;
|
||||
@@ -849,7 +853,7 @@ declare module DevExpress.ui {
|
||||
export function confirm(options: DialogOptions): JQueryPromise<boolean>;
|
||||
export function confirm(message: string, title?: string): JQueryPromise<boolean>;
|
||||
}
|
||||
export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
items?: Array<any>;
|
||||
itemTemplate?: any;
|
||||
itemRender?: Function;
|
||||
@@ -866,7 +870,7 @@ export interface CollectionContainerWidgetOptions extends WidgetOptions {
|
||||
constructor(element: Element, options?: CollectionContainerWidgetOptions);
|
||||
constructor(element: JQuery, options?: CollectionContainerWidgetOptions);
|
||||
}
|
||||
export interface WidgetOptions extends ComponentOptions {
|
||||
export interface WidgetOptions extends ComponentOptions {
|
||||
contentReadyAction?: any;
|
||||
width?: any;
|
||||
height?: any;
|
||||
@@ -880,7 +884,7 @@ export interface WidgetOptions extends ComponentOptions {
|
||||
repaint(): void;
|
||||
addTemplate(template: ITemplate): void;
|
||||
}
|
||||
export interface dxEditorOptions extends WidgetOptions {
|
||||
export interface dxEditorOptions extends WidgetOptions {
|
||||
value?: any;
|
||||
valueChangeAction?: any;
|
||||
}
|
||||
@@ -888,7 +892,7 @@ export interface dxEditorOptions extends WidgetOptions {
|
||||
constructor(element: Element, options?: dxEditorOptions);
|
||||
constructor(element: JQuery, options?: dxEditorOptions);
|
||||
}
|
||||
export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
minSearchLength?: number;
|
||||
searchTimeout?: number;
|
||||
placeholder?: string;
|
||||
@@ -904,22 +908,23 @@ export interface dxAutocompleteOptions extends dxDropDownEditorOptions {
|
||||
constructor(element: Element, options?: dxAutocompleteOptions);
|
||||
constructor(element: JQuery, options?: dxAutocompleteOptions);
|
||||
}
|
||||
export interface dxButtonOptions extends WidgetOptions {
|
||||
export interface dxButtonOptions extends WidgetOptions {
|
||||
type?: string;
|
||||
text?: string;
|
||||
text?: string;
|
||||
icon?: string;
|
||||
iconSrc?: string;
|
||||
clickAction?: any;
|
||||
}
|
||||
export class dxButton extends Widget {
|
||||
constructor(element: Element, options?: dxButtonOptions);
|
||||
constructor(element: JQuery, options?: dxButtonOptions);
|
||||
}
|
||||
export interface dxCheckBoxOptions extends dxEditorOptions { }
|
||||
export interface dxCheckBoxOptions extends dxEditorOptions { }
|
||||
export class dxCheckBox extends dxEditor {
|
||||
constructor(element: Element, options?: dxCheckBoxOptions);
|
||||
constructor(element: JQuery, options?: dxCheckBoxOptions);
|
||||
}
|
||||
export interface dxCalendarOptions extends dxEditorOptions {
|
||||
export interface dxCalendarOptions extends dxEditorOptions {
|
||||
value?: Date;
|
||||
min?: Date;
|
||||
max?: Date;
|
||||
@@ -929,7 +934,7 @@ export interface dxCalendarOptions extends dxEditorOptions {
|
||||
constructor(element: Element, options?: dxEditorOptions);
|
||||
constructor(element: JQuery, options?: dxEditorOptions);
|
||||
}
|
||||
export interface dxDateBoxOptions extends dxTextEditorOptions {
|
||||
export interface dxDateBoxOptions extends dxTextEditorOptions {
|
||||
format?: string;
|
||||
useNativePicker?: boolean;
|
||||
value?: Date;
|
||||
@@ -945,7 +950,7 @@ export interface dxDateBoxOptions extends dxTextEditorOptions {
|
||||
constructor(element: Element, options?: dxDateBoxOptions);
|
||||
constructor(element: JQuery, options?: dxDateBoxOptions);
|
||||
}
|
||||
export interface dxTextEditorOptions extends dxEditorOptions {
|
||||
export interface dxTextEditorOptions extends dxEditorOptions {
|
||||
valueChangeEvent?: string;
|
||||
placeholder?: string;
|
||||
readOnly?: boolean;
|
||||
@@ -969,7 +974,7 @@ export interface dxTextEditorOptions extends dxEditorOptions {
|
||||
focus(): void;
|
||||
blur(): void;
|
||||
}
|
||||
export interface dxListOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxListOptions extends CollectionContainerWidgetOptions {
|
||||
pullRefreshEnabled?: boolean;
|
||||
autoPagingEnabled?: boolean;
|
||||
scrollingEnabled?: boolean;
|
||||
@@ -1035,7 +1040,7 @@ export interface dxListOptions extends CollectionContainerWidgetOptions {
|
||||
scrollTo(targetLocation: number): void;
|
||||
scrollTop(): number;
|
||||
}
|
||||
export interface dxLoadPanelOptions extends dxOverlayOptions {
|
||||
export interface dxLoadPanelOptions extends dxOverlayOptions {
|
||||
message?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -1051,7 +1056,7 @@ export interface dxLoadPanelOptions extends dxOverlayOptions {
|
||||
show(): void;
|
||||
toggle(showing: boolean): void;
|
||||
}
|
||||
export interface dxLookupOptions extends dxEditorOptions {
|
||||
export interface dxLookupOptions extends dxEditorOptions {
|
||||
dataSource?: data.DataSource;
|
||||
displayValue?: string;
|
||||
title?: string;
|
||||
@@ -1103,7 +1108,7 @@ export interface dxLookupOptions extends dxEditorOptions {
|
||||
close(): void;
|
||||
open(): void;
|
||||
}
|
||||
export interface dxMapOptions extends WidgetOptions {
|
||||
export interface dxMapOptions extends WidgetOptions {
|
||||
location?: any;
|
||||
width?: number;
|
||||
height?: number;
|
||||
@@ -1132,12 +1137,12 @@ export interface dxMapOptions extends WidgetOptions {
|
||||
addRoute(routeOptions: any, callback: Function): JQueryPromise<any>;
|
||||
removeRoute(route: any): void;
|
||||
}
|
||||
export interface dxNavBarOptions extends dxTabsOptions { }
|
||||
export interface dxNavBarOptions extends dxTabsOptions { }
|
||||
export class dxNavBar extends dxTabs {
|
||||
constructor(element: Element, options?: dxNavBarOptions);
|
||||
constructor(element: JQuery, options?: dxNavBarOptions);
|
||||
}
|
||||
export interface dxNumberBoxOptions extends dxTextEditorOptions {
|
||||
export interface dxNumberBoxOptions extends dxTextEditorOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
value?: number;
|
||||
@@ -1148,7 +1153,7 @@ export interface dxNumberBoxOptions extends dxTextEditorOptions {
|
||||
constructor(element: Element, options?: dxNumberBoxOptions);
|
||||
constructor(element: JQuery, options?: dxNumberBoxOptions);
|
||||
}
|
||||
export interface dxOverlayOptions extends WidgetOptions {
|
||||
export interface dxOverlayOptions extends WidgetOptions {
|
||||
activeStateEnabled?: boolean;
|
||||
shading?: boolean;
|
||||
closeOnOutsideClick?: boolean;
|
||||
@@ -1170,7 +1175,7 @@ export interface dxOverlayOptions extends WidgetOptions {
|
||||
show(): void;
|
||||
toggle(showing: boolean): void;
|
||||
}
|
||||
export interface dxPopupOptions extends dxOverlayOptions {
|
||||
export interface dxPopupOptions extends dxOverlayOptions {
|
||||
title?: string;
|
||||
showTitle?: boolean;
|
||||
fullScreen?: boolean;
|
||||
@@ -1184,21 +1189,21 @@ export interface dxPopupOptions extends dxOverlayOptions {
|
||||
constructor(element: Element, options?: dxPopupOptions);
|
||||
constructor(element: JQuery, options?: dxPopupOptions);
|
||||
}
|
||||
export interface dxPopoverOptions extends dxPopupOptions {
|
||||
export interface dxPopoverOptions extends dxPopupOptions {
|
||||
target?: any;
|
||||
}
|
||||
export class dxPopover extends dxPopup {
|
||||
constructor(element: Element, options?: dxPopoverOptions);
|
||||
constructor(element: JQuery, options?: dxPopoverOptions);
|
||||
}
|
||||
export interface dxTooltipOptions extends dxPopoverOptions {
|
||||
export interface dxTooltipOptions extends dxPopoverOptions {
|
||||
target?: any;
|
||||
}
|
||||
export class dxTooltip extends dxPopover {
|
||||
constructor(element: Element, options?: dxTooltipOptions);
|
||||
constructor(element: JQuery, options?: dxTooltipOptions);
|
||||
}
|
||||
export interface dxRadioGroupOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxRadioGroupOptions extends CollectionContainerWidgetOptions {
|
||||
layout?: string;
|
||||
name?: string;
|
||||
value?: Object;
|
||||
@@ -1208,7 +1213,7 @@ export interface dxRadioGroupOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxRadioGroupOptions);
|
||||
constructor(element: JQuery, options?: dxRadioGroupOptions);
|
||||
}
|
||||
export interface dxRangeSliderOptions extends dxSliderOptions {
|
||||
export interface dxRangeSliderOptions extends dxSliderOptions {
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
@@ -1216,7 +1221,7 @@ export interface dxRangeSliderOptions extends dxSliderOptions {
|
||||
constructor(element: Element, options?: dxRangeSliderOptions);
|
||||
constructor(element: JQuery, options?: dxRangeSliderOptions);
|
||||
}
|
||||
export interface dxScrollableOptions extends ComponentOptions {
|
||||
export interface dxScrollableOptions extends ComponentOptions {
|
||||
startAction?: any;
|
||||
scrollAction?: any;
|
||||
endAction?: any;
|
||||
@@ -1246,7 +1251,7 @@ export interface dxScrollableOptions extends ComponentOptions {
|
||||
scrollTo(targetLocation: number): void;
|
||||
scrollTo(targetLocation: Object): void;
|
||||
}
|
||||
export interface dxScrollViewOptions extends dxScrollableOptions {
|
||||
export interface dxScrollViewOptions extends dxScrollableOptions {
|
||||
pullingDownText?: string;
|
||||
pulledDownText?: string;
|
||||
refreshingText?: string;
|
||||
@@ -1261,7 +1266,7 @@ export interface dxScrollViewOptions extends dxScrollableOptions {
|
||||
toggleLoading(showOrHide: boolean): void;
|
||||
refresh(): void;
|
||||
}
|
||||
export interface dxSelectBoxOptions extends dxAutocompleteOptions {
|
||||
export interface dxSelectBoxOptions extends dxAutocompleteOptions {
|
||||
fieldTemplate?: any;
|
||||
displayValue?: string;
|
||||
multiSelectEnabled?: boolean;
|
||||
@@ -1273,7 +1278,7 @@ export interface dxSelectBoxOptions extends dxAutocompleteOptions {
|
||||
constructor(element: Element, options?: dxSelectBoxOptions);
|
||||
constructor(element: JQuery, options?: dxSelectBoxOptions);
|
||||
}
|
||||
export interface dxSliderOptions extends dxEditorOptions {
|
||||
export interface dxSliderOptions extends dxEditorOptions {
|
||||
min?: number;
|
||||
max?: number;
|
||||
step?: number;
|
||||
@@ -1294,12 +1299,12 @@ export interface dxSliderOptions extends dxEditorOptions {
|
||||
constructor(element: Element, options?: dxSliderOptions);
|
||||
constructor(element: JQuery, options?: dxSliderOptions);
|
||||
}
|
||||
export interface dxTabsOptions extends CollectionContainerWidgetOptions { }
|
||||
export interface dxTabsOptions extends CollectionContainerWidgetOptions { }
|
||||
export class dxTabs extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxTabsOptions);
|
||||
constructor(element: JQuery, options?: dxTabsOptions);
|
||||
}
|
||||
export interface dxTextAreaOptions extends dxTextEditorOptions {
|
||||
export interface dxTextAreaOptions extends dxTextEditorOptions {
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
}
|
||||
@@ -1307,14 +1312,14 @@ export interface dxTextAreaOptions extends dxTextEditorOptions {
|
||||
constructor(element: Element, options?: dxTextAreaOptions);
|
||||
constructor(element: JQuery, options?: dxTextAreaOptions);
|
||||
}
|
||||
export interface dxTextBoxOptions extends dxTextEditorOptions {
|
||||
export interface dxTextBoxOptions extends dxTextEditorOptions {
|
||||
maxLength?: any;
|
||||
}
|
||||
export class dxTextBox extends dxTextEditor {
|
||||
constructor(element: Element, options?: dxTextBoxOptions);
|
||||
constructor(element: JQuery, options?: dxTextBoxOptions);
|
||||
}
|
||||
export interface dxToastOptions extends dxOverlayOptions {
|
||||
export interface dxToastOptions extends dxOverlayOptions {
|
||||
message?: string;
|
||||
type?: string;
|
||||
displayTime?: number;
|
||||
@@ -1323,7 +1328,7 @@ export interface dxToastOptions extends dxOverlayOptions {
|
||||
constructor(element: Element, options?: dxToastOptions);
|
||||
constructor(element: JQuery, options?: dxToastOptions);
|
||||
}
|
||||
export interface dxToolbarOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxToolbarOptions extends CollectionContainerWidgetOptions {
|
||||
menuItemRender?: Function;
|
||||
menuItemTemplate?: any;
|
||||
submenuType?: string;
|
||||
@@ -1333,7 +1338,7 @@ export interface dxToolbarOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxToolbarOptions);
|
||||
constructor(element: JQuery, options?: dxToolbarOptions);
|
||||
}
|
||||
export interface dxDropDownEditorOptions extends dxTextBoxOptions {
|
||||
export interface dxDropDownEditorOptions extends dxTextBoxOptions {
|
||||
closeAction?: any;
|
||||
openAction?: any;
|
||||
}
|
||||
@@ -1341,14 +1346,14 @@ export interface dxDropDownEditorOptions extends dxTextBoxOptions {
|
||||
constructor(element: Element, options?: dxDropDownEditorOptions);
|
||||
constructor(element: JQuery, options?: dxDropDownEditorOptions);
|
||||
}
|
||||
export interface dxLoadIndicatorOptions extends WidgetOptions {
|
||||
export interface dxLoadIndicatorOptions extends WidgetOptions {
|
||||
indicatorSrc?: string;
|
||||
}
|
||||
export class dxLoadIndicator extends Widget {
|
||||
constructor(element: Element, options?: dxLoadIndicatorOptions);
|
||||
constructor(element: JQuery, options?: dxLoadIndicatorOptions);
|
||||
}
|
||||
export interface dxMultiViewOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxMultiViewOptions extends CollectionContainerWidgetOptions {
|
||||
loop?: boolean;
|
||||
swipeEnabled?: boolean;
|
||||
animationEnabled?: boolean;
|
||||
@@ -1358,7 +1363,7 @@ export interface dxMultiViewOptions extends CollectionContainerWidgetOptions {
|
||||
constructor(element: Element, options?: dxMultiViewOptions);
|
||||
constructor(element: JQuery, options?: dxMultiViewOptions);
|
||||
}
|
||||
export interface dxGalleryOptions extends CollectionContainerWidgetOptions {
|
||||
export interface dxGalleryOptions extends CollectionContainerWidgetOptions {
|
||||
activeStateEnabled?: boolean;
|
||||
animationDuration?: number;
|
||||
loop?: boolean;
|
||||
@@ -1376,7 +1381,7 @@ export interface dxGalleryOptions extends CollectionContainerWidgetOptions {
|
||||
prevItem(animation?: boolean): JQueryPromise<dxGallery>;
|
||||
nextItem(animation?: boolean): JQueryPromise<dxGallery>;
|
||||
}
|
||||
export interface dxDataGridFilterDescriptions {
|
||||
export interface dxDataGridFilterDescriptions {
|
||||
'='?: string;
|
||||
'<>'?: string;
|
||||
'<'?: string;
|
||||
@@ -1536,6 +1541,7 @@ export interface dxDataGridFilterDescriptions {
|
||||
getSelectedRowKeys: () => Array<any>;
|
||||
getSelectedRowsData: () => Array<any>;
|
||||
selectRows: (keys: Array<any>) => void;
|
||||
selectRowsByIndexes: (indexes: Array<any>) => void;
|
||||
searchByText: (text: string) => void;
|
||||
insertRow: () => void;
|
||||
editRow: (rowIndex: number) => void;
|
||||
@@ -1560,38 +1566,83 @@ export interface dxDataGridFilterDescriptions {
|
||||
isScrollbarVisible: () => boolean;
|
||||
getTopVisibleRowData: () => {};
|
||||
}
|
||||
export interface dxMenuOptions extends CollectionContainerWidgetOptions {
|
||||
orientation?: string;
|
||||
submenuDirection?: string;
|
||||
showFirstSubmenuMode?: string;
|
||||
enableHotTrack?: boolean;
|
||||
allowSelection?: boolean;
|
||||
allowSelectOnClick?: boolean;
|
||||
selectedItem?: any;
|
||||
itemSelectAction?: any;
|
||||
cssClass?: string;
|
||||
}
|
||||
export interface dxContextMenuOptions extends CollectionContainerWidgetOptions {
|
||||
showSubmenuMode?: string;
|
||||
invokeOnlyFromCode?: boolean;
|
||||
cssClass?: string;
|
||||
enableHotTrack?: boolean;
|
||||
allowSelection?: boolean;
|
||||
allowSelectOnClick?: boolean;
|
||||
selectedItem?: any;
|
||||
itemSelectAction?: any;
|
||||
animation?: any;
|
||||
position?: any;
|
||||
showingAction?: any;
|
||||
submenuDirection?: string;
|
||||
}
|
||||
export class dxMenu extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxMenuOptions);
|
||||
constructor(element: JQuery, options?: dxMenuOptions);
|
||||
}
|
||||
export class dxContextMenu extends CollectionContainerWidget {
|
||||
constructor(element: Element, options?: dxContextMenuOptions);
|
||||
constructor(element: JQuery, options?: dxContextMenuOptions);
|
||||
}
|
||||
export interface dxColorPickerOptions extends dxDropDownEditorOptions {
|
||||
editAlphaChannel?: boolean;
|
||||
applyButtonText?: string;
|
||||
cancelButtonText?: string;
|
||||
}
|
||||
export class dxColorPicker extends dxDropDownEditor {
|
||||
constructor(element: Element, options?: dxColorPickerOptions);
|
||||
constructor(element: JQuery, options?: dxColorPickerOptions);
|
||||
}
|
||||
}
|
||||
interface JQuery {
|
||||
dxAutocomplete(options?: DevExpress.ui.dxAutocompleteOptions): JQuery;
|
||||
dxButton(options?: DevExpress.ui.dxButtonOptions): JQuery;
|
||||
dxCheckBox(options?: DevExpress.ui.dxCheckBoxOptions): JQuery;
|
||||
dxCalendar(options?: DevExpress.ui.dxCalendarOptions): JQuery;
|
||||
dxDateBox(options?: DevExpress.ui.dxDateBoxOptions): JQuery;
|
||||
dxTextEditor(options?: DevExpress.ui.dxTextEditorOptions): JQuery;
|
||||
dxList(options?: DevExpress.ui.dxListOptions): JQuery;
|
||||
dxLoadPanel(options?: DevExpress.ui.dxLoadPanelOptions): JQuery;
|
||||
dxLookup(options?: DevExpress.ui.dxLookupOptions): JQuery;
|
||||
dxMap(options?: DevExpress.ui.dxMapOptions): JQuery;
|
||||
dxNavBar(options?: DevExpress.ui.dxNavBarOptions): JQuery;
|
||||
dxNumberBox(options?: DevExpress.ui.dxNumberBoxOptions): JQuery;
|
||||
dxOverlay(options?: DevExpress.ui.dxOverlayOptions): JQuery;
|
||||
dxPopup(options?: DevExpress.ui.dxPopupOptions): JQuery;
|
||||
dxPopover(options?: DevExpress.ui.dxPopoverOptions): JQuery;
|
||||
dxTooltip(options?: DevExpress.ui.dxTooltipOptions): JQuery;
|
||||
dxRadioGroup(options?: DevExpress.ui.dxRadioGroupOptions): JQuery;
|
||||
dxRangeSlider(options?: DevExpress.ui.dxRangeSliderOptions): JQuery;
|
||||
dxScrollable(options?: DevExpress.ui.dxScrollableOptions): JQuery;
|
||||
dxScrollView(options?: DevExpress.ui.dxScrollViewOptions): JQuery;
|
||||
dxSelectBox(options?: DevExpress.ui.dxSelectBoxOptions): JQuery;
|
||||
dxSlider(options?: DevExpress.ui.dxSliderOptions): JQuery;
|
||||
dxTabs(options?: DevExpress.ui.dxTabsOptions): JQuery;
|
||||
dxTextArea(options?: DevExpress.ui.dxTextAreaOptions): JQuery;
|
||||
dxTextBox(options?: DevExpress.ui.dxTextBoxOptions): JQuery;
|
||||
dxToast(options?: DevExpress.ui.dxToastOptions): JQuery;
|
||||
dxToolbar(options?: DevExpress.ui.dxToolbarOptions): JQuery;
|
||||
dxDropDownEditor(options?: DevExpress.ui.dxDropDownEditorOptions): JQuery;
|
||||
dxLoadIndicator(options?: DevExpress.ui.dxLoadIndicatorOptions): JQuery;
|
||||
dxMultiView(options?: DevExpress.ui.dxMultiViewOptions): JQuery;
|
||||
dxGallery(options?: DevExpress.ui.dxGalleryOptions): JQuery;
|
||||
dxDataGrid(options?: DevExpress.ui.dxDataGridOptions): JQuery;
|
||||
interface JQuery {
|
||||
dxAutocomplete(options?: DevExpress.ui.dxAutocompleteOptions): JQuery;
|
||||
dxButton(options?: DevExpress.ui.dxButtonOptions): JQuery;
|
||||
dxCheckBox(options?: DevExpress.ui.dxCheckBoxOptions): JQuery;
|
||||
dxCalendar(options?: DevExpress.ui.dxCalendarOptions): JQuery;
|
||||
dxDateBox(options?: DevExpress.ui.dxDateBoxOptions): JQuery;
|
||||
dxTextEditor(options?: DevExpress.ui.dxTextEditorOptions): JQuery;
|
||||
dxList(options?: DevExpress.ui.dxListOptions): JQuery;
|
||||
dxLoadPanel(options?: DevExpress.ui.dxLoadPanelOptions): JQuery;
|
||||
dxLookup(options?: DevExpress.ui.dxLookupOptions): JQuery;
|
||||
dxMap(options?: DevExpress.ui.dxMapOptions): JQuery;
|
||||
dxNavBar(options?: DevExpress.ui.dxNavBarOptions): JQuery;
|
||||
dxNumberBox(options?: DevExpress.ui.dxNumberBoxOptions): JQuery;
|
||||
dxOverlay(options?: DevExpress.ui.dxOverlayOptions): JQuery;
|
||||
dxPopup(options?: DevExpress.ui.dxPopupOptions): JQuery;
|
||||
dxPopover(options?: DevExpress.ui.dxPopoverOptions): JQuery;
|
||||
dxTooltip(options?: DevExpress.ui.dxTooltipOptions): JQuery;
|
||||
dxRadioGroup(options?: DevExpress.ui.dxRadioGroupOptions): JQuery;
|
||||
dxRangeSlider(options?: DevExpress.ui.dxRangeSliderOptions): JQuery;
|
||||
dxScrollable(options?: DevExpress.ui.dxScrollableOptions): JQuery;
|
||||
dxScrollView(options?: DevExpress.ui.dxScrollViewOptions): JQuery;
|
||||
dxSelectBox(options?: DevExpress.ui.dxSelectBoxOptions): JQuery;
|
||||
dxSlider(options?: DevExpress.ui.dxSliderOptions): JQuery;
|
||||
dxTabs(options?: DevExpress.ui.dxTabsOptions): JQuery;
|
||||
dxTextArea(options?: DevExpress.ui.dxTextAreaOptions): JQuery;
|
||||
dxTextBox(options?: DevExpress.ui.dxTextBoxOptions): JQuery;
|
||||
dxToast(options?: DevExpress.ui.dxToastOptions): JQuery;
|
||||
dxToolbar(options?: DevExpress.ui.dxToolbarOptions): JQuery;
|
||||
dxDropDownEditor(options?: DevExpress.ui.dxDropDownEditorOptions): JQuery;
|
||||
dxLoadIndicator(options?: DevExpress.ui.dxLoadIndicatorOptions): JQuery;
|
||||
dxMultiView(options?: DevExpress.ui.dxMultiViewOptions): JQuery;
|
||||
dxGallery(options?: DevExpress.ui.dxGalleryOptions): JQuery;
|
||||
dxDataGrid(options?: DevExpress.ui.dxDataGridOptions): JQuery;
|
||||
dxMenu(options?: DevExpress.ui.dxMenuOptions): JQuery;
|
||||
dxContextMenu(options?: DevExpress.ui.dxContextMenuOptions): JQuery;
|
||||
dxColorPicker(options?: DevExpress.ui.dxColorPickerOptions): JQuery;
|
||||
}
|
||||
Vendored
+3
-3
@@ -101908,7 +101908,7 @@ declare module dijit {
|
||||
* @param callback
|
||||
* @param onError
|
||||
*/
|
||||
getChildren(parentItem: dojo.data.api.Item, callback: {(items:any[])}, onError: Function): void;
|
||||
getChildren(parentItem: dojo.data.api.Item, callback: {(items:any[]):any;}, onError: Function): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
@@ -102160,7 +102160,7 @@ declare module dijit {
|
||||
* @param onComplete
|
||||
* @param onError
|
||||
*/
|
||||
getChildren(parentItem: Object, onComplete: {(items:any[])}, onError: Function): void;
|
||||
getChildren(parentItem: Object, onComplete: {(items:any[]):any;}, onError: Function): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
@@ -102331,7 +102331,7 @@ declare module dijit {
|
||||
* @param onComplete
|
||||
* @param onError
|
||||
*/
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:any[])}, onError: Function): void;
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:any[]):any;}, onError: Function): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
|
||||
Vendored
+1
-2
@@ -4,7 +4,6 @@
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="dojo.d.ts" />
|
||||
/// <reference path="dojox.geo.d.ts" />
|
||||
declare module dojox {
|
||||
|
||||
/**
|
||||
@@ -5277,7 +5276,7 @@ declare module dojox {
|
||||
* @param c an x component of a central point, or a central point
|
||||
* @param d a y component of a central point
|
||||
*/
|
||||
scaleAt(a: number, b: number, c: dojox.geo.openlayers.Point, d: number): dojox.gfx.matrix.Matrix2D;
|
||||
scaleAt(a: number, b: number, c: dojox.gfx.Point, d: number): dojox.gfx.matrix.Matrix2D;
|
||||
/**
|
||||
* forms an x skewing matrix
|
||||
* The resulting matrix is used to skew points in the x dimension
|
||||
|
||||
Vendored
+4
-4
@@ -7381,7 +7381,7 @@ declare module dojox {
|
||||
* @param onError
|
||||
* @param queryObj
|
||||
*/
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:Object[], size?:number)}, onError: Function, queryObj?: Object): void;
|
||||
getChildren(parentItem: dojo.data.api.Item, onComplete: {(items:Object[], size?:number): any;}, onError: Function, queryObj?: Object): void;
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
@@ -21624,19 +21624,19 @@ declare module dojox {
|
||||
* @param searchArgs
|
||||
* @param onSearched
|
||||
*/
|
||||
searchRow(searchArgs: Object, onSearched: {(index:number,item:Object)}): void;
|
||||
searchRow(searchArgs: Object, onSearched: {(index:number,item:Object): any;}): void;
|
||||
/**
|
||||
*
|
||||
* @param searchArgs
|
||||
* @param onSearched
|
||||
*/
|
||||
searchRow(searchArgs: RegExp, onSearched: {(index:number,item:Object)}): void;
|
||||
searchRow(searchArgs: RegExp, onSearched: {(index:number,item:Object): any;}): void;
|
||||
/**
|
||||
*
|
||||
* @param searchArgs
|
||||
* @param onSearched
|
||||
*/
|
||||
searchRow(searchArgs: String, onSearched: {(index:number,item:Object)}): void;
|
||||
searchRow(searchArgs: String, onSearched: {(index:number,item:Object): any;}): void;
|
||||
/**
|
||||
* Subscribes to the specified topic and calls the specified method
|
||||
* of this object.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
///<reference path="dotdotdot.d.ts" />
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
$("span").dotdotdot({ ellipsis: ":::" });
|
||||
$("span").dotdotdot({ wrap: "letter" });
|
||||
$("span").dotdotdot({ fallbackToLetter: false });
|
||||
$("span").dotdotdot({ after: $("#after") });
|
||||
$("span").dotdotdot({ watch: true });
|
||||
$("span").dotdotdot({ height: 42 });
|
||||
$("span").dotdotdot({ tolerance: 69 });
|
||||
$("span").dotdotdot({ callback: () => { } });
|
||||
$("span").dotdotdot({ callback: (isTruncated: boolean) => { } });
|
||||
$("span").dotdotdot({ callback: (isTruncated: boolean, orgContent: any) => { } });
|
||||
$("span").dotdotdot({ lastCharacter: {} });
|
||||
$("span").dotdotdot({ lastCharacter: { remove: [','] } });
|
||||
$("span").dotdotdot({ lastCharacter: { noEllipsis: ['.', '.'] } });
|
||||
|
||||
// Copied from documentation
|
||||
$("#wrapper").dotdotdot({
|
||||
/* The text to add as ellipsis. */
|
||||
ellipsis: '... ',
|
||||
|
||||
/* How to cut off the text/html: 'word'/'letter'/'children' */
|
||||
wrap: 'word',
|
||||
|
||||
/* Wrap-option fallback to 'letter' for long words */
|
||||
fallbackToLetter: true,
|
||||
|
||||
/* jQuery-selector for the element to keep and put after the ellipsis. */
|
||||
after: null,
|
||||
|
||||
/* Whether to update the ellipsis: true/'window' */
|
||||
watch: false,
|
||||
|
||||
/* Optionally set a max-height, if null, the height will be measured. */
|
||||
height: null,
|
||||
|
||||
/* Deviation for the height-option. */
|
||||
tolerance: 0,
|
||||
|
||||
/* Callback function that is fired after the ellipsis is added,
|
||||
receives two parameters: isTruncated(boolean), orgContent(string). */
|
||||
callback: function (isTruncated, orgContent) { },
|
||||
|
||||
lastCharacter: {
|
||||
|
||||
/* Remove these characters from the end of the truncated text. */
|
||||
remove: [' ', ',', ';', '.', '!', '?'],
|
||||
|
||||
/* Don't add an ellipsis if this array contains
|
||||
the last character of the truncated text. */
|
||||
noEllipsis: []
|
||||
}
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user