mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge remote-tracking branch 'origin/master' into patch-1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
|
||||
[](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
@@ -96,7 +96,7 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
|
||||
// Steve <https://github.com/steve>
|
||||
// John <https://github.com/john>
|
||||
```
|
||||
* `npm install -g typescript@2.0` and run `tsc`.
|
||||
* If there is a `tslint.json`, run `npm run lint package-name`. Otherwise, run `tsc` in the package directory.
|
||||
|
||||
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
|
||||
If it doesn't, you can do so yourself in the comment associated with the PR.
|
||||
|
||||
@@ -138,6 +138,12 @@
|
||||
"sourceRepoURL": "https://github.com/loopline-systems/electron-builder",
|
||||
"asOfVersion": "2.8.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "eventemitter2",
|
||||
"typingsPackageName": "eventemitter2",
|
||||
"sourceRepoURL": "https://github.com/asyncly/EventEmitter2",
|
||||
"asOfVersion": "4.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "EventEmitter3",
|
||||
"typingsPackageName": "eventemitter3",
|
||||
@@ -288,6 +294,12 @@
|
||||
"sourceRepoURL": "https://github.com/localForage/localForage",
|
||||
"asOfVersion": "0.0.34"
|
||||
},
|
||||
{
|
||||
"libraryName": "lodash-decorators",
|
||||
"typingsPackageName": "lodash-decorators",
|
||||
"sourceRepoURL": "https://github.com/steelsojka/lodash-decorators",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "lower-case",
|
||||
"typingsPackageName": "lower-case",
|
||||
@@ -420,6 +432,12 @@
|
||||
"sourceRepoURL": "https://github.com/angular/protractor",
|
||||
"asOfVersion": "4.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "qiniu",
|
||||
"typingsPackageName": "qiniu",
|
||||
"sourceRepoURL": "https://github.com/qiniu/nodejs-sdk",
|
||||
"asOfVersion": "7.0.1"
|
||||
},
|
||||
{
|
||||
"libraryName": "Raven JS",
|
||||
"typingsPackageName": "raven-js",
|
||||
|
||||
+4
-1
@@ -17,11 +17,14 @@
|
||||
"scripts": {
|
||||
"compile-scripts": "tsc -p scripts",
|
||||
"not-needed": "node scripts/not-needed.js",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1",
|
||||
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "Microsoft/dtslint#production",
|
||||
"types-publisher": "Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {
|
||||
"jslint": "^0.10.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
function repeat(s: string, count: number) {
|
||||
return Array(count + 1).join(s);
|
||||
}
|
||||
|
||||
const home = path.join(__dirname, '..');
|
||||
|
||||
for (const dirName of fs.readdirSync(home)) {
|
||||
|
||||
Vendored
+14
@@ -1041,6 +1041,12 @@ declare namespace AceAjax {
|
||||
addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any): void;
|
||||
addEventListener(ev: string, callback: Function): void;
|
||||
|
||||
off(ev: string, callback: Function): void;
|
||||
|
||||
removeListener(ev: string, callback: Function): void;
|
||||
|
||||
removeEventListener(ev: string, callback: Function): void;
|
||||
|
||||
inMultiSelectMode: boolean;
|
||||
|
||||
selectMoreLines(n: number): void;
|
||||
@@ -2166,8 +2172,16 @@ declare namespace AceAjax {
|
||||
**/
|
||||
export interface Selection {
|
||||
|
||||
on(ev: string, callback: Function): void;
|
||||
|
||||
addEventListener(ev: string, callback: Function): void;
|
||||
|
||||
off(ev: string, callback: Function): void;
|
||||
|
||||
removeListener(ev: string, callback: Function): void;
|
||||
|
||||
removeEventListener(ev: string, callback: Function): void;
|
||||
|
||||
moveCursorWordLeft(): void;
|
||||
|
||||
moveCursorWordRight(): void;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
let obj0 = new ActiveXObject('ADODB.Command');
|
||||
|
||||
let obj1 = new ActiveXObject('ADODB.Connection');
|
||||
|
||||
let obj2 = new ActiveXObject('ADODB.Parameter');
|
||||
|
||||
let obj3 = new ActiveXObject('ADODB.Record');
|
||||
|
||||
let obj4 = new ActiveXObject('ADODB.Recordset');
|
||||
|
||||
let obj5 = new ActiveXObject('ADODB.Stream');
|
||||
|
||||
// open connection to an Excel file
|
||||
let pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
|
||||
let conn = new ActiveXObject('ADODB.Connection');
|
||||
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
|
||||
conn.ConnectionString =
|
||||
'Data Source="' + pathToExcelFile + '";' +
|
||||
'Extended Properties="Excel 12.0;HDR=Yes"';
|
||||
conn.Open();
|
||||
|
||||
// create a Command to access the data
|
||||
let cmd = new ActiveXObject('ADODB.Command');
|
||||
cmd.CommandText = 'SELECT DISTINCT LastName, CityName FROM [Sheet1$]';
|
||||
// get a Recordset
|
||||
let rs = cmd.Execute();
|
||||
// build a string from the Recordset
|
||||
let s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)');
|
||||
rs.Close();
|
||||
WScript.Echo(s);
|
||||
+319
-146
@@ -1,11 +1,9 @@
|
||||
// Type definitions for Microsoft ActiveX Data Objects
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms675532(v=vs.85).aspx
|
||||
// Type definitions for Microsoft ActiveX Data Objects 6.1
|
||||
// Project: https://msdn.microsoft.com/en-us/library/jj249010.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace ADODB {
|
||||
|
||||
//Enums
|
||||
const enum ADCPROP_ASYNCTHREADPRIORITY_ENUM {
|
||||
adPriorityAboveNormal = 4,
|
||||
adPriorityBelowNormal = 2,
|
||||
@@ -595,240 +593,415 @@ declare namespace ADODB {
|
||||
adXactSyncPhaseOne = 1048576
|
||||
}
|
||||
|
||||
//Interfaces
|
||||
interface Command {
|
||||
ActiveConnection: Connection;
|
||||
Cancel: () => void;
|
||||
CommandStream: any /*VT_UNKNOWN*/;
|
||||
Cancel(): void;
|
||||
CommandStream: any;
|
||||
CommandText: string;
|
||||
CommandTimeout: number;
|
||||
CommandType: CommandTypeEnum;
|
||||
CreateParameter: (Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any) => Parameter;
|
||||
|
||||
/**
|
||||
* @param string [Name='']
|
||||
* @param ADODB.DataTypeEnum [Type=0]
|
||||
* @param ADODB.ParameterDirectionEnum [Direction=1]
|
||||
* @param number [Size=0]
|
||||
*/
|
||||
CreateParameter(Name?: string, Type?: DataTypeEnum, Direction?: ParameterDirectionEnum, Size?: number, Value?: any): Parameter;
|
||||
Dialect: string;
|
||||
Execute: (RecordsAffected?: any, Parameters?: any, Options?: number) => Recordset;
|
||||
|
||||
/** @param number [Options=-1] */
|
||||
Execute(RecordsAffected?: any, Parameters?: any, Options?: number): Recordset;
|
||||
Name: string;
|
||||
NamedParameters: boolean;
|
||||
Parameters: Parameters;
|
||||
readonly Parameters: Parameters;
|
||||
Prepared: boolean;
|
||||
Properties: Properties;
|
||||
State: number;
|
||||
readonly Properties: Properties;
|
||||
readonly State: number;
|
||||
}
|
||||
|
||||
interface Connection {
|
||||
Attributes: number;
|
||||
BeginTrans: () => number;
|
||||
Cancel: () => void;
|
||||
Close: () => void;
|
||||
BeginTrans(): number;
|
||||
Cancel(): void;
|
||||
Close(): void;
|
||||
CommandTimeout: number;
|
||||
CommitTrans: () => void;
|
||||
CommitTrans(): void;
|
||||
ConnectionString: string;
|
||||
ConnectionTimeout: number;
|
||||
CursorLocation: CursorLocationEnum;
|
||||
DefaultDatabase: string;
|
||||
Errors: Errors;
|
||||
Execute: (CommandText: string, RecordsAffected: any, Options?: number) => Recordset;
|
||||
readonly Errors: Errors;
|
||||
|
||||
/** @param number [Options=-1] */
|
||||
Execute(CommandText: string, RecordsAffected: any, Options?: number): Recordset;
|
||||
IsolationLevel: IsolationLevelEnum;
|
||||
Mode: ConnectModeEnum;
|
||||
Open: (ConnectionString?: string, UserID?: string, Password?: string, Options?: number) => void;
|
||||
OpenSchema: (Schema: SchemaEnum, Restrictions?: any, SchemaID?: any) => Recordset;
|
||||
Properties: Properties;
|
||||
|
||||
/**
|
||||
* @param string [ConnectionString='']
|
||||
* @param string [UserID='']
|
||||
* @param string [Password='']
|
||||
* @param number [Options=-1]
|
||||
*/
|
||||
Open(ConnectionString?: string, UserID?: string, Password?: string, Options?: number): void;
|
||||
OpenSchema(Schema: SchemaEnum, Restrictions?: any, SchemaID?: any): Recordset;
|
||||
readonly Properties: Properties;
|
||||
Provider: string;
|
||||
RollbackTrans: () => void;
|
||||
State: number;
|
||||
Version: string;
|
||||
RollbackTrans(): void;
|
||||
readonly State: number;
|
||||
readonly Version: string;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
Description: string;
|
||||
HelpContext: number;
|
||||
HelpFile: string;
|
||||
NativeError: number;
|
||||
Number: number;
|
||||
Source: string;
|
||||
SQLState: string;
|
||||
readonly Description: string;
|
||||
readonly HelpContext: number;
|
||||
readonly HelpFile: string;
|
||||
readonly NativeError: number;
|
||||
readonly Number: number;
|
||||
readonly Source: string;
|
||||
readonly SQLState: string;
|
||||
}
|
||||
|
||||
interface Errors {
|
||||
Clear: () => void;
|
||||
Count: number;
|
||||
Item: (Index: any) => Error;
|
||||
Refresh: () => void;
|
||||
Clear(): void;
|
||||
readonly Count: number;
|
||||
Item(Index: any): Error;
|
||||
Refresh(): void;
|
||||
}
|
||||
|
||||
interface Field {
|
||||
ActualSize: number;
|
||||
AppendChunk: (Data: any) => void;
|
||||
readonly ActualSize: number;
|
||||
AppendChunk(Data: any): void;
|
||||
Attributes: number;
|
||||
DataFormat: any /*VT_UNKNOWN*/;
|
||||
DataFormat: any;
|
||||
DefinedSize: number;
|
||||
GetChunk: (Length: number) => any;
|
||||
Name: string;
|
||||
GetChunk(Length: number): any;
|
||||
readonly Name: string;
|
||||
NumericScale: number;
|
||||
OriginalValue: any;
|
||||
readonly OriginalValue: any;
|
||||
Precision: number;
|
||||
Properties: Properties;
|
||||
Status: number;
|
||||
readonly Properties: Properties;
|
||||
readonly Status: number;
|
||||
Type: DataTypeEnum;
|
||||
UnderlyingValue: any;
|
||||
readonly UnderlyingValue: any;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Fields {
|
||||
_Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum) => void;
|
||||
Append: (Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any) => void;
|
||||
CancelUpdate: () => void;
|
||||
Count: number;
|
||||
Delete: (Index: any) => void;
|
||||
Item: (Index: any) => Field;
|
||||
Refresh: () => void;
|
||||
Resync: (ResyncValues?: ResyncEnum) => void;
|
||||
Update: () => void;
|
||||
/**
|
||||
* @param number [DefinedSize=0]
|
||||
* @param ADODB.FieldAttributeEnum [Attrib=-1]
|
||||
*/
|
||||
_Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum): void;
|
||||
|
||||
/**
|
||||
* @param number [DefinedSize=0]
|
||||
* @param ADODB.FieldAttributeEnum [Attrib=-1]
|
||||
*/
|
||||
Append(Name: string, Type: DataTypeEnum, DefinedSize?: number, Attrib?: FieldAttributeEnum, FieldValue?: any): void;
|
||||
CancelUpdate(): void;
|
||||
readonly Count: number;
|
||||
Delete(Index: any): void;
|
||||
Item(Index: any): Field;
|
||||
Refresh(): void;
|
||||
|
||||
/** @param ADODB.ResyncEnum [ResyncValues=2] */
|
||||
Resync(ResyncValues?: ResyncEnum): void;
|
||||
Update(): void;
|
||||
}
|
||||
|
||||
interface Parameter {
|
||||
AppendChunk: (Val: any) => void;
|
||||
AppendChunk(Val: any): void;
|
||||
Attributes: number;
|
||||
Direction: ParameterDirectionEnum;
|
||||
Name: string;
|
||||
NumericScale: number;
|
||||
Precision: number;
|
||||
Properties: Properties;
|
||||
readonly Properties: Properties;
|
||||
Size: number;
|
||||
Type: DataTypeEnum;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Parameters {
|
||||
Append: (Object: any /*VT_DISPATCH*/) => void;
|
||||
Count: number;
|
||||
Delete: (Index: any) => void;
|
||||
Item: (Index: any) => Parameter;
|
||||
Refresh: () => void;
|
||||
Append(Object: any): void;
|
||||
readonly Count: number;
|
||||
Delete(Index: any): void;
|
||||
Item(Index: any): Parameter;
|
||||
Refresh(): void;
|
||||
}
|
||||
|
||||
interface Properties {
|
||||
Count: number;
|
||||
Item: (Index: any) => Property;
|
||||
Refresh: () => void;
|
||||
readonly Count: number;
|
||||
Item(Index: any): Property;
|
||||
Refresh(): void;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
Attributes: number;
|
||||
Name: string;
|
||||
Type: DataTypeEnum;
|
||||
readonly Name: string;
|
||||
readonly Type: DataTypeEnum;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Record {
|
||||
ActiveConnection: any;
|
||||
Cancel: () => void;
|
||||
Close: () => void;
|
||||
CopyRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean) => string;
|
||||
DeleteRecord: (Source?: string, Async?: boolean) => void;
|
||||
Fields: Fields;
|
||||
GetChildren: () => Recordset;
|
||||
Cancel(): void;
|
||||
Close(): void;
|
||||
|
||||
/**
|
||||
* @param string [Source='']
|
||||
* @param string [Destination='']
|
||||
* @param string [UserName='']
|
||||
* @param string [Password='']
|
||||
* @param ADODB.CopyRecordOptionsEnum [Options=-1]
|
||||
* @param boolean [Async=false]
|
||||
*/
|
||||
CopyRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: CopyRecordOptionsEnum, Async?: boolean): string;
|
||||
|
||||
/**
|
||||
* @param string [Source='']
|
||||
* @param boolean [Async=false]
|
||||
*/
|
||||
DeleteRecord(Source?: string, Async?: boolean): void;
|
||||
readonly Fields: Fields;
|
||||
GetChildren(): Recordset;
|
||||
Mode: ConnectModeEnum;
|
||||
MoveRecord: (Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean) => string;
|
||||
Open: (Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string) => void;
|
||||
ParentURL: string;
|
||||
Properties: Properties;
|
||||
RecordType: RecordTypeEnum;
|
||||
|
||||
/**
|
||||
* @param string [Source='']
|
||||
* @param string [Destination='']
|
||||
* @param string [UserName='']
|
||||
* @param string [Password='']
|
||||
* @param ADODB.MoveRecordOptionsEnum [Options=-1]
|
||||
* @param boolean [Async=false]
|
||||
*/
|
||||
MoveRecord(Source?: string, Destination?: string, UserName?: string, Password?: string, Options?: MoveRecordOptionsEnum, Async?: boolean): string;
|
||||
|
||||
/**
|
||||
* @param ADODB.ConnectModeEnum [Mode=0]
|
||||
* @param ADODB.RecordCreateOptionsEnum [CreateOptions=-1]
|
||||
* @param ADODB.RecordOpenOptionsEnum [Options=-1]
|
||||
* @param string [UserName='']
|
||||
* @param string [Password='']
|
||||
*/
|
||||
Open(Source: any, ActiveConnection: any, Mode?: ConnectModeEnum, CreateOptions?: RecordCreateOptionsEnum, Options?: RecordOpenOptionsEnum, UserName?: string, Password?: string): void;
|
||||
readonly ParentURL: string;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordType: RecordTypeEnum;
|
||||
Source: any;
|
||||
State: ObjectStateEnum;
|
||||
readonly State: ObjectStateEnum;
|
||||
}
|
||||
|
||||
interface Recordset {
|
||||
_xClone: () => Recordset;
|
||||
_xResync: (AffectRecords?: AffectEnum) => void;
|
||||
_xSave: (FileName?: string, PersistFormat?: PersistFormatEnum) => void;
|
||||
_xClone(): Recordset;
|
||||
|
||||
/** @param ADODB.AffectEnum [AffectRecords=3] */
|
||||
_xResync(AffectRecords?: AffectEnum): void;
|
||||
|
||||
/**
|
||||
* @param string [FileName='']
|
||||
* @param ADODB.PersistFormatEnum [PersistFormat=0]
|
||||
*/
|
||||
_xSave(FileName?: string, PersistFormat?: PersistFormatEnum): void;
|
||||
AbsolutePage: PositionEnum;
|
||||
AbsolutePosition: PositionEnum;
|
||||
ActiveCommand: any /*VT_DISPATCH*/;
|
||||
ActiveConnection: any /*VT_DISPATCH*/;
|
||||
AddNew: (FieldList?: any, Values?: any) => void;
|
||||
BOF: boolean;
|
||||
readonly ActiveCommand: any;
|
||||
ActiveConnection: any;
|
||||
AddNew(FieldList?: any, Values?: any): void;
|
||||
readonly BOF: boolean;
|
||||
Bookmark: any;
|
||||
CacheSize: number;
|
||||
Cancel: () => void;
|
||||
CancelBatch: (AffectRecords?: AffectEnum) => void;
|
||||
CancelUpdate: () => void;
|
||||
Clone: (LockType?: LockTypeEnum) => Recordset;
|
||||
Close: () => void;
|
||||
Collect: (Index: any) => any; //Also has setter with parameters
|
||||
CompareBookmarks: (Bookmark1: any, Bookmark2: any) => CompareEnum;
|
||||
Cancel(): void;
|
||||
|
||||
/** @param ADODB.AffectEnum [AffectRecords=3] */
|
||||
CancelBatch(AffectRecords?: AffectEnum): void;
|
||||
CancelUpdate(): void;
|
||||
|
||||
/** @param ADODB.LockTypeEnum [LockType=-1] */
|
||||
Clone(LockType?: LockTypeEnum): Recordset;
|
||||
Close(): void;
|
||||
Collect(Index: any): any;
|
||||
CompareBookmarks(Bookmark1: any, Bookmark2: any): CompareEnum;
|
||||
CursorLocation: CursorLocationEnum;
|
||||
CursorType: CursorTypeEnum;
|
||||
DataMember: string;
|
||||
DataSource: any /*VT_UNKNOWN*/;
|
||||
Delete: (AffectRecords?: AffectEnum) => void;
|
||||
EditMode: EditModeEnum;
|
||||
EOF: boolean;
|
||||
Fields: Fields;
|
||||
DataSource: any;
|
||||
|
||||
/** @param ADODB.AffectEnum [AffectRecords=1] */
|
||||
Delete(AffectRecords?: AffectEnum): void;
|
||||
readonly EditMode: EditModeEnum;
|
||||
readonly EOF: boolean;
|
||||
readonly Fields: Fields;
|
||||
Filter: any;
|
||||
Find: (Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any) => void;
|
||||
GetRows: (Rows?: number, Start?: any, Fields?: any) => any;
|
||||
GetString: (StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string) => string;
|
||||
|
||||
/**
|
||||
* @param number [SkipRecords=0]
|
||||
* @param ADODB.SearchDirectionEnum [SearchDirection=1]
|
||||
*/
|
||||
Find(Criteria: string, SkipRecords?: number, SearchDirection?: SearchDirectionEnum, Start?: any): void;
|
||||
|
||||
/** @param number [Rows=-1] */
|
||||
GetRows(Rows?: number, Start?: any, Fields?: any): any;
|
||||
|
||||
/**
|
||||
* @param ADODB.StringFormatEnum [StringFormat=2]
|
||||
* @param number [NumRows=-1]
|
||||
* @param string [ColumnDelimeter='']
|
||||
* @param string [RowDelimeter='']
|
||||
* @param string [NullExpr='']
|
||||
*/
|
||||
GetString(StringFormat?: StringFormatEnum, NumRows?: number, ColumnDelimeter?: string, RowDelimeter?: string, NullExpr?: string): string;
|
||||
Index: string;
|
||||
LockType: LockTypeEnum;
|
||||
MarshalOptions: MarshalOptionsEnum;
|
||||
MaxRecords: number;
|
||||
Move: (NumRecords: number, Start?: any) => void;
|
||||
MoveFirst: () => void;
|
||||
MoveLast: () => void;
|
||||
MoveNext: () => void;
|
||||
MovePrevious: () => void;
|
||||
NextRecordset: (RecordsAffected?: any) => Recordset;
|
||||
Open: (Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number) => void;
|
||||
PageCount: number;
|
||||
Move(NumRecords: number, Start?: any): void;
|
||||
MoveFirst(): void;
|
||||
MoveLast(): void;
|
||||
MoveNext(): void;
|
||||
MovePrevious(): void;
|
||||
NextRecordset(RecordsAffected?: any): Recordset;
|
||||
|
||||
/**
|
||||
* @param ADODB.CursorTypeEnum [CursorType=-1]
|
||||
* @param ADODB.LockTypeEnum [LockType=-1]
|
||||
* @param number [Options=-1]
|
||||
*/
|
||||
Open(Source: any, ActiveConnection: any, CursorType?: CursorTypeEnum, LockType?: LockTypeEnum, Options?: number): void;
|
||||
readonly PageCount: number;
|
||||
PageSize: number;
|
||||
Properties: Properties;
|
||||
RecordCount: number;
|
||||
Requery: (Options?: number) => void;
|
||||
Resync: (AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum) => void;
|
||||
Save: (Destination: any, PersistFormat?: PersistFormatEnum) => void;
|
||||
Seek: (KeyValues: any, SeekOption?: SeekEnum) => void;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordCount: number;
|
||||
|
||||
/** @param number [Options=-1] */
|
||||
Requery(Options?: number): void;
|
||||
|
||||
/**
|
||||
* @param ADODB.AffectEnum [AffectRecords=3]
|
||||
* @param ADODB.ResyncEnum [ResyncValues=2]
|
||||
*/
|
||||
Resync(AffectRecords?: AffectEnum, ResyncValues?: ResyncEnum): void;
|
||||
|
||||
/** @param ADODB.PersistFormatEnum [PersistFormat=0] */
|
||||
Save(Destination: any, PersistFormat?: PersistFormatEnum): void;
|
||||
|
||||
/** @param ADODB.SeekEnum [SeekOption=1] */
|
||||
Seek(KeyValues: any, SeekOption?: SeekEnum): void;
|
||||
Sort: string;
|
||||
Source: any /*VT_DISPATCH*/;
|
||||
State: number;
|
||||
Status: number;
|
||||
Source: any;
|
||||
readonly State: number;
|
||||
readonly Status: number;
|
||||
StayInSync: boolean;
|
||||
Supports: (CursorOptions: CursorOptionEnum) => boolean;
|
||||
Update: (Fields?: any, Values?: any) => void;
|
||||
UpdateBatch: (AffectRecords?: AffectEnum) => void;
|
||||
Supports(CursorOptions: CursorOptionEnum): boolean;
|
||||
Update(Fields?: any, Values?: any): void;
|
||||
|
||||
/** @param ADODB.AffectEnum [AffectRecords=3] */
|
||||
UpdateBatch(AffectRecords?: AffectEnum): void;
|
||||
}
|
||||
|
||||
interface Stream {
|
||||
Cancel: () => void;
|
||||
Cancel(): void;
|
||||
Charset: string;
|
||||
Close: () => void;
|
||||
CopyTo: (DestStream: Stream, CharNumber?: number) => void;
|
||||
EOS: boolean;
|
||||
Flush: () => void;
|
||||
LineSeparator: LineSeparatorEnum;
|
||||
LoadFromFile: (FileName: string) => void;
|
||||
Mode: ConnectModeEnum;
|
||||
Open: (Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string) => void;
|
||||
Position: number;
|
||||
Read: (NumBytes?: number) => any;
|
||||
ReadText: (NumChars?: number) => string;
|
||||
SaveToFile: (FileName: string, Options?: SaveOptionsEnum) => void;
|
||||
SetEOS: () => void;
|
||||
Size: number;
|
||||
SkipLine: () => void;
|
||||
State: ObjectStateEnum;
|
||||
Type: StreamTypeEnum;
|
||||
Write: (Buffer: any) => void;
|
||||
WriteText: (Data: string, Options?: StreamWriteEnum) => void;
|
||||
}
|
||||
Close(): void;
|
||||
|
||||
/** @param number [CharNumber=-1] */
|
||||
CopyTo(DestStream: Stream, CharNumber?: number): void;
|
||||
readonly EOS: boolean;
|
||||
Flush(): void;
|
||||
LineSeparator: LineSeparatorEnum;
|
||||
LoadFromFile(FileName: string): void;
|
||||
Mode: ConnectModeEnum;
|
||||
|
||||
/**
|
||||
* @param ADODB.ConnectModeEnum [Mode=0]
|
||||
* @param ADODB.StreamOpenOptionsEnum [Options=-1]
|
||||
* @param string [UserName='']
|
||||
* @param string [Password='']
|
||||
*/
|
||||
Open(Source: any, Mode?: ConnectModeEnum, Options?: StreamOpenOptionsEnum, UserName?: string, Password?: string): void;
|
||||
Position: number;
|
||||
|
||||
/** @param number [NumBytes=-1] */
|
||||
Read(NumBytes?: number): any;
|
||||
|
||||
/** @param number [NumChars=-1] */
|
||||
ReadText(NumChars?: number): string;
|
||||
|
||||
/** @param ADODB.SaveOptionsEnum [Options=1] */
|
||||
SaveToFile(FileName: string, Options?: SaveOptionsEnum): void;
|
||||
SetEOS(): void;
|
||||
readonly Size: number;
|
||||
SkipLine(): void;
|
||||
readonly State: ObjectStateEnum;
|
||||
Type: StreamTypeEnum;
|
||||
Write(Buffer: any): void;
|
||||
|
||||
/** @param ADODB.StreamWriteEnum [Options=0] */
|
||||
WriteText(Data: string, Options?: StreamWriteEnum): void;
|
||||
}
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'ADODB.Connection'): ADODB.Connection;
|
||||
new (progID: 'ADODB.Record'): ADODB.Record;
|
||||
new (progID: 'ADODB.Stream'): ADODB.Stream;
|
||||
new (progID: 'ADODB.Command'): ADODB.Command;
|
||||
new (progID: 'ADODB.Recordset'): ADODB.Recordset;
|
||||
new (progID: 'ADODB.Parameter'): ADODB.Parameter;
|
||||
on(obj: ADODB.Connection, event: 'BeginTransComplete', argNames: ['TransactionLevel', 'pError', 'adStatus', 'pConnection'], handler: (
|
||||
this: ADODB.Connection, parameter: {
|
||||
TransactionLevel: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
|
||||
on(obj: ADODB.Connection, event: 'Disconnect', argNames: ['adStatus', 'pConnection'], handler: (
|
||||
this: ADODB.Connection, parameter: {
|
||||
adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
|
||||
on(obj: ADODB.Connection, event: 'ExecuteComplete', argNames: ['RecordsAffected', 'pError', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (
|
||||
this: ADODB.Connection, parameter: {
|
||||
RecordsAffected: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command, pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void;
|
||||
on(obj: ADODB.Connection, event: 'InfoMessage' | 'CommitTransComplete' | 'RollbackTransComplete' | 'ConnectComplete', argNames: ['pError', 'adStatus', 'pConnection'], handler: (
|
||||
this: ADODB.Connection, parameter: {
|
||||
pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
|
||||
on(obj: ADODB.Connection, event: 'WillConnect', argNames: ['ConnectionString', 'UserID', 'Password', 'Options', 'adStatus', 'pConnection'], handler: (
|
||||
this: ADODB.Connection, parameter: {
|
||||
ConnectionString: string, UserID: string, Password: string, Options: number, adStatus: ADODB.EventStatusEnum, pConnection: ADODB.Connection}) => void): void;
|
||||
on(obj: ADODB.Connection, event: 'WillExecute', argNames: ['Source', 'CursorType', 'LockType', 'Options', 'adStatus', 'pCommand', 'pRecordset', 'pConnection'], handler: (
|
||||
this: ADODB.Connection, parameter: {
|
||||
Source: string, CursorType: ADODB.CursorTypeEnum, LockType: ADODB.LockTypeEnum, Options: number, adStatus: ADODB.EventStatusEnum, pCommand: ADODB.Command,
|
||||
pRecordset: ADODB.Recordset, pConnection: ADODB.Connection}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'EndOfRecordset', argNames: ['fMoreData', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
fMoreData: boolean, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'FetchComplete', argNames: ['pError', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'FetchProgress', argNames: ['Progress', 'MaxProgress', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
Progress: number, MaxProgress: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'FieldChangeComplete', argNames: ['cFields', 'Fields', 'pError', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
cFields: number, Fields: any, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'RecordChangeComplete', argNames: ['adReason', 'cRecords', 'pError', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
adReason: ADODB.EventReasonEnum, cRecords: number, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'RecordsetChangeComplete' | 'MoveComplete', argNames: ['adReason', 'pError', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
adReason: ADODB.EventReasonEnum, pError: ADODB.Error, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'WillChangeField', argNames: ['cFields', 'Fields', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
cFields: number, Fields: any, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'WillChangeRecord', argNames: ['adReason', 'cRecords', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
adReason: ADODB.EventReasonEnum, cRecords: number, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
on(obj: ADODB.Recordset, event: 'WillChangeRecordset' | 'WillMove', argNames: ['adReason', 'adStatus', 'pRecordset'], handler: (
|
||||
this: ADODB.Recordset, parameter: {
|
||||
adReason: ADODB.EventReasonEnum, adStatus: ADODB.EventStatusEnum, pRecordset: ADODB.Recordset}) => void): void;
|
||||
set(obj: ADODB.Recordset, propertyName: 'Collect', parameterTypes: [any], newValue: any): void;
|
||||
new(progid: 'ADODB.Command'): ADODB.Command;
|
||||
new(progid: 'ADODB.Connection'): ADODB.Connection;
|
||||
new(progid: 'ADODB.Parameter'): ADODB.Parameter;
|
||||
new(progid: 'ADODB.Record'): ADODB.Record;
|
||||
new(progid: 'ADODB.Recordset'): ADODB.Recordset;
|
||||
new(progid: 'ADODB.Stream'): ADODB.Stream;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: ADODB.Errors): ADODB.Error;
|
||||
new(col: ADODB.Fields): ADODB.Field;
|
||||
new(col: ADODB.Parameters): ADODB.Parameter;
|
||||
new(col: ADODB.Properties): ADODB.Property;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5", "scripthost"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-adodb-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,18 +0,0 @@
|
||||
//open connection to an Excel file
|
||||
var pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
|
||||
var conn = new ActiveXObject('ADODB.Connection');
|
||||
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
|
||||
conn.ConnectionString =
|
||||
'Data Source="' + pathToExcelFile + '";' +
|
||||
'Extended Properties="Excel 12.0;HDR=Yes"';
|
||||
conn.Open();
|
||||
|
||||
//create a Command to access the data
|
||||
var cmd = new ActiveXObject('ADODB.Command');
|
||||
cmd.CommandText = 'SELECT DISTINCT LastName, CityName FROM [Sheet1$]';
|
||||
//get a Recordset
|
||||
var rs = cmd.Execute();
|
||||
//build a string from the Recordset
|
||||
var s = rs.GetString(ADODB.StringFormatEnum.adClipString, -1, '\t', '\n', '(NULL)');
|
||||
rs.Close();
|
||||
WScript.Echo(s);
|
||||
-205
@@ -1,205 +0,0 @@
|
||||
// Type definitions for Microsoft Scripting Runtime
|
||||
// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Scripting {
|
||||
|
||||
//Enums
|
||||
const enum CompareMethod {
|
||||
BinaryCompare = 0,
|
||||
DatabaseCompare = 2,
|
||||
TextCompare = 1
|
||||
}
|
||||
|
||||
const enum DriveTypeConst {
|
||||
CDRom = 4,
|
||||
Fixed = 2,
|
||||
RamDisk = 5,
|
||||
Remote = 3,
|
||||
Removable = 1,
|
||||
UnknownType = 0
|
||||
}
|
||||
|
||||
const enum FileAttribute {
|
||||
Alias = 1024,
|
||||
Archive = 32,
|
||||
Compressed = 2048,
|
||||
Directory = 16,
|
||||
Hidden = 2,
|
||||
Normal = 0,
|
||||
ReadOnly = 1,
|
||||
System = 4,
|
||||
Volume = 8
|
||||
}
|
||||
|
||||
const enum IOMode {
|
||||
ForAppending = 8,
|
||||
ForReading = 1,
|
||||
ForWriting = 2
|
||||
}
|
||||
|
||||
const enum SpecialFolderConst {
|
||||
SystemFolder = 1,
|
||||
TemporaryFolder = 2,
|
||||
WindowsFolder = 0
|
||||
}
|
||||
|
||||
const enum StandardStreamTypes {
|
||||
StdErr = 2,
|
||||
StdIn = 0,
|
||||
StdOut = 1
|
||||
}
|
||||
|
||||
const enum Tristate {
|
||||
TristateFalse = 0,
|
||||
TristateMixed = -2,
|
||||
TristateTrue = -1,
|
||||
TristateUseDefault = -2
|
||||
}
|
||||
|
||||
//Interfaces
|
||||
interface Dictionary {
|
||||
Add: (Key: any, Item: any) => void;
|
||||
CompareMode: CompareMethod;
|
||||
Count: number;
|
||||
Exists: (Key: any) => boolean;
|
||||
HashVal: (Key: any) => any;
|
||||
Item: (Key: any) => any; //Also has setter with parameters
|
||||
Items: () => any;
|
||||
Key: (Key: any) => any;
|
||||
Keys: () => any;
|
||||
Remove: (Key: any) => void;
|
||||
RemoveAll: () => void;
|
||||
}
|
||||
|
||||
interface Drive {
|
||||
AvailableSpace: any;
|
||||
DriveLetter: string;
|
||||
DriveType: DriveTypeConst;
|
||||
FileSystem: string;
|
||||
FreeSpace: any;
|
||||
IsReady: boolean;
|
||||
Path: string;
|
||||
RootFolder: Folder;
|
||||
SerialNumber: number;
|
||||
ShareName: string;
|
||||
TotalSize: any;
|
||||
VolumeName: string;
|
||||
}
|
||||
|
||||
interface Drives {
|
||||
Count: number;
|
||||
Item: (Key: any) => Drive;
|
||||
}
|
||||
|
||||
interface Encoder {
|
||||
EncodeScriptFile: (szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string) => string;
|
||||
}
|
||||
|
||||
interface File {
|
||||
Attributes: FileAttribute;
|
||||
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
|
||||
DateCreated: VarDate;
|
||||
DateLastAccessed: VarDate;
|
||||
DateLastModified: VarDate;
|
||||
Delete: (Force?: boolean) => void;
|
||||
Drive: Drive;
|
||||
Move: (Destination: string) => void;
|
||||
Name: string;
|
||||
OpenAsTextStream: (IOMode?: IOMode, Format?: Tristate) => TextStream;
|
||||
ParentFolder: Folder;
|
||||
Path: string;
|
||||
ShortName: string;
|
||||
ShortPath: string;
|
||||
Size: any;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
interface Files {
|
||||
Count: number;
|
||||
Item: (Key: any) => File;
|
||||
}
|
||||
|
||||
interface FileSystemObject {
|
||||
BuildPath: (Path: string, Name: string) => string;
|
||||
CopyFile: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CopyFolder: (Source: string, Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CreateFolder: (Path: string) => Folder;
|
||||
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
|
||||
DeleteFile: (FileSpec: string, Force?: boolean) => void;
|
||||
DeleteFolder: (FolderSpec: string, Force?: boolean) => void;
|
||||
DriveExists: (DriveSpec: string) => boolean;
|
||||
Drives: Drives;
|
||||
FileExists: (FileSpec: string) => boolean;
|
||||
FolderExists: (FolderSpec: string) => boolean;
|
||||
GetAbsolutePathName: (Path: string) => string;
|
||||
GetBaseName: (Path: string) => string;
|
||||
GetDrive: (DriveSpec: string) => Drive;
|
||||
GetDriveName: (Path: string) => string;
|
||||
GetExtensionName: (Path: string) => string;
|
||||
GetFile: (FilePath: string) => File;
|
||||
GetFileName: (Path: string) => string;
|
||||
GetFileVersion: (FileName: string) => string;
|
||||
GetFolder: (FolderPath: string) => Folder;
|
||||
GetParentFolderName: (Path: string) => string;
|
||||
GetSpecialFolder: (SpecialFolder: SpecialFolderConst) => Folder;
|
||||
GetStandardStream: (StandardStreamType: StandardStreamTypes, Unicode?: boolean) => TextStream;
|
||||
GetTempName: () => string;
|
||||
MoveFile: (Source: string, Destination: string) => void;
|
||||
MoveFolder: (Source: string, Destination: string) => void;
|
||||
OpenTextFile: (FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate) => TextStream;
|
||||
}
|
||||
|
||||
interface Folder {
|
||||
Attributes: FileAttribute;
|
||||
Copy: (Destination: string, OverWriteFiles?: boolean) => void;
|
||||
CreateTextFile: (FileName: string, Overwrite?: boolean, Unicode?: boolean) => TextStream;
|
||||
DateCreated: VarDate;
|
||||
DateLastAccessed: VarDate;
|
||||
DateLastModified: VarDate;
|
||||
Delete: (Force?: boolean) => void;
|
||||
Drive: Drive;
|
||||
Files: Files;
|
||||
IsRootFolder: boolean;
|
||||
Move: (Destination: string) => void;
|
||||
Name: string;
|
||||
ParentFolder: Folder;
|
||||
Path: string;
|
||||
ShortName: string;
|
||||
ShortPath: string;
|
||||
Size: any;
|
||||
SubFolders: Folders;
|
||||
Type: string;
|
||||
}
|
||||
|
||||
interface Folders {
|
||||
Add: (Name: string) => Folder;
|
||||
Count: number;
|
||||
Item: (Key: any) => Folder;
|
||||
}
|
||||
|
||||
interface TextStream {
|
||||
AtEndOfLine: boolean;
|
||||
AtEndOfStream: boolean;
|
||||
Close: () => void;
|
||||
Column: number;
|
||||
Line: number;
|
||||
Read: (Characters: number) => string;
|
||||
ReadAll: () => string;
|
||||
ReadLine: () => string;
|
||||
Skip: (Characters: number) => void;
|
||||
SkipLine: () => void;
|
||||
Write: (Text: string) => void;
|
||||
WriteBlankLines: (Lines: number) => void;
|
||||
WriteLine: (Text?: string) => void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'Scripting.Dictionary'): Scripting.Dictionary;
|
||||
new (progID: 'Scripting.FileSystemObject'): Scripting.FileSystemObject;
|
||||
new (progID: 'Scripting.Encoder'): Scripting.Encoder;
|
||||
}
|
||||
|
||||
+17
-21
@@ -1,8 +1,7 @@
|
||||
//source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
|
||||
// source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
|
||||
|
||||
|
||||
//Generates a string describing the drive type of a given Drive object.
|
||||
var showDriveType = (drive: Scripting.Drive) => {
|
||||
// Generates a string describing the drive type of a given Drive object.
|
||||
let showDriveType = (drive: Scripting.Drive) => {
|
||||
switch (drive.DriveType) {
|
||||
case Scripting.DriveTypeConst.Removable:
|
||||
return 'Removeable';
|
||||
@@ -19,14 +18,13 @@ var showDriveType = (drive: Scripting.Drive) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//Generates a string describing the attributes of a file or folder.
|
||||
var showFileAttributes = (file: Scripting.File) => {
|
||||
var attr = file.Attributes;
|
||||
// Generates a string describing the attributes of a file or folder.
|
||||
let showFileAttributes = (file: Scripting.File) => {
|
||||
let attr = file.Attributes;
|
||||
if (attr === 0) {
|
||||
return 'Normal';
|
||||
}
|
||||
var attributeStrings: string[] = [];
|
||||
let attributeStrings: string[] = [];
|
||||
if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); }
|
||||
if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); }
|
||||
if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); }
|
||||
@@ -38,24 +36,22 @@ var showFileAttributes = (file: Scripting.File) => {
|
||||
return attributeStrings.join(',');
|
||||
};
|
||||
|
||||
|
||||
//source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
|
||||
var showFreeSpace = (drvPath: string) => {
|
||||
var fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
var d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
var s = 'Drive ' + drvPath + ' - ';
|
||||
// source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
|
||||
let showFreeSpace = (drvPath: string) => {
|
||||
let fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
let d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
let s = 'Drive ' + drvPath + ' - ';
|
||||
s += d.VolumeName + '<br>';
|
||||
s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes';
|
||||
return (s);
|
||||
};
|
||||
|
||||
// source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
|
||||
let getALine = (filespec: string) => {
|
||||
let fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
let file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
|
||||
//source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
|
||||
var getALine = (filespec: string) => {
|
||||
var fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
var file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
|
||||
var s = '';
|
||||
let s = '';
|
||||
while (!file.AtEndOfLine) {
|
||||
s += file.Read(1);
|
||||
}
|
||||
Vendored
+465
@@ -0,0 +1,465 @@
|
||||
// Type definitions for Microsoft Scripting Runtime 1.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Scripting {
|
||||
const enum CompareMethod {
|
||||
BinaryCompare = 0,
|
||||
DatabaseCompare = 2,
|
||||
TextCompare = 1
|
||||
}
|
||||
|
||||
const enum DriveTypeConst {
|
||||
CDRom = 4,
|
||||
Fixed = 2,
|
||||
RamDisk = 5,
|
||||
Remote = 3,
|
||||
Removable = 1,
|
||||
UnknownType = 0
|
||||
}
|
||||
|
||||
const enum FileAttribute {
|
||||
Alias = 1024,
|
||||
Archive = 32,
|
||||
Compressed = 2048,
|
||||
Directory = 16,
|
||||
Hidden = 2,
|
||||
Normal = 0,
|
||||
ReadOnly = 1,
|
||||
System = 4,
|
||||
Volume = 8
|
||||
}
|
||||
|
||||
const enum IOMode {
|
||||
ForAppending = 8,
|
||||
ForReading = 1,
|
||||
ForWriting = 2
|
||||
}
|
||||
|
||||
const enum SpecialFolderConst {
|
||||
SystemFolder = 1,
|
||||
TemporaryFolder = 2,
|
||||
WindowsFolder = 0
|
||||
}
|
||||
|
||||
const enum StandardStreamTypes {
|
||||
StdErr = 2,
|
||||
StdIn = 0,
|
||||
StdOut = 1
|
||||
}
|
||||
|
||||
const enum Tristate {
|
||||
TristateFalse = 0,
|
||||
TristateMixed = -2,
|
||||
TristateTrue = -1,
|
||||
TristateUseDefault = -2
|
||||
}
|
||||
|
||||
/** Scripting.Dictionary */
|
||||
interface Dictionary {
|
||||
/** Add a new key and item to the dictionary. */
|
||||
Add(Key: any, Item: any): void;
|
||||
|
||||
/** Set or get the string comparison method. */
|
||||
CompareMode: CompareMethod;
|
||||
|
||||
/** Get the number of items in the dictionary. */
|
||||
readonly Count: number;
|
||||
|
||||
/** Determine if a given key is in the dictionary. */
|
||||
Exists(Key: any): boolean;
|
||||
HashVal(Key: any): any;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
Item(Key: any): any;
|
||||
|
||||
/** Get an array containing all items in the dictionary. */
|
||||
Items(): any;
|
||||
|
||||
/** Change a key to a different key. */
|
||||
Key(Key: any): any;
|
||||
|
||||
/** Get an array containing all keys in the dictionary. */
|
||||
Keys(): any;
|
||||
|
||||
/** Remove a given key from the dictionary. */
|
||||
Remove(Key: any): void;
|
||||
|
||||
/** Remove all information from the dictionary. */
|
||||
RemoveAll(): void;
|
||||
}
|
||||
|
||||
/** Drive Object */
|
||||
interface Drive {
|
||||
/** Get available space */
|
||||
readonly AvailableSpace: any;
|
||||
|
||||
/** Drive letter */
|
||||
readonly DriveLetter: string;
|
||||
|
||||
/** Drive type */
|
||||
readonly DriveType: DriveTypeConst;
|
||||
|
||||
/** Filesystem type */
|
||||
readonly FileSystem: string;
|
||||
|
||||
/** Get drive free space */
|
||||
readonly FreeSpace: any;
|
||||
|
||||
/** Check if disk is available */
|
||||
readonly IsReady: boolean;
|
||||
|
||||
/** Path */
|
||||
readonly Path: string;
|
||||
|
||||
/** Root folder */
|
||||
readonly RootFolder: Folder;
|
||||
|
||||
/** Serial number */
|
||||
readonly SerialNumber: number;
|
||||
|
||||
/** Share name */
|
||||
readonly ShareName: string;
|
||||
|
||||
/** Get total drive size */
|
||||
readonly TotalSize: any;
|
||||
|
||||
/** Name of volume */
|
||||
VolumeName: string;
|
||||
}
|
||||
|
||||
/** Collection of drives associated with drive letters */
|
||||
interface Drives {
|
||||
/** Number of drives */
|
||||
readonly Count: number;
|
||||
|
||||
/** Get drive */
|
||||
Item(Key: any): Drive;
|
||||
}
|
||||
|
||||
/** Script Encoder Object */
|
||||
interface Encoder {
|
||||
/** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */
|
||||
EncodeScriptFile(szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string;
|
||||
}
|
||||
|
||||
/** File object */
|
||||
interface File {
|
||||
/** File attributes */
|
||||
Attributes: FileAttribute;
|
||||
|
||||
/**
|
||||
* Copy this file
|
||||
* @param boolean [OverWriteFiles=true]
|
||||
*/
|
||||
Copy(Destination: string, OverWriteFiles?: boolean): void;
|
||||
|
||||
/** Date file was created */
|
||||
readonly DateCreated: VarDate;
|
||||
|
||||
/** Date file was last accessed */
|
||||
readonly DateLastAccessed: VarDate;
|
||||
|
||||
/** Date file was last modified */
|
||||
readonly DateLastModified: VarDate;
|
||||
|
||||
/**
|
||||
* Delete this file
|
||||
* @param boolean [Force=false]
|
||||
*/
|
||||
Delete(Force?: boolean): void;
|
||||
|
||||
/** Get drive that contains file */
|
||||
readonly Drive: Drive;
|
||||
|
||||
/** Move this file */
|
||||
Move(Destination: string): void;
|
||||
|
||||
/** Get name of file */
|
||||
Name: string;
|
||||
|
||||
/**
|
||||
* Open a file as a TextStream
|
||||
* @param Scripting.IOMode [IOMode=1]
|
||||
* @param Scripting.Tristate [Format=0]
|
||||
*/
|
||||
OpenAsTextStream(IOMode?: IOMode, Format?: Tristate): TextStream;
|
||||
|
||||
/** Get folder that contains file */
|
||||
readonly ParentFolder: Folder;
|
||||
|
||||
/** Path to the file */
|
||||
readonly Path: string;
|
||||
|
||||
/** Short name */
|
||||
readonly ShortName: string;
|
||||
|
||||
/** Short path */
|
||||
readonly ShortPath: string;
|
||||
|
||||
/** File size */
|
||||
readonly Size: any;
|
||||
|
||||
/** Type description */
|
||||
readonly Type: string;
|
||||
}
|
||||
|
||||
/** Collection of files in a folder */
|
||||
interface Files {
|
||||
/** Number of folders */
|
||||
readonly Count: number;
|
||||
|
||||
/** Get file */
|
||||
Item(Key: any): File;
|
||||
}
|
||||
|
||||
/** FileSystem Object */
|
||||
interface FileSystemObject {
|
||||
/** Generate a path from an existing path and a name */
|
||||
BuildPath(Path: string, Name: string): string;
|
||||
|
||||
/**
|
||||
* Copy a file
|
||||
* @param boolean [OverWriteFiles=true]
|
||||
*/
|
||||
CopyFile(Source: string, Destination: string, OverWriteFiles?: boolean): void;
|
||||
|
||||
/**
|
||||
* Copy a folder
|
||||
* @param boolean [OverWriteFiles=true]
|
||||
*/
|
||||
CopyFolder(Source: string, Destination: string, OverWriteFiles?: boolean): void;
|
||||
|
||||
/** Create a folder */
|
||||
CreateFolder(Path: string): Folder;
|
||||
|
||||
/**
|
||||
* Create a file as a TextStream
|
||||
* @param boolean [Overwrite=true]
|
||||
* @param boolean [Unicode=false]
|
||||
*/
|
||||
CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream;
|
||||
|
||||
/**
|
||||
* Delete a file
|
||||
* @param boolean [Force=false]
|
||||
*/
|
||||
DeleteFile(FileSpec: string, Force?: boolean): void;
|
||||
|
||||
/**
|
||||
* Delete a folder
|
||||
* @param boolean [Force=false]
|
||||
*/
|
||||
DeleteFolder(FolderSpec: string, Force?: boolean): void;
|
||||
|
||||
/** Check if a drive or a share exists */
|
||||
DriveExists(DriveSpec: string): boolean;
|
||||
|
||||
/** Get drives collection */
|
||||
readonly Drives: Drives;
|
||||
|
||||
/** Check if a file exists */
|
||||
FileExists(FileSpec: string): boolean;
|
||||
|
||||
/** Check if a path exists */
|
||||
FolderExists(FolderSpec: string): boolean;
|
||||
|
||||
/** Return the canonical representation of the path */
|
||||
GetAbsolutePathName(Path: string): string;
|
||||
|
||||
/** Return base name from a path */
|
||||
GetBaseName(Path: string): string;
|
||||
|
||||
/** Get drive or UNC share */
|
||||
GetDrive(DriveSpec: string): Drive;
|
||||
|
||||
/** Return drive from a path */
|
||||
GetDriveName(Path: string): string;
|
||||
|
||||
/** Return extension from path */
|
||||
GetExtensionName(Path: string): string;
|
||||
|
||||
/** Get file */
|
||||
GetFile(FilePath: string): File;
|
||||
|
||||
/** Return the file name from a path */
|
||||
GetFileName(Path: string): string;
|
||||
|
||||
/** Retrieve the file version of the specified file into a string */
|
||||
GetFileVersion(FileName: string): string;
|
||||
|
||||
/** Get folder */
|
||||
GetFolder(FolderPath: string): Folder;
|
||||
|
||||
/** Return path to the parent folder */
|
||||
GetParentFolderName(Path: string): string;
|
||||
|
||||
/** Get location of various system folders */
|
||||
GetSpecialFolder(SpecialFolder: SpecialFolderConst): Folder;
|
||||
|
||||
/**
|
||||
* Retrieve the standard input, output or error stream
|
||||
* @param boolean [Unicode=false]
|
||||
*/
|
||||
GetStandardStream(StandardStreamType: StandardStreamTypes, Unicode?: boolean): TextStream;
|
||||
|
||||
/** Generate name that can be used to name a temporary file */
|
||||
GetTempName(): string;
|
||||
|
||||
/** Move a file */
|
||||
MoveFile(Source: string, Destination: string): void;
|
||||
|
||||
/** Move a folder */
|
||||
MoveFolder(Source: string, Destination: string): void;
|
||||
|
||||
/**
|
||||
* Open a file as a TextStream
|
||||
* @param Scripting.IOMode [IOMode=1]
|
||||
* @param boolean [Create=false]
|
||||
* @param Scripting.Tristate [Format=0]
|
||||
*/
|
||||
OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream;
|
||||
}
|
||||
|
||||
/** Folder object */
|
||||
interface Folder {
|
||||
/** Folder attributes */
|
||||
Attributes: FileAttribute;
|
||||
|
||||
/**
|
||||
* Copy this folder
|
||||
* @param boolean [OverWriteFiles=true]
|
||||
*/
|
||||
Copy(Destination: string, OverWriteFiles?: boolean): void;
|
||||
|
||||
/**
|
||||
* Create a file as a TextStream
|
||||
* @param boolean [Overwrite=true]
|
||||
* @param boolean [Unicode=false]
|
||||
*/
|
||||
CreateTextFile(FileName: string, Overwrite?: boolean, Unicode?: boolean): TextStream;
|
||||
|
||||
/** Date folder was created */
|
||||
readonly DateCreated: VarDate;
|
||||
|
||||
/** Date folder was last accessed */
|
||||
readonly DateLastAccessed: VarDate;
|
||||
|
||||
/** Date folder was last modified */
|
||||
readonly DateLastModified: VarDate;
|
||||
|
||||
/**
|
||||
* Delete this folder
|
||||
* @param boolean [Force=false]
|
||||
*/
|
||||
Delete(Force?: boolean): void;
|
||||
|
||||
/** Get drive that contains folder */
|
||||
readonly Drive: Drive;
|
||||
|
||||
/** Get files collection */
|
||||
readonly Files: Files;
|
||||
|
||||
/** True if folder is root */
|
||||
readonly IsRootFolder: boolean;
|
||||
|
||||
/** Move this folder */
|
||||
Move(Destination: string): void;
|
||||
|
||||
/** Get name of folder */
|
||||
Name: string;
|
||||
|
||||
/** Get parent folder */
|
||||
readonly ParentFolder: Folder;
|
||||
|
||||
/** Path to folder */
|
||||
readonly Path: string;
|
||||
|
||||
/** Short name */
|
||||
readonly ShortName: string;
|
||||
|
||||
/** Short path */
|
||||
readonly ShortPath: string;
|
||||
|
||||
/** Sum of files and subfolders */
|
||||
readonly Size: any;
|
||||
|
||||
/** Get folders collection */
|
||||
readonly SubFolders: Folders;
|
||||
|
||||
/** Type description */
|
||||
readonly Type: string;
|
||||
}
|
||||
|
||||
/** Collection of subfolders in a folder */
|
||||
interface Folders {
|
||||
/** Create a new folder */
|
||||
Add(Name: string): Folder;
|
||||
|
||||
/** Number of folders */
|
||||
readonly Count: number;
|
||||
|
||||
/** Get folder */
|
||||
Item(Key: any): Folder;
|
||||
}
|
||||
|
||||
/** TextStream object */
|
||||
interface TextStream {
|
||||
/** Is the current position at the end of a line? */
|
||||
readonly AtEndOfLine: boolean;
|
||||
|
||||
/** Is the current position at the end of the stream? */
|
||||
readonly AtEndOfStream: boolean;
|
||||
|
||||
/** Close a text stream */
|
||||
Close(): void;
|
||||
|
||||
/** Current column number */
|
||||
readonly Column: number;
|
||||
|
||||
/** Current line number */
|
||||
readonly Line: number;
|
||||
|
||||
/** Read a specific number of characters into a string */
|
||||
Read(Characters: number): string;
|
||||
|
||||
/** Read the entire stream into a string */
|
||||
ReadAll(): string;
|
||||
|
||||
/** Read an entire line into a string */
|
||||
ReadLine(): string;
|
||||
|
||||
/** Skip a specific number of characters */
|
||||
Skip(Characters: number): void;
|
||||
|
||||
/** Skip a line */
|
||||
SkipLine(): void;
|
||||
|
||||
/** Write a string to the stream */
|
||||
Write(Text: string): void;
|
||||
|
||||
/** Write a number of blank lines to the stream */
|
||||
WriteBlankLines(Lines: number): void;
|
||||
|
||||
/**
|
||||
* Write a string and an end of line to the stream
|
||||
* @param string [Text='']
|
||||
*/
|
||||
WriteLine(Text?: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void;
|
||||
new(progid: 'Scripting.Dictionary'): Scripting.Dictionary;
|
||||
new(progid: 'Scripting.Encoder'): Scripting.Encoder;
|
||||
new(progid: 'Scripting.FileSystemObject'): Scripting.FileSystemObject;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: Scripting.Dictionary): any;
|
||||
new(col: Scripting.Drives): Scripting.Drive;
|
||||
new(col: Scripting.Files): Scripting.File;
|
||||
new(col: Scripting.Folders): Scripting.Folder;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5", "scripthost"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-scripting-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+32
-24
@@ -1,31 +1,43 @@
|
||||
//source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
|
||||
// source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx
|
||||
|
||||
// Convert a file
|
||||
let commonDialog = new ActiveXObject('WIA.CommonDialog');
|
||||
let img = commonDialog.ShowAcquireImage();
|
||||
|
||||
//Convert a file
|
||||
var commonDialog = new ActiveXObject('WIA.CommonDialog');
|
||||
var img = commonDialog.ShowAcquireImage();
|
||||
if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) {
|
||||
var ip = new ActiveXObject('WIA.ImageProcess');
|
||||
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
|
||||
let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}';
|
||||
if (img.FormatID !== jpegFormatID) {
|
||||
let ip = new ActiveXObject('WIA.ImageProcess');
|
||||
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
|
||||
ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID;
|
||||
img = ip.Apply(img);
|
||||
}
|
||||
// with this:
|
||||
/*if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) {
|
||||
let ip = new ActiveXObject('WIA.ImageProcess');
|
||||
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
|
||||
ip.Filters.Item(1).Properties.Item('FormatID').Value = WIA.FormatID.wiaFormatJPEG;
|
||||
img = ip.Apply(img);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
//Take a picture
|
||||
var dev = commonDialog.ShowSelectDevice();
|
||||
// Take a picture
|
||||
let dev = commonDialog.ShowSelectDevice();
|
||||
if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) {
|
||||
var itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
|
||||
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
|
||||
let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}';
|
||||
let itm = dev.ExecuteCommand(commandID);
|
||||
|
||||
// with this:
|
||||
// let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
|
||||
}
|
||||
|
||||
|
||||
//Display detailed property information
|
||||
// Display detailed property information
|
||||
dev = commonDialog.ShowSelectDevice();
|
||||
var e = new Enumerator<WIA.Property>(dev.Properties); //no foreach over ActiveX collections
|
||||
let e = new Enumerator<WIA.Property>(dev.Properties); // no foreach over ActiveX collections
|
||||
e.moveFirst();
|
||||
while (!e.atEnd()) {
|
||||
var p = e.item();
|
||||
var s = p.Name + ' (' + p.PropertyID + ') = ';
|
||||
let p = e.item();
|
||||
let s = p.Name + ' (' + p.PropertyID + ') = ';
|
||||
if (p.IsVector) {
|
||||
s += '[vector of data]';
|
||||
} else {
|
||||
@@ -48,8 +60,8 @@ while (!e.atEnd()) {
|
||||
} else {
|
||||
s += ' [valid values include: ';
|
||||
}
|
||||
var count = p.SubTypeValues.Count;
|
||||
for (var i = 1; i <= count; i++) {
|
||||
let count = p.SubTypeValues.Count;
|
||||
for (let i = 1; i <= count; i++) {
|
||||
s += p.SubTypeValues.Item(i);
|
||||
if (i < count) {
|
||||
s += ', ';
|
||||
@@ -63,9 +75,5 @@ while (!e.atEnd()) {
|
||||
}
|
||||
}
|
||||
|
||||
if (WScript) {
|
||||
WScript.Echo(s);
|
||||
} else if (window) {
|
||||
window.alert(s);
|
||||
}
|
||||
}
|
||||
WScript.Echo(s);
|
||||
}
|
||||
Vendored
+759
@@ -0,0 +1,759 @@
|
||||
// Type definitions for Windows Image Acquisition 2.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Typescript Version: 2.4
|
||||
|
||||
declare namespace WIA {
|
||||
/** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */
|
||||
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
|
||||
/*const enum CommandID {
|
||||
wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}',
|
||||
wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}',
|
||||
wiaCommandSynchronize = '{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}',
|
||||
wiaCommandTakePicture = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}',
|
||||
wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}'
|
||||
}*/
|
||||
|
||||
/** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */
|
||||
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
|
||||
/*const enum EventID {
|
||||
wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}',
|
||||
wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}',
|
||||
wiaEventItemCreated = '{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}',
|
||||
wiaEventItemDeleted = '{1D22A559-E14F-11D2-B326-00C04F68CE61}',
|
||||
wiaEventScanEmailImage = '{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}',
|
||||
wiaEventScanFaxImage = '{C00EB793-8C6E-11D2-977A-0000F87A926F}',
|
||||
wiaEventScanFilmImage = '{9B2B662C-6185-438C-B68B-E39EE25E71CB}',
|
||||
wiaEventScanImage = '{A6C5A715-8C6E-11D2-977A-0000F87A926F}',
|
||||
wiaEventScanImage2 = '{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}',
|
||||
wiaEventScanImage3 = '{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}',
|
||||
wiaEventScanImage4 = '{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}',
|
||||
wiaEventScanOCRImage = '{9D095B89-37D6-4877-AFED-62A297DC6DBE}',
|
||||
wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}'
|
||||
}*/
|
||||
|
||||
/** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */
|
||||
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
|
||||
/*const enum FormatID {
|
||||
wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}',
|
||||
wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}',
|
||||
wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}',
|
||||
wiaFormatPNG = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}',
|
||||
wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}'
|
||||
}*/
|
||||
|
||||
/** Miscellaneous string constants */
|
||||
// uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017)
|
||||
/*const enum Miscellaneous {
|
||||
wiaAnyDeviceID = '*',
|
||||
wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}'
|
||||
}*/
|
||||
|
||||
/**
|
||||
* The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device
|
||||
* object to obtain these values from the device.
|
||||
*/
|
||||
const enum WiaDeviceType {
|
||||
CameraDeviceType = 2,
|
||||
ScannerDeviceType = 1,
|
||||
UnspecifiedDeviceType = 0,
|
||||
VideoDeviceType = 3
|
||||
}
|
||||
|
||||
/**
|
||||
* A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEv
|
||||
* ent.Type and a member from the WiaEventFlags enumeration.
|
||||
*/
|
||||
const enum WiaEventFlag {
|
||||
ActionEvent = 2,
|
||||
NotificationEvent = 1
|
||||
}
|
||||
|
||||
/** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */
|
||||
const enum WiaImageBias {
|
||||
MaximizeQuality = 131072,
|
||||
MinimizeSize = 65536
|
||||
}
|
||||
|
||||
/** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */
|
||||
const enum WiaImageIntent {
|
||||
ColorIntent = 1,
|
||||
GrayscaleIntent = 2,
|
||||
TextIntent = 4,
|
||||
UnspecifiedIntent = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection o
|
||||
* f an ImageFile object.
|
||||
*/
|
||||
const enum WiaImagePropertyType {
|
||||
ByteImagePropertyType = 1001,
|
||||
LongImagePropertyType = 1004,
|
||||
RationalImagePropertyType = 1006,
|
||||
StringImagePropertyType = 1002,
|
||||
UndefinedImagePropertyType = 1000,
|
||||
UnsignedIntegerImagePropertyType = 1003,
|
||||
UnsignedLongImagePropertyType = 1005,
|
||||
UnsignedRationalImagePropertyType = 1007,
|
||||
VectorOfBytesImagePropertyType = 1101,
|
||||
VectorOfLongsImagePropertyType = 1103,
|
||||
VectorOfRationalsImagePropertyType = 1105,
|
||||
VectorOfUndefinedImagePropertyType = 1100,
|
||||
VectorOfUnsignedIntegersImagePropertyType = 1102,
|
||||
VectorOfUnsignedLongsImagePropertyType = 1104,
|
||||
VectorOfUnsignedRationalsImagePropertyType = 1106
|
||||
}
|
||||
|
||||
/**
|
||||
* An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item
|
||||
* Flags") and a member from the WiaItemFlags enumeration.
|
||||
*/
|
||||
const enum WiaItemFlag {
|
||||
AnalyzeItemFlag = 16,
|
||||
AudioItemFlag = 32,
|
||||
BurstItemFlag = 2048,
|
||||
DeletedItemFlag = 128,
|
||||
DeviceItemFlag = 64,
|
||||
DisconnectedItemFlag = 256,
|
||||
FileItemFlag = 2,
|
||||
FolderItemFlag = 4,
|
||||
FreeItemFlag = 0,
|
||||
GeneratedItemFlag = 16384,
|
||||
HasAttachmentsItemFlag = 32768,
|
||||
HPanoramaItemFlag = 512,
|
||||
ImageItemFlag = 1,
|
||||
RemovedItemFlag = -2147483648,
|
||||
RootItemFlag = 8,
|
||||
StorageItemFlag = 4096,
|
||||
TransferItemFlag = 8192,
|
||||
VideoItemFlag = 65536,
|
||||
VPanoramaItemFlag = 1024
|
||||
}
|
||||
|
||||
/**
|
||||
* The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Dev
|
||||
* ice or Item object.
|
||||
*/
|
||||
const enum WiaPropertyType {
|
||||
BooleanPropertyType = 1,
|
||||
BytePropertyType = 2,
|
||||
ClassIDPropertyType = 15,
|
||||
CurrencyPropertyType = 12,
|
||||
DatePropertyType = 13,
|
||||
DoublePropertyType = 11,
|
||||
ErrorCodePropertyType = 7,
|
||||
FileTimePropertyType = 14,
|
||||
HandlePropertyType = 18,
|
||||
IntegerPropertyType = 3,
|
||||
LargeIntegerPropertyType = 8,
|
||||
LongPropertyType = 5,
|
||||
ObjectPropertyType = 17,
|
||||
SinglePropertyType = 10,
|
||||
StringPropertyType = 16,
|
||||
UnsignedIntegerPropertyType = 4,
|
||||
UnsignedLargeIntegerPropertyType = 9,
|
||||
UnsignedLongPropertyType = 6,
|
||||
UnsupportedPropertyType = 0,
|
||||
VariantPropertyType = 19,
|
||||
VectorOfBooleansPropertyType = 101,
|
||||
VectorOfBytesPropertyType = 102,
|
||||
VectorOfClassIDsPropertyType = 115,
|
||||
VectorOfCurrenciesPropertyType = 112,
|
||||
VectorOfDatesPropertyType = 113,
|
||||
VectorOfDoublesPropertyType = 111,
|
||||
VectorOfErrorCodesPropertyType = 107,
|
||||
VectorOfFileTimesPropertyType = 114,
|
||||
VectorOfIntegersPropertyType = 103,
|
||||
VectorOfLargeIntegersPropertyType = 108,
|
||||
VectorOfLongsPropertyType = 105,
|
||||
VectorOfSinglesPropertyType = 110,
|
||||
VectorOfStringsPropertyType = 116,
|
||||
VectorOfUnsignedIntegersPropertyType = 104,
|
||||
VectorOfUnsignedLargeIntegersPropertyType = 109,
|
||||
VectorOfUnsignedLongsPropertyType = 106,
|
||||
VectorOfVariantsPropertyType = 119
|
||||
}
|
||||
|
||||
/**
|
||||
* The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for t
|
||||
* he property.
|
||||
*/
|
||||
const enum WiaSubType {
|
||||
FlagSubType = 3,
|
||||
ListSubType = 2,
|
||||
RangeSubType = 1,
|
||||
UnspecifiedSubType = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be
|
||||
* created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form.
|
||||
*/
|
||||
interface CommonDialog {
|
||||
/**
|
||||
* Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object
|
||||
* on success, otherwise Nothing
|
||||
* @param WIA.WiaDeviceType [DeviceType=0]
|
||||
* @param WIA.WiaImageIntent [Intent=0]
|
||||
* @param WIA.WiaImageBias [Bias=131072]
|
||||
* @param string [FormatID='{00000000-0000-0000-0000-000000000000}']
|
||||
* @param boolean [AlwaysSelectDevice=false]
|
||||
* @param boolean [UseCommonUI=true]
|
||||
* @param boolean [CancelError=false]
|
||||
*/
|
||||
ShowAcquireImage(
|
||||
DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile;
|
||||
|
||||
/** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */
|
||||
ShowAcquisitionWizard(Device: Device): any;
|
||||
|
||||
/**
|
||||
* Displays the properties dialog box for the specified Device
|
||||
* @param boolean [CancelError=false]
|
||||
*/
|
||||
ShowDeviceProperties(Device: Device, CancelError?: boolean): void;
|
||||
|
||||
/**
|
||||
* Displays the properties dialog box for the specified Item
|
||||
* @param boolean [CancelError=false]
|
||||
*/
|
||||
ShowItemProperties(Item: Item, CancelError?: boolean): void;
|
||||
|
||||
/** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */
|
||||
ShowPhotoPrintingWizard(Files: any): void;
|
||||
|
||||
/**
|
||||
* Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise
|
||||
* Nothing
|
||||
* @param WIA.WiaDeviceType [DeviceType=0]
|
||||
* @param boolean [AlwaysSelectDevice=false]
|
||||
* @param boolean [CancelError=false]
|
||||
*/
|
||||
ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device;
|
||||
|
||||
/**
|
||||
* Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an It
|
||||
* ems collection on success, otherwise Nothing
|
||||
* @param WIA.WiaImageIntent [Intent=0]
|
||||
* @param WIA.WiaImageBias [Bias=131072]
|
||||
* @param boolean [SingleSelect=true]
|
||||
* @param boolean [UseCommonUI=true]
|
||||
* @param boolean [CancelError=false]
|
||||
*/
|
||||
ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items;
|
||||
|
||||
/**
|
||||
* Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information.
|
||||
* @param string [FormatID='{00000000-0000-0000-0000-000000000000}']
|
||||
* @param boolean [CancelError=false]
|
||||
*/
|
||||
ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any;
|
||||
}
|
||||
|
||||
/** The Device object represents an active connection to an imaging device. */
|
||||
interface Device {
|
||||
/** A collection of all commands for this imaging device */
|
||||
readonly Commands: DeviceCommands;
|
||||
|
||||
/** Returns the DeviceID for this Device */
|
||||
readonly DeviceID: string;
|
||||
|
||||
/** A collection of all events for this imaging device */
|
||||
readonly Events: DeviceEvents;
|
||||
|
||||
/**
|
||||
* Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the
|
||||
* Commands collection.
|
||||
*/
|
||||
ExecuteCommand(CommandID: string): Item;
|
||||
|
||||
/** Returns the Item object specified by ItemID if it exists */
|
||||
GetItem(ItemID: string): Item;
|
||||
|
||||
/** A collection of all items for this imaging device */
|
||||
readonly Items: Items;
|
||||
|
||||
/** A collection of all properties for this imaging device */
|
||||
readonly Properties: Properties;
|
||||
|
||||
/** Returns the Type of Device */
|
||||
readonly Type: WiaDeviceType;
|
||||
|
||||
/** Returns the underlying IWiaItem interface for this Device object */
|
||||
readonly WiaItem: any;
|
||||
}
|
||||
|
||||
/** The DeviceCommand object describes a CommandID that can be used when calling ExecuteCommand on a Device or Item object. */
|
||||
interface DeviceCommand {
|
||||
/** Returns the commandID for this Command */
|
||||
readonly CommandID: string;
|
||||
|
||||
/** Returns the command Description */
|
||||
readonly Description: string;
|
||||
|
||||
/** Returns the command Name */
|
||||
readonly Name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item obje
|
||||
* ct for more details on determining the collection of supported device commands.
|
||||
*/
|
||||
interface DeviceCommands {
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection by position */
|
||||
Item(Index: number): DeviceCommand;
|
||||
}
|
||||
|
||||
/** The DeviceEvent object describes an EventID that can be used when calling RegisterEvent or RegisterPersistentEvent on a DeviceManager object. */
|
||||
interface DeviceEvent {
|
||||
/** Returns the event Description */
|
||||
readonly Description: string;
|
||||
|
||||
/** Returns the EventID for this Event */
|
||||
readonly EventID: string;
|
||||
|
||||
/** Returns the event Name */
|
||||
readonly Name: string;
|
||||
|
||||
/** Returns the Type of this Event */
|
||||
readonly Type: WiaEventFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more det
|
||||
* ails on determining the collection of supported device events.
|
||||
*/
|
||||
interface DeviceEvents {
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection by position */
|
||||
Item(Index: number): DeviceEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer
|
||||
* .
|
||||
*/
|
||||
interface DeviceInfo {
|
||||
/** Establish a connection with this device and return a Device object */
|
||||
Connect(): Device;
|
||||
|
||||
/** Returns the DeviceID for this Device */
|
||||
readonly DeviceID: string;
|
||||
|
||||
/** A collection of all properties for this imaging device that are applicable when the device is not connected */
|
||||
readonly Properties: Properties;
|
||||
|
||||
/** Returns the Type of Device */
|
||||
readonly Type: WiaDeviceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManage
|
||||
* r object for detail on accessing the DeviceInfos object.
|
||||
*/
|
||||
interface DeviceInfos {
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection either by position or Device ID */
|
||||
Item(Index: any): DeviceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be
|
||||
* created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form.
|
||||
*/
|
||||
interface DeviceManager {
|
||||
/** A collection of all imaging devices connected to this computer */
|
||||
readonly DeviceInfos: DeviceInfos;
|
||||
|
||||
/**
|
||||
* Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any
|
||||
* device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified.
|
||||
* @param string [DeviceID='*']
|
||||
*/
|
||||
RegisterEvent(EventID: string, DeviceID?: string): void;
|
||||
|
||||
/**
|
||||
* Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full pat
|
||||
* h name and the appropriate command-line arguments needed to invoke the application.
|
||||
* @param string [DeviceID='*']
|
||||
*/
|
||||
RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void;
|
||||
|
||||
/**
|
||||
* Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called Regis
|
||||
* terEvent.
|
||||
* @param string [DeviceID='*']
|
||||
*/
|
||||
UnregisterEvent(EventID: string, DeviceID?: string): void;
|
||||
|
||||
/**
|
||||
* Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command
|
||||
* , Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent.
|
||||
* @param string [DeviceID='*']
|
||||
*/
|
||||
UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's propertie
|
||||
* s and finally use the Apply method of the ImageProcess object to filter an ImageFile.
|
||||
*/
|
||||
interface Filter {
|
||||
/** Returns a Description of what the filter does */
|
||||
readonly Description: string;
|
||||
|
||||
/** Returns the FilterID for this Filter */
|
||||
readonly FilterID: string;
|
||||
|
||||
/** Returns the Filter Name */
|
||||
readonly Name: string;
|
||||
|
||||
/** A collection of all properties for this filter */
|
||||
readonly Properties: Properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos pr
|
||||
* operty on the ImageProcess object for details on accessing FilterInfo objects.
|
||||
*/
|
||||
interface FilterInfo {
|
||||
/** Returns a technical Description of what the filter does and how to use it in a filter chain */
|
||||
readonly Description: string;
|
||||
|
||||
/** Returns the FilterID for this filter */
|
||||
readonly FilterID: string;
|
||||
|
||||
/** Returns the FilterInfo Name */
|
||||
readonly Name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on a
|
||||
* ccessing the FilterInfos object.
|
||||
*/
|
||||
interface FilterInfos {
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection either by position or name */
|
||||
Item(Index: any): FilterInfo;
|
||||
}
|
||||
|
||||
/** The Filters object is a collection of the Filters that will be applied to an ImageFile when you call the Apply method on the ImageProcess object. */
|
||||
interface Filters {
|
||||
/**
|
||||
* Appends/Inserts a new Filter of the specified FilterID into a Filter collection
|
||||
* @param number [Index=0]
|
||||
*/
|
||||
Add(FilterID: string, Index?: number): void;
|
||||
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection by position or FilterID */
|
||||
Item(Index: number): Filter;
|
||||
|
||||
/** Removes the designated filter */
|
||||
Remove(Index: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog ob
|
||||
* ject for this Item.
|
||||
*/
|
||||
interface Formats {
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection by position */
|
||||
Item(Index: number): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files throug
|
||||
* h LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject.
|
||||
*/
|
||||
interface ImageFile {
|
||||
/** Returns/Sets the current frame in the image */
|
||||
ActiveFrame: number;
|
||||
|
||||
/** Returns the raw image bits as a Vector of Long values */
|
||||
readonly ARGBData: Vector;
|
||||
|
||||
/** Returns the raw image file as a Vector of Bytes */
|
||||
readonly FileData: Vector;
|
||||
|
||||
/** Returns the file extension for this image file type */
|
||||
readonly FileExtension: string;
|
||||
|
||||
/** Returns the FormatID for this file type */
|
||||
readonly FormatID: string;
|
||||
|
||||
/** Returns the number of frames in the image */
|
||||
readonly FrameCount: number;
|
||||
|
||||
/** Returns the Height of the image in pixels */
|
||||
readonly Height: number;
|
||||
|
||||
/** Returns the Horizontal pixels per inch of the image */
|
||||
readonly HorizontalResolution: number;
|
||||
|
||||
/** Indicates if the pixel format has an alpha component */
|
||||
readonly IsAlphaPixelFormat: boolean;
|
||||
|
||||
/** Indicates whether the image is animated */
|
||||
readonly IsAnimated: boolean;
|
||||
|
||||
/** Indicates if the pixel format is extended (16 bits/channel) */
|
||||
readonly IsExtendedPixelFormat: boolean;
|
||||
|
||||
/** Indicates if the pixel data is an index into a palette or the actual color data */
|
||||
readonly IsIndexedPixelFormat: boolean;
|
||||
|
||||
/** Loads the ImageFile object with the specified File */
|
||||
LoadFile(Filename: string): void;
|
||||
|
||||
/** Returns the depth of the pixels of the image in bits per pixel */
|
||||
readonly PixelDepth: number;
|
||||
|
||||
/** A collection of all properties for this image */
|
||||
readonly Properties: Properties;
|
||||
|
||||
/** Save the ImageFile object to the specified File */
|
||||
SaveFile(Filename: string): void;
|
||||
|
||||
/** Returns the Vertical pixels per inch of the image */
|
||||
readonly VerticalResolution: number;
|
||||
|
||||
/** Returns the Width of the image in pixels */
|
||||
readonly Width: number;
|
||||
}
|
||||
|
||||
/** The ImageProcess object manages the filter chain. An ImageProcess object can be created using "WIA.ImageProcess" in a call to CreateObject. */
|
||||
interface ImageProcess {
|
||||
/** Takes the specified ImageFile and returns the new ImageFile with all the filters applied on success */
|
||||
Apply(Source: ImageFile): ImageFile;
|
||||
|
||||
/** A collection of all available filters */
|
||||
readonly FilterInfos: FilterInfos;
|
||||
|
||||
/** A collection of the filters to be applied in this process */
|
||||
readonly Filters: Filters;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing It
|
||||
* em objects.
|
||||
*/
|
||||
interface Item {
|
||||
/** A collection of all commands for this item */
|
||||
readonly Commands: DeviceCommands;
|
||||
|
||||
/** Issues the command specified by CommandID. CommandIDs are device dependent. Valid CommandIDs for this Item are contained in the Commands collection. */
|
||||
ExecuteCommand(CommandID: string): Item;
|
||||
|
||||
/** A collection of all supported format types for this item */
|
||||
readonly Formats: Formats;
|
||||
|
||||
/** Returns the ItemID for this Item */
|
||||
readonly ItemID: string;
|
||||
|
||||
/** A collection of all child items for this item */
|
||||
readonly Items: Items;
|
||||
|
||||
/** A collection of all properties for this item */
|
||||
readonly Properties: Properties;
|
||||
|
||||
/**
|
||||
* Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging d
|
||||
* evice. Future versions may return a collection of ImageFile objects.
|
||||
* @param string [FormatID='{00000000-0000-0000-0000-000000000000}']
|
||||
*/
|
||||
Transfer(FormatID?: string): any;
|
||||
|
||||
/** Returns the underlying IWiaItem interface for this Item object */
|
||||
readonly WiaItem: any;
|
||||
}
|
||||
|
||||
/** The Items object contains a collection of Item objects. See the Items property on the Device or Item object for details on accessing the Items object. */
|
||||
interface Items {
|
||||
/** Adds a new Item with the specified Name and Flags. The Flags value is created by using the OR operation with members of the WiaItemFlags enumeration. */
|
||||
Add(Name: string, Flags: number): void;
|
||||
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns the specified item in the collection by position */
|
||||
Item(Index: number): Item;
|
||||
|
||||
/** Removes the designated Item */
|
||||
Remove(Index: number): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the
|
||||
* Properties property on any of these objects for detail on accessing the Properties object.
|
||||
*/
|
||||
interface Properties {
|
||||
/** Returns the number of members in the collection */
|
||||
readonly Count: number;
|
||||
|
||||
/** Indicates whether the specified Property exists in the collection */
|
||||
Exists(Index: any): boolean;
|
||||
|
||||
/** Returns the specified item in the collection either by position or name. */
|
||||
Item(Index: any): Property;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property o
|
||||
* n any of these objects for details on accessing Property objects.
|
||||
*/
|
||||
interface Property {
|
||||
/** Indicates whether the Property Value is read only */
|
||||
readonly IsReadOnly: boolean;
|
||||
|
||||
/** Indicates whether the Property Value is a vector */
|
||||
readonly IsVector: boolean;
|
||||
|
||||
/** Returns the Property Name */
|
||||
readonly Name: string;
|
||||
|
||||
/** Returns the PropertyID of this Property */
|
||||
readonly PropertyID: number;
|
||||
|
||||
/** Returns the SubType of the Property, if any */
|
||||
readonly SubType: WiaSubType;
|
||||
|
||||
/** Returns the default Property Value if the SubType is not UnspecifiedSubType */
|
||||
readonly SubTypeDefault: any;
|
||||
|
||||
/** Returns the maximum valid Property Value if the SubType is RangeSubType */
|
||||
readonly SubTypeMax: number;
|
||||
|
||||
/** Returns the minimum valid Property Value if the SubType is RangeSubType */
|
||||
readonly SubTypeMin: number;
|
||||
|
||||
/** Returns the step increment of Property Values if the SubType is RangeSubType */
|
||||
readonly SubTypeStep: number;
|
||||
|
||||
/** Returns a Vector of valid Property Values if the SubType is ListSubType or valid flag Values that can be ored together if the SubType is FlagSubType */
|
||||
readonly SubTypeValues: Vector;
|
||||
|
||||
/** Returns either a WiaPropertyType or a WiaImagePropertyType */
|
||||
readonly Type: number;
|
||||
|
||||
/** Returns/Sets the Property Value */
|
||||
Value: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created u
|
||||
* sing "WIA.Rational" in a call to CreateObject.
|
||||
*/
|
||||
interface Rational {
|
||||
/** Returns/Sets the Rational Value Denominator */
|
||||
Denominator: number;
|
||||
|
||||
/** Returns/Sets the Rational Value Numerator */
|
||||
Numerator: number;
|
||||
|
||||
/** Returns the Rational Value as a Double */
|
||||
readonly Value: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be create
|
||||
* d using "WIA.Vector" in a call to CreateObject.
|
||||
*/
|
||||
interface Vector {
|
||||
/**
|
||||
* If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vecto
|
||||
* r collection.
|
||||
* @param number [Index=0]
|
||||
*/
|
||||
Add(Value: any, Index?: number): void;
|
||||
|
||||
/** Returns/Sets the Vector of Bytes as an array of bytes */
|
||||
BinaryData: any;
|
||||
|
||||
/** Removes all elements. */
|
||||
Clear(): void;
|
||||
|
||||
/** Returns the number of members in the vector */
|
||||
readonly Count: number;
|
||||
|
||||
/** Returns/Sets the Vector of Integers from a Date */
|
||||
Date: VarDate;
|
||||
|
||||
/**
|
||||
* Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFil
|
||||
* e from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details.
|
||||
* @param number [Width=0]
|
||||
* @param number [Height=0]
|
||||
*/
|
||||
ImageFile(Width?: number, Height?: number): ImageFile;
|
||||
|
||||
/** Returns/Sets the specified item in the vector by position */
|
||||
Item(Index: number): any;
|
||||
|
||||
/**
|
||||
* If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs mu
|
||||
* st be ARGB data. Returns a Picture object on success. See the ImageFile method for more details.
|
||||
* @param number [Width=0]
|
||||
* @param number [Height=0]
|
||||
*/
|
||||
Picture(Width?: number, Height?: number): any;
|
||||
|
||||
/** Removes the designated element and returns it if successful */
|
||||
Remove(Index: number): any;
|
||||
|
||||
/**
|
||||
* Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be sto
|
||||
* red as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string.
|
||||
* @param boolean [Resizable=true]
|
||||
* @param boolean [Unicode=true]
|
||||
*/
|
||||
SetFromString(Value: string, Resizable?: boolean, Unicode?: boolean): void;
|
||||
|
||||
/**
|
||||
* Returns a Vector of Bytes as a String
|
||||
* @param boolean [Unicode=true]
|
||||
*/
|
||||
String(Unicode?: boolean): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: (
|
||||
this: WIA.DeviceManager, parameter: {
|
||||
EventID: string, DeviceID: string, ItemID: string}) => void): void;
|
||||
set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void;
|
||||
new(progid: 'WIA.CommonDialog'): WIA.CommonDialog;
|
||||
new(progid: 'WIA.DeviceManager'): WIA.DeviceManager;
|
||||
new(progid: 'WIA.ImageFile'): WIA.ImageFile;
|
||||
new(progid: 'WIA.ImageProcess'): WIA.ImageProcess;
|
||||
new(progid: 'WIA.Rational'): WIA.Rational;
|
||||
new(progid: 'WIA.Vector'): WIA.Vector;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: WIA.DeviceCommands): WIA.DeviceCommand;
|
||||
new(col: WIA.DeviceEvents): WIA.DeviceEvent;
|
||||
new(col: WIA.DeviceInfos): WIA.DeviceInfo;
|
||||
new(col: WIA.FilterInfos): WIA.FilterInfo;
|
||||
new(col: WIA.Filters): WIA.Filter;
|
||||
new(col: WIA.Formats): string;
|
||||
new(col: WIA.Items): WIA.Item;
|
||||
new(col: WIA.Properties): WIA.Property;
|
||||
new(col: WIA.Vector): any;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5", "scripthost"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-wia-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
-379
@@ -1,379 +0,0 @@
|
||||
// Type definitions for Microsoft Windows Image Acquisition Library v2.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630827(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace WIA {
|
||||
|
||||
//Enums
|
||||
type CommandID =
|
||||
"'{04E725B0-ACAE-11D2-A093-00C04F72DC3C}'" //wiaCommandChangeDocument
|
||||
| "'{E208C170-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandDeleteAllItems
|
||||
| "'{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandSynchronize
|
||||
| "'{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'" //wiaCommandTakePicture
|
||||
| "'{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}'"; //wiaCommandUnloadDocument
|
||||
const CommandID: {
|
||||
wiaCommandChangeDocument: CommandID,
|
||||
wiaCommandDeleteAllItems: CommandID,
|
||||
wiaCommandSynchronize: CommandID,
|
||||
wiaCommandTakePicture: CommandID,
|
||||
wiaCommandUnloadDocument: CommandID
|
||||
};
|
||||
|
||||
type EventID =
|
||||
"'{A28BBADE-64B6-11D2-A231-00C04FA31809}'" //wiaEventDeviceConnected
|
||||
| "'{143E4E83-6497-11D2-A231-00C04FA31809}'" //wiaEventDeviceDisconnected
|
||||
| "'{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}'" //wiaEventItemCreated
|
||||
| "'{1D22A559-E14F-11D2-B326-00C04F68CE61}'" //wiaEventItemDeleted
|
||||
| "'{C686DCEE-54F2-419E-9A27-2FC7F2E98F9E}'" //wiaEventScanEmailImage
|
||||
| "'{C00EB793-8C6E-11D2-977A-0000F87A926F}'" //wiaEventScanFaxImage
|
||||
| "'{9B2B662C-6185-438C-B68B-E39EE25E71CB}'" //wiaEventScanFilmImage
|
||||
| "'{A6C5A715-8C6E-11D2-977A-0000F87A926F}'" //wiaEventScanImage
|
||||
| "'{FC4767C1-C8B3-48A2-9CFA-2E90CB3D3590}'" //wiaEventScanImage2
|
||||
| "'{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}'" //wiaEventScanImage3
|
||||
| "'{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}'" //wiaEventScanImage4
|
||||
| "'{9D095B89-37D6-4877-AFED-62A297DC6DBE}'" //wiaEventScanOCRImage
|
||||
| "'{B441F425-8C6E-11D2-977A-0000F87A926F}'"; //wiaEventScanPrintImage
|
||||
const EventID: {
|
||||
wiaEventDeviceConnected: EventID,
|
||||
wiaEventDeviceDisconnected: EventID,
|
||||
wiaEventItemCreated: EventID,
|
||||
wiaEventItemDeleted: EventID,
|
||||
wiaEventScanEmailImage: EventID,
|
||||
wiaEventScanFaxImage: EventID,
|
||||
wiaEventScanFilmImage: EventID,
|
||||
wiaEventScanImage: EventID,
|
||||
wiaEventScanImage2: EventID,
|
||||
wiaEventScanImage3: EventID,
|
||||
wiaEventScanImage4: EventID,
|
||||
wiaEventScanOCRImage: EventID,
|
||||
wiaEventScanPrintImage: EventID
|
||||
};
|
||||
|
||||
type FormatID =
|
||||
"'{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatBMP
|
||||
| "'{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatGIF
|
||||
| "'{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatJPEG
|
||||
| "'{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}'" //wiaFormatPNG
|
||||
| "'{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}'"; //wiaFormatTIFF
|
||||
const FormatID: {
|
||||
wiaFormatBMP: FormatID,
|
||||
wiaFormatGIF: FormatID,
|
||||
wiaFormatJPEG: FormatID,
|
||||
wiaFormatPNG: FormatID,
|
||||
wiaFormatTIFF: FormatID
|
||||
};
|
||||
|
||||
type Miscellaneous =
|
||||
"'*'" //wiaAnyDeviceID
|
||||
| "'{00000000-0000-0000-0000-000000000000}'"; //wiaIDUnknown
|
||||
const Miscellaneous: {
|
||||
wiaAnyDeviceID: Miscellaneous,
|
||||
wiaIDUnknown: Miscellaneous
|
||||
};
|
||||
|
||||
const enum WiaDeviceType {
|
||||
CameraDeviceType = 2,
|
||||
ScannerDeviceType = 1,
|
||||
UnspecifiedDeviceType = 0,
|
||||
VideoDeviceType = 3
|
||||
}
|
||||
|
||||
const enum WiaEventFlag {
|
||||
ActionEvent = 2,
|
||||
NotificationEvent = 1
|
||||
}
|
||||
|
||||
const enum WiaImageBias {
|
||||
MaximizeQuality = 131072,
|
||||
MinimizeSize = 65536
|
||||
}
|
||||
|
||||
const enum WiaImageIntent {
|
||||
ColorIntent = 1,
|
||||
GrayscaleIntent = 2,
|
||||
TextIntent = 4,
|
||||
UnspecifiedIntent = 0
|
||||
}
|
||||
|
||||
const enum WiaImagePropertyType {
|
||||
ByteImagePropertyType = 1001,
|
||||
LongImagePropertyType = 1004,
|
||||
RationalImagePropertyType = 1006,
|
||||
StringImagePropertyType = 1002,
|
||||
UndefinedImagePropertyType = 1000,
|
||||
UnsignedIntegerImagePropertyType = 1003,
|
||||
UnsignedLongImagePropertyType = 1005,
|
||||
UnsignedRationalImagePropertyType = 1007,
|
||||
VectorOfBytesImagePropertyType = 1101,
|
||||
VectorOfLongsImagePropertyType = 1103,
|
||||
VectorOfRationalsImagePropertyType = 1105,
|
||||
VectorOfUndefinedImagePropertyType = 1100,
|
||||
VectorOfUnsignedIntegersImagePropertyType = 1102,
|
||||
VectorOfUnsignedLongsImagePropertyType = 1104,
|
||||
VectorOfUnsignedRationalsImagePropertyType = 1106
|
||||
}
|
||||
|
||||
const enum WiaItemFlag {
|
||||
AnalyzeItemFlag = 16,
|
||||
AudioItemFlag = 32,
|
||||
BurstItemFlag = 2048,
|
||||
DeletedItemFlag = 128,
|
||||
DeviceItemFlag = 64,
|
||||
DisconnectedItemFlag = 256,
|
||||
FileItemFlag = 2,
|
||||
FolderItemFlag = 4,
|
||||
FreeItemFlag = 0,
|
||||
GeneratedItemFlag = 16384,
|
||||
HasAttachmentsItemFlag = 32768,
|
||||
HPanoramaItemFlag = 512,
|
||||
ImageItemFlag = 1,
|
||||
RemovedItemFlag = -2147483648,
|
||||
RootItemFlag = 8,
|
||||
StorageItemFlag = 4096,
|
||||
TransferItemFlag = 8192,
|
||||
VideoItemFlag = 65536,
|
||||
VPanoramaItemFlag = 1024
|
||||
}
|
||||
|
||||
const enum WiaPropertyType {
|
||||
BooleanPropertyType = 1,
|
||||
BytePropertyType = 2,
|
||||
ClassIDPropertyType = 15,
|
||||
CurrencyPropertyType = 12,
|
||||
DatePropertyType = 13,
|
||||
DoublePropertyType = 11,
|
||||
ErrorCodePropertyType = 7,
|
||||
FileTimePropertyType = 14,
|
||||
HandlePropertyType = 18,
|
||||
IntegerPropertyType = 3,
|
||||
LargeIntegerPropertyType = 8,
|
||||
LongPropertyType = 5,
|
||||
ObjectPropertyType = 17,
|
||||
SinglePropertyType = 10,
|
||||
StringPropertyType = 16,
|
||||
UnsignedIntegerPropertyType = 4,
|
||||
UnsignedLargeIntegerPropertyType = 9,
|
||||
UnsignedLongPropertyType = 6,
|
||||
UnsupportedPropertyType = 0,
|
||||
VariantPropertyType = 19,
|
||||
VectorOfBooleansPropertyType = 101,
|
||||
VectorOfBytesPropertyType = 102,
|
||||
VectorOfClassIDsPropertyType = 115,
|
||||
VectorOfCurrenciesPropertyType = 112,
|
||||
VectorOfDatesPropertyType = 113,
|
||||
VectorOfDoublesPropertyType = 111,
|
||||
VectorOfErrorCodesPropertyType = 107,
|
||||
VectorOfFileTimesPropertyType = 114,
|
||||
VectorOfIntegersPropertyType = 103,
|
||||
VectorOfLargeIntegersPropertyType = 108,
|
||||
VectorOfLongsPropertyType = 105,
|
||||
VectorOfSinglesPropertyType = 110,
|
||||
VectorOfStringsPropertyType = 116,
|
||||
VectorOfUnsignedIntegersPropertyType = 104,
|
||||
VectorOfUnsignedLargeIntegersPropertyType = 109,
|
||||
VectorOfUnsignedLongsPropertyType = 106,
|
||||
VectorOfVariantsPropertyType = 119
|
||||
}
|
||||
|
||||
const enum WiaSubType {
|
||||
FlagSubType = 3,
|
||||
ListSubType = 2,
|
||||
RangeSubType = 1,
|
||||
UnspecifiedSubType = 0
|
||||
}
|
||||
|
||||
//Interfaces
|
||||
interface CommonDialog {
|
||||
ShowAcquireImage: (DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => ImageFile;
|
||||
ShowAcquisitionWizard: (Device: Device) => any;
|
||||
ShowDeviceProperties: (Device: Device, CancelError?: boolean) => void;
|
||||
ShowItemProperties: (Item: Item, CancelError?: boolean) => void;
|
||||
ShowPhotoPrintingWizard: (Files: any) => void;
|
||||
ShowSelectDevice: (DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean) => Device;
|
||||
ShowSelectItems: (Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean) => Items;
|
||||
ShowTransfer: (Item: Item, FormatID?: string, CancelError?: boolean) => any;
|
||||
}
|
||||
|
||||
interface Device {
|
||||
Commands: DeviceCommands;
|
||||
DeviceID: string;
|
||||
Events: DeviceEvents;
|
||||
ExecuteCommand: (CommandID: string) => Item;
|
||||
GetItem: (ItemID: string) => Item;
|
||||
Items: Items;
|
||||
Properties: Properties;
|
||||
Type: WiaDeviceType;
|
||||
WiaItem: any /*VT_UNKNOWN*/;
|
||||
}
|
||||
|
||||
interface DeviceCommand {
|
||||
CommandID: string;
|
||||
Description: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface DeviceCommands {
|
||||
Count: number;
|
||||
Item: (Index: number) => DeviceCommand;
|
||||
}
|
||||
|
||||
interface DeviceEvent {
|
||||
Description: string;
|
||||
EventID: string;
|
||||
Name: string;
|
||||
Type: WiaEventFlag;
|
||||
}
|
||||
|
||||
interface DeviceEvents {
|
||||
Count: number;
|
||||
Item: (Index: number) => DeviceEvent;
|
||||
}
|
||||
|
||||
interface DeviceInfo {
|
||||
Connect: () => Device;
|
||||
DeviceID: string;
|
||||
Properties: Properties;
|
||||
Type: WiaDeviceType;
|
||||
}
|
||||
|
||||
interface DeviceInfos {
|
||||
Count: number;
|
||||
Item: (Index: any) => DeviceInfo;
|
||||
}
|
||||
|
||||
interface DeviceManager {
|
||||
DeviceInfos: DeviceInfos;
|
||||
RegisterEvent: (EventID: string, DeviceID?: string) => void;
|
||||
RegisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
|
||||
UnregisterEvent: (EventID: string, DeviceID?: string) => void;
|
||||
UnregisterPersistentEvent: (Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string) => void;
|
||||
}
|
||||
|
||||
interface Filter {
|
||||
Description: string;
|
||||
FilterID: string;
|
||||
Name: string;
|
||||
Properties: Properties;
|
||||
}
|
||||
|
||||
interface FilterInfo {
|
||||
Description: string;
|
||||
FilterID: string;
|
||||
Name: string;
|
||||
}
|
||||
|
||||
interface FilterInfos {
|
||||
Count: number;
|
||||
Item: (Index: any) => FilterInfo;
|
||||
}
|
||||
|
||||
interface Filters {
|
||||
Add: (FilterID: string, Index?: number) => void;
|
||||
Count: number;
|
||||
Item: (Index: number) => Filter;
|
||||
Remove: (Index: number) => void;
|
||||
}
|
||||
|
||||
interface Formats {
|
||||
Count: number;
|
||||
Item: (Index: number) => string;
|
||||
}
|
||||
|
||||
interface ImageFile {
|
||||
ActiveFrame: number;
|
||||
ARGBData: Vector;
|
||||
FileData: Vector;
|
||||
FileExtension: string;
|
||||
FormatID: string;
|
||||
FrameCount: number;
|
||||
Height: number;
|
||||
HorizontalResolution: number;
|
||||
IsAlphaPixelFormat: boolean;
|
||||
IsAnimated: boolean;
|
||||
IsExtendedPixelFormat: boolean;
|
||||
IsIndexedPixelFormat: boolean;
|
||||
LoadFile: (Filename: string) => void;
|
||||
PixelDepth: number;
|
||||
Properties: Properties;
|
||||
SaveFile: (Filename: string) => void;
|
||||
VerticalResolution: number;
|
||||
Width: number;
|
||||
}
|
||||
|
||||
interface ImageProcess {
|
||||
Apply: (Source: ImageFile) => ImageFile;
|
||||
FilterInfos: FilterInfos;
|
||||
Filters: Filters;
|
||||
}
|
||||
|
||||
interface Item {
|
||||
Commands: DeviceCommands;
|
||||
ExecuteCommand: (CommandID: string) => Item;
|
||||
Formats: Formats;
|
||||
ItemID: string;
|
||||
Items: Items;
|
||||
Properties: Properties;
|
||||
Transfer: (FormatID?: string) => any;
|
||||
WiaItem: any /*VT_UNKNOWN*/;
|
||||
}
|
||||
|
||||
interface Items {
|
||||
Add: (Name: string, Flags: number) => void;
|
||||
Count: number;
|
||||
Item: (Index: number) => Item;
|
||||
Remove: (Index: number) => void;
|
||||
}
|
||||
|
||||
interface Properties {
|
||||
Count: number;
|
||||
Exists: (Index: any) => boolean;
|
||||
Item: (Index: any) => Property;
|
||||
}
|
||||
|
||||
interface Property {
|
||||
IsReadOnly: boolean;
|
||||
IsVector: boolean;
|
||||
Name: string;
|
||||
PropertyID: number;
|
||||
SubType: WiaSubType;
|
||||
SubTypeDefault: any;
|
||||
SubTypeMax: number;
|
||||
SubTypeMin: number;
|
||||
SubTypeStep: number;
|
||||
SubTypeValues: Vector;
|
||||
Type: number;
|
||||
Value: any;
|
||||
}
|
||||
|
||||
interface Rational {
|
||||
Denominator: number;
|
||||
Numerator: number;
|
||||
Value: number;
|
||||
}
|
||||
|
||||
interface Vector {
|
||||
Add: (Value: any, Index?: number) => void;
|
||||
BinaryData: any;
|
||||
Clear: () => void;
|
||||
Count: number;
|
||||
Date: VarDate;
|
||||
ImageFile: (Width?: number, Height?: number) => ImageFile;
|
||||
Item: (Index: number) => any; //Also has setter with parameters
|
||||
Picture: (Width?: number, Height?: number) => any;
|
||||
Remove: (Index: number) => any;
|
||||
SetFromString: (Value: string, Resizable?: boolean, Unicode?: boolean) => void;
|
||||
String: (Unicode?: boolean) => string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
new (progID: 'WIA.Rational'): WIA.Rational;
|
||||
new (progID: 'WIA.Vector'): WIA.Vector;
|
||||
new (progID: 'WIA.ImageFile'): WIA.ImageFile;
|
||||
new (progID: 'WIA.ImageProcess'): WIA.ImageProcess;
|
||||
new (progID: 'WIA.CommonDialog'): WIA.CommonDialog;
|
||||
new (progID: 'WIA.DeviceManager'): WIA.DeviceManager;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
const handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => {
|
||||
const handler = (event: Alexa.RequestBody<Alexa.Request>, context: Alexa.Context, callback: () => void) => {
|
||||
let alexa = Alexa.handler(event, context);
|
||||
alexa.registerHandlers(handlers);
|
||||
alexa.execute();
|
||||
};
|
||||
|
||||
let handlers: Alexa.Handlers = {
|
||||
let handlers: Alexa.Handlers<Alexa.Request> = {
|
||||
'LaunchRequest': function() {
|
||||
this.emit('SayHello');
|
||||
},
|
||||
|
||||
Vendored
+28
-27
@@ -6,14 +6,14 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void ): AlexaObject;
|
||||
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void ): AlexaObject<T>;
|
||||
export function CreateStateHandler(state: string, obj: any): any;
|
||||
export let StateString: string;
|
||||
|
||||
export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED";
|
||||
export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED";
|
||||
|
||||
export interface AlexaObject extends Handler {
|
||||
export interface AlexaObject<T> extends Handler<T> {
|
||||
_event: any;
|
||||
_context: any;
|
||||
_callback: any;
|
||||
@@ -22,26 +22,26 @@ export interface AlexaObject extends Handler {
|
||||
response: any;
|
||||
dynamoDBTableName: any;
|
||||
saveBeforeResponse: boolean;
|
||||
registerHandlers: (...handlers: Handlers[]) => any;
|
||||
registerHandlers: (...handlers: Array<Handlers<T>>) => any;
|
||||
execute: () => void;
|
||||
}
|
||||
|
||||
export interface Handlers {
|
||||
[intent: string]: (this: Handler) => void;
|
||||
export interface Handlers<T> {
|
||||
[intent: string]: (this: Handler<T>) => void;
|
||||
}
|
||||
|
||||
export interface Handler {
|
||||
export interface Handler<T> {
|
||||
on: any;
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
emitWithState: any;
|
||||
state: any;
|
||||
handler: any;
|
||||
event: RequestBody;
|
||||
event: RequestBody<T>;
|
||||
attributes: any;
|
||||
context: any;
|
||||
name: any;
|
||||
isOverriden: any;
|
||||
t: (token: string) => void;
|
||||
t: (token: string, ...args: any[]) => void;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
@@ -55,10 +55,10 @@ export interface Context {
|
||||
awsRequestId: string;
|
||||
}
|
||||
|
||||
export interface RequestBody {
|
||||
export interface RequestBody<T> {
|
||||
version: string;
|
||||
session: Session;
|
||||
request: LaunchRequest | IntentRequest | SessionEndedRequest;
|
||||
request: T;
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
@@ -75,36 +75,37 @@ export interface SessionApplication {
|
||||
|
||||
export interface SessionUser {
|
||||
userId: string;
|
||||
accessToken: string;
|
||||
accessToken?: string;
|
||||
}
|
||||
|
||||
export interface LaunchRequest extends Request { }
|
||||
|
||||
export interface IntentRequest extends Request {
|
||||
dialogState: DialogStates;
|
||||
intent: Intent;
|
||||
}
|
||||
|
||||
export interface SlotValue {
|
||||
confirmationStatus: ConfirmationStatuses;
|
||||
name: string;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export interface Intent {
|
||||
confirmationStatus: ConfirmationStatuses;
|
||||
name: string;
|
||||
slots: Record<string, SlotValue>;
|
||||
dialogState?: DialogStates;
|
||||
intent?: Intent;
|
||||
}
|
||||
|
||||
export interface SessionEndedRequest extends Request {
|
||||
reason: string;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
export interface Request {
|
||||
type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest";
|
||||
requestId: string;
|
||||
timeStamp: string;
|
||||
timestamp: string;
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface SlotValue {
|
||||
confirmationStatus?: ConfirmationStatuses;
|
||||
name: string;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export interface Intent {
|
||||
confirmationStatus?: ConfirmationStatuses;
|
||||
name: string;
|
||||
slots: Record<string, SlotValue>;
|
||||
}
|
||||
|
||||
export interface ResponseBody {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"object-literal-key-quote": false,
|
||||
"no-empty-interface": false,
|
||||
"prefer-method-signature": false,
|
||||
"object-literal-key-quotes": false
|
||||
"object-literal-key-quotes": false,
|
||||
"no-any": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import * as angular from "angular";
|
||||
import "angular-pdfjs-viewer";
|
||||
|
||||
angular.module('app').config((pdfjsViewerConfigProvider: angular.pdfjsViewer.ConfigProvider) => {
|
||||
pdfjsViewerConfigProvider.setWorkerSrc("/assets/pdf.js-viewer/pdf.worker.js");
|
||||
pdfjsViewerConfigProvider.setCmapDir("/assets/pdf.js-viewer/cmaps");
|
||||
pdfjsViewerConfigProvider.setImageDir("/assets/pdf.js-viewer/images");
|
||||
|
||||
pdfjsViewerConfigProvider.disableWorker();
|
||||
pdfjsViewerConfigProvider.setVerbosity("infos"); // "errors", "warnings" or "infos"
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for angular-pdfjs-viewer 1.0
|
||||
// Project: https://github.com/legalthings/angular-pdfjs-viewer
|
||||
// Definitions by: Bastien Moulia <https://github.com/bastienmoulia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
namespace pdfjsViewer {
|
||||
interface ConfigProvider extends angular.IServiceProvider {
|
||||
setWorkerSrc(src: string): void;
|
||||
setCmapDir(dir: string): void;
|
||||
setImageDir(dir: string): void;
|
||||
disableWorker(): void;
|
||||
setVerbosity(verbosity: "errors" | "warnings" | "infos"): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-pdfjs-viewer-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,15 +1,75 @@
|
||||
// Examples of working with resource, previously from the angular.d.ts. readme
|
||||
// Working with $resource
|
||||
|
||||
// We have the option to define arguments for a custom resource
|
||||
interface IArticleParameters {
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface IArticleResource extends ng.resource.IResource<IArticleResource> {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
|
||||
// Although all actions defined on IArticleResourceClass are avaiable with
|
||||
// the '$' prefix, we have the choice to expose only what we will use
|
||||
$publish(): IArticleResource;
|
||||
$unpublish(): IArticleResource;
|
||||
}
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResource> {
|
||||
// Overload get to accept our custom parameters
|
||||
get(): IArticleResource;
|
||||
get(params: IArticleParameters, onSuccess: Function): IArticleResource;
|
||||
|
||||
// Add our custom resource actions
|
||||
publish(params?: IArticleParameters): IArticleResource;
|
||||
unpublish(params: IArticleParameters): IArticleResource;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService): void {
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
let publishDescriptor: ng.resource.IActionDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
let articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : {
|
||||
method: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
let article: IArticleResource = articleResource.get({id: 1}, function success(): void {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
});
|
||||
}
|
||||
|
||||
import IHttpPromiseCallbackArg = angular.IHttpPromiseCallbackArg;
|
||||
|
||||
interface IMyData {}
|
||||
interface IMyHttpPromiseCallbackArg extends IHttpPromiseCallbackArg<IMyData> {}
|
||||
interface IMyResource extends angular.resource.IResource<IMyResource> { }
|
||||
interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource> { }
|
||||
interface IMyResource extends angular.resource.IResource<IMyResource> {}
|
||||
interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource> {}
|
||||
|
||||
///////////////////////////////////////
|
||||
// IActionDescriptor
|
||||
///////////////////////////////////////
|
||||
var actionDescriptor: angular.resource.IActionDescriptor;
|
||||
let actionDescriptor: angular.resource.IActionDescriptor;
|
||||
|
||||
angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactoryService) {
|
||||
actionDescriptor.method = 'method action';
|
||||
@@ -27,19 +87,18 @@ angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactorySe
|
||||
actionDescriptor.withCredentials = true;
|
||||
actionDescriptor.responseType = 'response type';
|
||||
actionDescriptor.interceptor = {
|
||||
response: function<IMyData> () { return <IMyHttpPromiseCallbackArg>{}; },
|
||||
responseError: function () {}
|
||||
response() { return {} as IMyHttpPromiseCallbackArg; },
|
||||
responseError() {}
|
||||
};
|
||||
actionDescriptor.cancellable = true;
|
||||
});
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceClass
|
||||
///////////////////////////////////////
|
||||
var resourceClass: IMyResourceClass;
|
||||
var resource: IMyResource;
|
||||
var resourceArray: angular.resource.IResourceArray<IMyResource>;
|
||||
let resourceClass: IMyResourceClass;
|
||||
let resource: IMyResource;
|
||||
let resourceArray: angular.resource.IResourceArray<IMyResource>;
|
||||
|
||||
resource = resourceClass.delete();
|
||||
resource = resourceClass.delete({ key: 'value' });
|
||||
@@ -94,9 +153,9 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () {
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
|
||||
var promise : angular.IPromise<IMyResource>;
|
||||
var arrayPromise : angular.IPromise<IMyResource[]>;
|
||||
var json: IMyResource;
|
||||
let promise: angular.IPromise<IMyResource>;
|
||||
let arrayPromise: angular.IPromise<IMyResource[]>;
|
||||
let json: IMyResource;
|
||||
|
||||
promise = resource.$delete();
|
||||
promise = resource.$delete({ key: 'value' });
|
||||
@@ -140,7 +199,7 @@ json = resource.toJSON();
|
||||
///////////////////////////////////////
|
||||
// IResourceService
|
||||
///////////////////////////////////////
|
||||
var resourceService: angular.resource.IResourceService;
|
||||
let resourceService: angular.resource.IResourceService;
|
||||
resourceClass = resourceService<IMyResource, IMyResourceClass>('test');
|
||||
resourceClass = resourceService<IMyResource>('test');
|
||||
resourceClass = resourceService('test');
|
||||
@@ -148,22 +207,20 @@ resourceClass = resourceService('test');
|
||||
///////////////////////////////////////
|
||||
// IModule
|
||||
///////////////////////////////////////
|
||||
var mod: ng.IModule;
|
||||
var resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<IMyResource>;
|
||||
var resourceService: angular.resource.IResourceService;
|
||||
let mod: ng.IModule;
|
||||
let resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<IMyResource>;
|
||||
|
||||
resourceClass = resourceServiceFactoryFunction<IMyResourceClass>(resourceService);
|
||||
|
||||
resourceServiceFactoryFunction = function (resourceService: angular.resource.IResourceService) { return <any>resourceClass; };
|
||||
resourceServiceFactoryFunction = function (resourceService: angular.resource.IResourceService) { return resourceClass as any; };
|
||||
mod = mod.factory('factory name', resourceServiceFactoryFunction);
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceServiceProvider
|
||||
///////////////////////////////////////
|
||||
var resourceServiceProvider: angular.resource.IResourceServiceProvider;
|
||||
let resourceServiceProvider: angular.resource.IResourceServiceProvider;
|
||||
resourceServiceProvider.defaults.stripTrailingSlashes = false;
|
||||
|
||||
Vendored
+32
-22
@@ -37,23 +37,35 @@ declare module 'angular' {
|
||||
// that deeply.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IResourceService {
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T, U>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: IActionHash, options?: IResourceOptions): U;
|
||||
<T>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
|
||||
/**
|
||||
* A factory which creates a resource object that lets you interact with RESTful server-side data sources.
|
||||
* @param url A parameterized URL template with parameters prefixed by : as in /user/:username
|
||||
* @param paramDefaults Default values for url parameters.
|
||||
* @param actions example: {update: { method: 'PUT' }, delete: deleteDescriptor } where deleteDescriptor: IActionDescriptor
|
||||
* @param options Hash with custom settings that should extend the default $resourceProvider behavior
|
||||
*/
|
||||
(url: string, paramDefaults?: any, actions?: IActionHash, options?: IResourceOptions): IResourceClass<IResource<any>>;
|
||||
<T>(url: string, paramDefaults?: any, actions?: IActionHash, options?: IResourceOptions): IResourceClass<T>;
|
||||
<T, U>(url: string, paramDefaults?: any, actions?: IActionHash, options?: IResourceOptions): U;
|
||||
}
|
||||
|
||||
// Hash of action descriptors allows custom action names
|
||||
interface IActionHash {
|
||||
[action: string]: IActionDescriptor
|
||||
[action: string]: IActionDescriptor;
|
||||
}
|
||||
|
||||
interface IResourceResponse {
|
||||
config: any;
|
||||
data: any;
|
||||
headers: any;
|
||||
resource: any;
|
||||
status: number;
|
||||
statusText: string
|
||||
}
|
||||
|
||||
interface IResourceInterceptor {
|
||||
response?(response: IResourceResponse): any;
|
||||
responseError?(rejection: any): any;
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
@@ -71,11 +83,11 @@ declare module 'angular' {
|
||||
* would be used for multiple requests. If you are looking for a way to cancel requests, you should
|
||||
* use the cancellable option.
|
||||
*/
|
||||
timeout?: number
|
||||
timeout?: number;
|
||||
cancellable?: boolean;
|
||||
withCredentials?: boolean;
|
||||
responseType?: string;
|
||||
interceptor?: angular.IHttpInterceptor;
|
||||
interceptor?: IResourceInterceptor;
|
||||
}
|
||||
|
||||
// Allow specify more resource methods
|
||||
@@ -116,7 +128,7 @@ declare module 'angular' {
|
||||
// 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 & IResource<T>;
|
||||
new(dataOrParams?: any): T & IResource<T>;
|
||||
get: IResourceMethod<T>;
|
||||
|
||||
query: IResourceArrayMethod<T>;
|
||||
@@ -153,7 +165,7 @@ declare module 'angular' {
|
||||
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** the promise of the original server interaction that created this instance. **/
|
||||
/** The promise of the original server interaction that created this instance. */
|
||||
$promise: angular.IPromise<T>;
|
||||
$resolved: boolean;
|
||||
toJSON(): T;
|
||||
@@ -165,7 +177,7 @@ declare module 'angular' {
|
||||
interface IResourceArray<T> extends Array<T & IResource<T>> {
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<IResourceArray<T>>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
@@ -178,10 +190,8 @@ declare module 'angular' {
|
||||
|
||||
// IResourceServiceProvider used to configure global settings
|
||||
interface IResourceServiceProvider extends angular.IServiceProvider {
|
||||
|
||||
defaults: IResourceOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
@@ -199,8 +209,8 @@ declare module 'angular' {
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
/** the promise of the original server interaction that created this collection. **/
|
||||
$promise: angular.IPromise<Array<T>>;
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<T[]>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO: Fix up types to remove these
|
||||
"interface-name": false,
|
||||
"only-arrow-functions": false,
|
||||
"no-empty-interface": false,
|
||||
"ban-types": false,
|
||||
"space-before-function-paren": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
+11
-140
@@ -2,27 +2,23 @@
|
||||
|
||||
## Referencing AngularJS definition files in your code
|
||||
|
||||
To do that, simply add `` at the top of your code.
|
||||
|
||||
That will make available to your code all interfaces AngularJS' main module **ng** implements, as well as the **AUTO** module.
|
||||
Read the [TypeScript handbook](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html) for details on consuming these type definitions.
|
||||
|
||||
If you are including other AngularJS' modules in your code, like **ngResource**, just like you needed to include the additional module implementation file in your code, _angular-resource.js_, you will also need to reference the definitions file related to that module. Your code would then have the following definitions files reference:
|
||||
|
||||
|
||||
|
||||
|
||||
Having these modules in separated files is actually good because they sometimes either augment or modify some of **ng**'s interfaces, and thus those differences should only be available to you when you really need them. Also, it forces you to explicit what you're going to be using.
|
||||
|
||||
|
||||
Having these modules in separated packages is actually good because they sometimes either augment or modify some of **ng**'s interfaces, and thus those differences should only be available to you when you really need them. Also, it forces you to explicit what you're going to be using.
|
||||
|
||||
The following extra definition files are available for referencing:
|
||||
|
||||
* angular-resource.d.ts (for the **ngResource** module)
|
||||
* angular-route.d.ts (for the **ngRoute** module)
|
||||
* angular-cookies.d.ts (for the **ngCookies** module)
|
||||
* angular-sanitize.d.ts (for the **ngSanitize** module)
|
||||
* angular-animate.d.ts (for the **ngAnimate** module)
|
||||
* angular-mocks.d.ts (for the **ngMock** and **ngMockE2E** modules)
|
||||
|
||||
(postfix with version number for specific verion, eg. angular-resource-1.0.d.ts)
|
||||
* angular-resource/index.d.ts (for the **ngResource** module)
|
||||
* angular-route/index.d.ts (for the **ngRoute** module)
|
||||
* angular-cookies/index.d.ts (for the **ngCookies** module)
|
||||
* angular-sanitize/index.d.ts (for the **ngSanitize** module)
|
||||
* angular-animate/index.d.ts (for the **ngAnimate** module)
|
||||
* angular-mocks/index.d.ts (for the **ngMock** and **ngMockE2E** modules)
|
||||
|
||||
## The Angular Static
|
||||
|
||||
@@ -31,7 +27,7 @@ The definitions declare the AngularJS static variable `angular` as ambient. That
|
||||
|
||||
## Definitions modularized
|
||||
|
||||
To avoid cluttering the list of suggestions as you type in your IDE, all interfaces reside in their respective module namespace:
|
||||
To avoid cluttering the list of suggestions as you type in your IDE, all interfaces reside in their respective module namespace after you include their respective definitions:
|
||||
|
||||
* `ng` for AngularJS' **ng** module
|
||||
* `ng.auto` for **AUTO**
|
||||
@@ -105,128 +101,3 @@ function Controller($scope: ICustomScope) {
|
||||
|
||||
## Examples
|
||||
|
||||
### Working with $resource
|
||||
```ts
|
||||
|
||||
|
||||
|
||||
// We have the option to define arguments for a custom resource
|
||||
interface IArticleParameters {
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface IArticleResource extends ng.resource.IResource<IArticleResource> {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
|
||||
// Although all actions defined on IArticleResourceClass are avaiable with
|
||||
// the '$' prefix, we have the choice to expose only what we will use
|
||||
$publish(): IArticleResource;
|
||||
$unpublish(): IArticleResource;
|
||||
}
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResource> {
|
||||
// Overload get to accept our custom parameters
|
||||
get(): ng.resource.IResource;
|
||||
get(params: IArticleParameters, onSuccess: Function): IArticleResource;
|
||||
|
||||
// Add our custom resource actions
|
||||
publish(): IArticleResource;
|
||||
publish(params: IArticleParameters): IArticleResource;
|
||||
unpublish(params: IArticleParameters): IArticleResource;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articleResource = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article: IArticleResource = articleResource.get({id: 1}, function success() {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
### Working with $resource in angular-1.0 definitions
|
||||
```ts
|
||||
|
||||
|
||||
|
||||
// Let's define a custom resource
|
||||
interface IArticleResourceClass extends ng.resource.IResourceClass {
|
||||
publish: ng.resource.IActionCall;
|
||||
unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
interface IArticleResource extends ng.resource.IResource {
|
||||
title: string;
|
||||
text: string;
|
||||
date: Date;
|
||||
author: number;
|
||||
$publish: ng.resource.IActionCall;
|
||||
$unpublish: ng.resource.IActionCall;
|
||||
}
|
||||
|
||||
function MainController($resource: ng.resource.IResourceService) {
|
||||
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
var publishDescriptor: ng.resource.IActionDescriptor;
|
||||
publishDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
|
||||
// I could still create a descriptor without the interface...
|
||||
var unpublishDescriptor = {
|
||||
method: 'POST'
|
||||
}
|
||||
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
var articles = <IArticleResourceClass> $resource('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : unpublishDescriptor
|
||||
});
|
||||
|
||||
// Now we can do this
|
||||
articles.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
var article = <IArticleResource> articles.get({id: 1});
|
||||
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
article.$publish();
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
@@ -627,11 +627,13 @@ function test_angular_forEach() {
|
||||
}
|
||||
|
||||
// angular.element() tests
|
||||
let element = angular.element('div.myApp');
|
||||
let element = angular.element('<div></div>');
|
||||
let scope: ng.IScope = element.scope();
|
||||
let isolateScope: ng.IScope = element.isolateScope();
|
||||
isolateScope = element.find('div.foo').isolateScope();
|
||||
isolateScope = element.find('div').isolateScope();
|
||||
isolateScope = element.children().isolateScope();
|
||||
let element2 = angular.element(element);
|
||||
let elementArray = angular.element(document.querySelectorAll('div'));
|
||||
|
||||
// $timeout signature tests
|
||||
namespace TestTimeout {
|
||||
|
||||
Vendored
+10
-1
@@ -1,6 +1,9 @@
|
||||
// Type definitions for Angular JS 1.6
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Georgii Dolzhykov <http://github.com/thorn0>, Caleb St-Denis <https://github.com/calebstdenis>
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Georgii Dolzhykov <http://github.com/thorn0>
|
||||
// Caleb St-Denis <https://github.com/calebstdenis>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -1471,6 +1474,12 @@ declare namespace angular {
|
||||
* See [XMLHttpRequest.responseType]https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype
|
||||
*/
|
||||
responseType?: string;
|
||||
|
||||
/**
|
||||
* Name of the parameter added (by AngularJS) to the request to specify the name (in the server response) of the JSON-P callback to invoke.
|
||||
* If unspecified, $http.defaults.jsonpCallbackParam will be used by default. This property is only applicable to JSON-P requests.
|
||||
*/
|
||||
jsonpCallbackParam?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+10
-4
@@ -1,3 +1,4 @@
|
||||
// Project: http://jquery.com/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Christian Hoffmeister <https://github.com/choffmeister>
|
||||
// Steve Fenton <https://github.com/Steve-Fenton>
|
||||
@@ -19,6 +20,8 @@
|
||||
// Dick van den Brink <https://github.com/DickvdBrink>
|
||||
// Thomas Schulz <https://github.com/King2500>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Andre Wiggins <https://github.com/andrewiggins>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts
|
||||
|
||||
@@ -169,7 +172,7 @@ interface JQuery {
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/css/#css-properties}
|
||||
*/
|
||||
css(properties: JQueryCssProperties): JQuery;
|
||||
css(properties: JQLiteCssProperties): JQuery;
|
||||
|
||||
/**
|
||||
* Store arbitrary data associated with the matched elements.
|
||||
@@ -664,7 +667,7 @@ interface JQuery {
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
(element: string | Element): JQuery;
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -796,7 +799,10 @@ interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObjec
|
||||
/**
|
||||
* The interface used to specify the properties parameter in css()
|
||||
*/
|
||||
type cssPropertySetter = (index: number, value?: string) => string | number;
|
||||
interface JQueryCssProperties {
|
||||
// tslint:disable-next-line:class-name
|
||||
interface cssPropertySetter {
|
||||
(index: number, value?: string): string | number;
|
||||
}
|
||||
interface JQLiteCssProperties {
|
||||
[propertyName: string]: string | number | cssPropertySetter;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as $ from 'jquery';
|
||||
import $ = require('jquery');
|
||||
import * as angular from 'angular';
|
||||
|
||||
function JQuery() {
|
||||
@@ -82,11 +82,14 @@ function JQuery() {
|
||||
alt: 'jQuery Logo'
|
||||
});
|
||||
|
||||
// $ExpectType string
|
||||
$('img').attr('src');
|
||||
// @types/angular's definition wins here
|
||||
// // $ExpectType string | undefined
|
||||
// $('img').attr('src');
|
||||
}
|
||||
|
||||
function bind() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -95,6 +98,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -103,16 +114,32 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -123,19 +150,35 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function children() {
|
||||
$('p').children();
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').children('span');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').children();
|
||||
}
|
||||
|
||||
function off() {
|
||||
function defaultContext_defaultData(this: HTMLElement, event: JQuery.Event<HTMLElement>) { }
|
||||
|
||||
function defaultContext_customData(this: HTMLElement, event: JQuery.Event<HTMLElement, string>) { }
|
||||
|
||||
function customContext_defaultData(this: I1, event: JQuery.Event<HTMLElement>) { }
|
||||
|
||||
function customContext_customData(this: I1, event: JQuery.Event<HTMLElement, string>) { }
|
||||
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
$('table').off('myEvent', 'td', defaultContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
@@ -144,12 +187,16 @@ function JQuery() {
|
||||
$('table').off('myEvent', 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
$('table').off('myEvent', defaultContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
@@ -159,24 +206,20 @@ function JQuery() {
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -187,6 +230,8 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function on() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -195,6 +240,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -203,6 +256,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -211,6 +272,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', false);
|
||||
|
||||
@@ -222,6 +291,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -230,66 +307,106 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function one() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -298,6 +415,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -306,6 +431,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -314,6 +447,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', false);
|
||||
|
||||
@@ -325,6 +466,14 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
@@ -333,62 +482,100 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
myEvent1: false,
|
||||
myEvent2(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3334
-1558
File diff suppressed because it is too large
Load Diff
Vendored
+103
-29
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ArcGIS API for JavaScript 3.20
|
||||
// Type definitions for ArcGIS API for JavaScript 3.21
|
||||
// Project: https://developers.arcgis.com/javascript/3/
|
||||
// Definitions by: Esri <https://github.com/Esri>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -18,6 +18,7 @@ declare module "esri" {
|
||||
import BasemapLayer = require("esri/dijit/BasemapLayer");
|
||||
import Symbol = require("esri/symbols/Symbol");
|
||||
import BookmarkItem = require("esri/dijit/BookmarkItem");
|
||||
import TimeInfo = require("esri/layers/TimeInfo");
|
||||
import Color = require("esri/Color");
|
||||
import LocationProviderBase = require("esri/tasks/locationproviders/LocationProviderBase");
|
||||
import PictureMarkerSymbol = require("esri/symbols/PictureMarkerSymbol");
|
||||
@@ -213,6 +214,8 @@ declare module "esri" {
|
||||
isReference?: boolean;
|
||||
/** Initial opacity or transparency of the basemap layer. */
|
||||
opacity?: number;
|
||||
/** A url to a JSON file containing the stylesheet information to render the VectorTileLayer. */
|
||||
styleUrl?: string;
|
||||
/** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */
|
||||
subDomains?: string[];
|
||||
/** The URL template used to retrieve the tiles. */
|
||||
@@ -221,7 +224,7 @@ declare module "esri" {
|
||||
tileInfo?: TileInfo;
|
||||
/** Define additional tile server domains for the layer. */
|
||||
tileServer?: string[];
|
||||
/** The type of layer, valid values are "BingMapsAerial", "BingMapsHybrid", "BingMapsRoad", "OpenStreetMap", or "WebTiledLayer". */
|
||||
/** The type of layer. */
|
||||
type?: string;
|
||||
/** URL to the ArcGIS Server REST resource that represents a map or image service. */
|
||||
url?: string;
|
||||
@@ -293,6 +296,8 @@ declare module "esri" {
|
||||
outFields?: string[];
|
||||
/** Refresh interval of the layer in minutes. */
|
||||
refreshInterval?: number;
|
||||
/** Time information for the layer, such as start time field, end time field, track id field, layers time extent and the draw time interval. */
|
||||
timeInfo?: TimeInfo;
|
||||
/** Visibility of the layer. */
|
||||
visible?: boolean;
|
||||
}
|
||||
@@ -474,17 +479,17 @@ declare module "esri" {
|
||||
/** The selected color. */
|
||||
color: Color;
|
||||
/** The row size of the palette. */
|
||||
colorsPerRow: number;
|
||||
colorsPerRow?: number;
|
||||
/** The set of available color options. */
|
||||
palette: Color[];
|
||||
palette?: Color[];
|
||||
/** Array of recent colors to show in the recent colors row. */
|
||||
recentColors: Color[];
|
||||
recentColors?: Color[];
|
||||
/** Toggles color selection being required. */
|
||||
required: boolean;
|
||||
required?: boolean;
|
||||
/** Toggles the recent color row. */
|
||||
showRecentColors: boolean;
|
||||
showRecentColors?: boolean;
|
||||
/** Toggles the transparency slider. */
|
||||
showTransparencySlider: boolean;
|
||||
showTransparencySlider?: boolean;
|
||||
}
|
||||
export interface ConnectOriginsToDestinationsOptions {
|
||||
/** The URL to the GPServer used to execute an analysis job. */
|
||||
@@ -879,6 +884,8 @@ declare module "esri" {
|
||||
showSelectFolder?: boolean;
|
||||
}
|
||||
export interface FeatureLayerOptions {
|
||||
/** Indicates whether attribute features containing m-values can be edited. */
|
||||
allowUpdateWithoutMValues?: boolean;
|
||||
/** Enable or disable the auto generalization of features from a non-editable layer in on-demand mode. */
|
||||
autoGeneralize?: boolean;
|
||||
/** Class attribute to set for the layer's node. */
|
||||
@@ -1401,6 +1408,22 @@ declare module "esri" {
|
||||
force3DTransforms?: boolean;
|
||||
/** By default the map creates and uses an out-of-the-box esri/dijit/Popup. */
|
||||
infoWindow?: InfoWindowBase;
|
||||
/** Indicates whether to enable double-click on a map to recenter and zoom in a level by using SHIFT + Click. */
|
||||
isClickRecenter?: boolean;
|
||||
/** Indicates whether double-clicking on map zooms in on extent. */
|
||||
isDoubleClickZoom?: boolean;
|
||||
/** Indicates whether to enable navigation of the map using a keyboard's arrow keys. */
|
||||
isKeyboardNavigation?: boolean;
|
||||
/** Indicates whether all map navigation is enabled. */
|
||||
isMapNavigation?: boolean;
|
||||
/** Indicates whether panning is enabled within the map. */
|
||||
isPan?: boolean;
|
||||
/** Indicates whether pinch zoom navigation is enabled on touch-enabled devices. */
|
||||
isPinchZoom?: boolean;
|
||||
/** Indicates whether to enable a mouse drag to zoom into to a specific region on the map. */
|
||||
isRubberBandZoom?: boolean;
|
||||
/** (Added at version 3.21). */
|
||||
isScrollWheel?: boolean;
|
||||
/** If provided, the map is initialized with the specified levels of detail. */
|
||||
lods?: LOD[];
|
||||
/** Display the esri logo on the map. */
|
||||
@@ -1547,8 +1570,6 @@ declare module "esri" {
|
||||
popupWindowFeatures?: string;
|
||||
/** The ArcGIS for Portal URL. */
|
||||
portalUrl?: string;
|
||||
/** Indicates whether to display social logins such as Google/Facebook. */
|
||||
showSocialLogins?: boolean;
|
||||
}
|
||||
export interface ObliqueViewerOptions {
|
||||
/** Azimuth angle value for which to display oblique images. */
|
||||
@@ -1765,6 +1786,8 @@ declare module "esri" {
|
||||
export interface PrintOptions {
|
||||
/** Set to true if the print service is an asynchronous geoprocessing service. */
|
||||
async?: boolean;
|
||||
/** Additional parameters for the print service. */
|
||||
extraParameters?: any;
|
||||
/** The map to print. */
|
||||
map?: Map;
|
||||
/** An optional array of user-defined templates. */
|
||||
@@ -1891,8 +1914,6 @@ declare module "esri" {
|
||||
expanded?: boolean;
|
||||
/** This the specified graphicsLayer to use for the highlightGraphic and labelGraphic instead of map.graphics. */
|
||||
graphicsLayer?: Layer;
|
||||
/** The symbol used for highlightGraphic. */
|
||||
highlightSymbol?: Symbol;
|
||||
/** A customized infoTemplate for the selected feature. */
|
||||
infoTemplate?: InfoTemplate;
|
||||
/** The text symbol for the label graphic. */
|
||||
@@ -2528,7 +2549,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
findCredential(url: string, userId?: string): Credential;
|
||||
/**
|
||||
* Returns the OAuth configuration for the passed in Portal server URL.
|
||||
* @param url The URL to the Portal.
|
||||
* @param url The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/portal" for your in-house portal.
|
||||
*/
|
||||
findOAuthInfo(url: string): OAuthInfo;
|
||||
/**
|
||||
@@ -2553,7 +2574,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
* Call this method (during your application initialization) with JSON previously obtained from toJson method to re-hydrate the state of identity manager.
|
||||
* @param json The JSON obtained from the toJson method.
|
||||
*/
|
||||
initialize(json: Object): any;
|
||||
initialize(json: Object): void;
|
||||
/** Returns true if the identity manager is busy accepting user input, i.e., the user has invoked signIn and is waiting for a response. */
|
||||
isBusy(): boolean;
|
||||
/**
|
||||
@@ -2576,7 +2597,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
registerServers(serverInfos: ServerInfo[]): void;
|
||||
/**
|
||||
* Registers the given OAuth2 access token with the identity manager.
|
||||
* @param properties See the object specifications table below for the structure of the properties object.
|
||||
* @param properties See the object specifications table below for the structure of the properties object.
|
||||
*/
|
||||
registerToken(properties: any): void;
|
||||
/**
|
||||
@@ -2889,8 +2910,6 @@ declare module "esri/arcgis/OAuthInfo" {
|
||||
popupWindowFeatures: string;
|
||||
/** The ArcGIS for Portal URL. */
|
||||
portalUrl: string;
|
||||
/** Indicates whether to display social logins like Google/Facebook. */
|
||||
showSocialLogins: boolean;
|
||||
/**
|
||||
* Creates a new OAuthInfo given the specified parameters.
|
||||
* @param params Various options to configure the OAuthInfo object.
|
||||
@@ -2947,6 +2966,8 @@ declare module "esri/arcgis/Portal" {
|
||||
defaultBasemap: any;
|
||||
/** The default extent for the map the portal displays in the map viewer. */
|
||||
defaultExtent: any;
|
||||
/** The default vector basemap to use for the portal. */
|
||||
defaultVectorBasemap: any;
|
||||
/** A description of the organization / portal. */
|
||||
description: string;
|
||||
/** The featured groups for the portal. */
|
||||
@@ -2957,6 +2978,8 @@ declare module "esri/arcgis/Portal" {
|
||||
featuredItemsGroupQuery: string;
|
||||
/** The query that identifies the group containing features items for the gallery. */
|
||||
galleryTemplatesGroupQuery: string;
|
||||
/** Helper services provided by the portal. */
|
||||
helperServices: any;
|
||||
/** The group that contains featured content to be displayed on the home page. */
|
||||
homePageFeaturedContent: string;
|
||||
/** The number of featured items that can be displayed on the home page. */
|
||||
@@ -2991,7 +3014,7 @@ declare module "esri/arcgis/Portal" {
|
||||
portalProperties: any;
|
||||
/** The URL to the thumbnail of the portal. */
|
||||
portalThumbnail: string;
|
||||
/** URL to the portal. */
|
||||
/** The REST URL for the portal, for example "https://www.arcgis.com/sharing/rest/" for ArcGIS Online and "https://www.example.com/arcgis/sharing/rest/" for your in-house portal. */
|
||||
portalUrl: string;
|
||||
/** The region for the organization. */
|
||||
region: string;
|
||||
@@ -3013,7 +3036,7 @@ declare module "esri/arcgis/Portal" {
|
||||
thumbnailUrl: string;
|
||||
/** Sets the units of measure for the organization's users. */
|
||||
units: string;
|
||||
/** The portal url. */
|
||||
/** The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal. */
|
||||
url: string;
|
||||
/** The prefix selected by the organization's administrator to be used with the customBaseURL. */
|
||||
urlKey: string;
|
||||
@@ -3021,9 +3044,13 @@ declare module "esri/arcgis/Portal" {
|
||||
user: PortalUser;
|
||||
/** If true, only simple where clauses that are complaint with SQL92 can be used when querying layers and tables. */
|
||||
useStandardizedQuery: boolean;
|
||||
/** Whether an organization has opted in to use the vector tile basemaps. */
|
||||
useVectorBasemaps: boolean;
|
||||
/** The query that defines the vector tiles basemaps that should be displayed in the Basemap Gallery when useVectorBasemaps is true. */
|
||||
vectorBasemapGalleryGroupQuery: string;
|
||||
/**
|
||||
* Creates a new Portal object.
|
||||
* @param url URL to the ArcGIS.com site or in-house portal.
|
||||
* @param url The ArcGIS for Portal URL, for example "https://www.arcgis.com" for ArcGIS Online and "https://www.example.com/arcgis" for your in-house portal.
|
||||
*/
|
||||
constructor(url: string);
|
||||
/** Returns a PortalUser object that describes the user currently signed in to the portal. */
|
||||
@@ -3111,6 +3138,11 @@ declare module "esri/arcgis/Portal" {
|
||||
url: string;
|
||||
/** Get the current members for the group. */
|
||||
getMembers(): any;
|
||||
/**
|
||||
* Get the URL to the thumbnail image for the portal group.
|
||||
* @param width The desired image width.
|
||||
*/
|
||||
getThumbnailUrl(width?: number): string;
|
||||
/**
|
||||
* Execute a query against the group to return a deferred that when resolved returns PortalQueryResult that contain a results array of PortalItem objects that match the input query.
|
||||
* @param queryParams The input query parameters.
|
||||
@@ -3196,6 +3228,11 @@ declare module "esri/arcgis/Portal" {
|
||||
getComments(): any;
|
||||
/** Returns the rating (if any) given to the item. */
|
||||
getRating(): any;
|
||||
/**
|
||||
* Get the URL to the thumbnail image for the portal item.
|
||||
* @param width The desired image width.
|
||||
*/
|
||||
getThumbnailUrl(width?: number): string;
|
||||
/**
|
||||
* Updates an item comment.
|
||||
* @param comment A PortalComment that contains the comment updates.
|
||||
@@ -3274,6 +3311,11 @@ declare module "esri/arcgis/Portal" {
|
||||
getNotifications(): any;
|
||||
/** Access the tag objects that have been created by the portal user. */
|
||||
getTags(): any;
|
||||
/**
|
||||
* Get the URL to the thumbnail image for the portal user.
|
||||
* @param width The desired image width.
|
||||
*/
|
||||
getThumbnailUrl(width?: number): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3440,7 +3482,7 @@ declare module "esri/dijit/BasemapGallery" {
|
||||
import esri = require("esri");
|
||||
import Basemap = require("esri/dijit/Basemap");
|
||||
|
||||
/** The BasemapGallery dijit displays a collection basemaps from ArcGIS.com or a user-defined set of map or image services. */
|
||||
/** The BasemapGallery dijit displays a collection of basemaps from ArcGIS.com or a user-defined set of map or image services. */
|
||||
class BasemapGallery {
|
||||
/** List of basemaps displayed in the BasemapGallery. */
|
||||
basemaps: Basemap[];
|
||||
@@ -3508,6 +3550,8 @@ declare module "esri/dijit/BasemapLayer" {
|
||||
fullExtent: Extent;
|
||||
/** The initial extent of the layer. */
|
||||
initialExtent: Extent;
|
||||
/** A url to a JSON file containing the stylesheet information to render the VectorTileLayer. */
|
||||
styleUrl: string;
|
||||
/** The subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */
|
||||
subDomains: string[];
|
||||
/** The tile info for the layer including lods, rows, cols, origin and spatial reference. */
|
||||
@@ -5288,6 +5332,8 @@ declare module "esri/dijit/PopupTemplate" {
|
||||
|
||||
/** The PopupTemplate class extends esri/InfoTemplate and provides support for defining a layout. */
|
||||
class PopupTemplate extends InfoTemplate {
|
||||
/** An array of objects that reference Arcade expressions. */
|
||||
expressionInfos: any[];
|
||||
/** The popup definition defined as a JavaScript object. */
|
||||
info: any;
|
||||
/**
|
||||
@@ -5640,6 +5686,9 @@ declare module "esri/dijit/SymbolStyler" {
|
||||
startup(): void;
|
||||
/** Saves the recent fill and outline colors. */
|
||||
storeColors(): void;
|
||||
/** Fired every time an edit is committed. */
|
||||
on(type: "style-update", listener: (event: { target: SymbolStyler }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
export = SymbolStyler;
|
||||
}
|
||||
@@ -5865,7 +5914,7 @@ declare module "esri/dijit/analysis/AnalysisBase" {
|
||||
checkJobStatus(jobId: string): void;
|
||||
/**
|
||||
* Starts an analysis tool.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
*/
|
||||
execute(params: string): void;
|
||||
/**
|
||||
@@ -8633,6 +8682,8 @@ declare module "esri/graphic" {
|
||||
getShape(): any;
|
||||
/** Returns one or more dojox/gfx/shape.Shape used to draw the graphic. */
|
||||
getShapes(): any[];
|
||||
/** In contrast to the getLayer method, getSouceLayer does not change when a graphic is added to another layer. */
|
||||
getSourceLayer(): Layer;
|
||||
/** Returns the title string based on attributes and infoTemplate values. */
|
||||
getTitle(): string;
|
||||
/** Hides the graphic. */
|
||||
@@ -9471,6 +9522,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
advancedQueryCapabilities: any;
|
||||
/** Returns true if the geometry of the features in the layer can be edited, false otherwise. */
|
||||
allowGeometryUpdates: boolean;
|
||||
/** Indicates whether attribute features containing m-values can be edited. */
|
||||
allowUpdateWithoutMValues: boolean;
|
||||
/** The URL, when available, where the layer's attribution data is stored. */
|
||||
attributionDataUrl: string;
|
||||
/** Information about the capabilities enabled for this layer. */
|
||||
@@ -10279,6 +10332,8 @@ declare module "esri/layers/KMLLayer" {
|
||||
getFeature(featureInfo: any): any;
|
||||
/** Get an array of map layers that were created to draw placemarks, ground and screen overlays. */
|
||||
getLayers(): Layer[];
|
||||
/** Refreshes the features in the KML Layer. */
|
||||
refresh(): void;
|
||||
/**
|
||||
* Set the visibility for the specified folder.
|
||||
* @param folder A KML folder.
|
||||
@@ -11034,6 +11089,8 @@ declare module "esri/layers/VectorTileLayer" {
|
||||
fullExtent: Extent;
|
||||
/** The initial extent of the layer. */
|
||||
initialExtent: Extent;
|
||||
/** Name of the vector tile layer. */
|
||||
name: string;
|
||||
/** The spatial reference of the layer. */
|
||||
spatialReference: SpatialReference;
|
||||
/** Contains information about the tiling scheme for the layer. */
|
||||
@@ -11055,6 +11112,10 @@ declare module "esri/layers/VectorTileLayer" {
|
||||
setStyle(styleUrl: string | any): void;
|
||||
/** Fires when the style is changed on the layer. */
|
||||
on(type: "style-change", listener: (event: { style: any; target: VectorTileLayer }) => void): esri.Handle;
|
||||
/** Fires when the layer has finished updating its content. */
|
||||
on(type: "update-end", listener: (event: { target: VectorTileLayer }) => void): esri.Handle;
|
||||
/** Fires when the layer begins to update its content. */
|
||||
on(type: "update-start", listener: (event: { target: VectorTileLayer }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
export = VectorTileLayer;
|
||||
@@ -11773,12 +11834,18 @@ declare module "esri/map" {
|
||||
isDoubleClickZoom: boolean;
|
||||
/** When true, keyboard navigation is enabled. */
|
||||
isKeyboardNavigation: boolean;
|
||||
/** Indicates whether all map navigation is enabled. */
|
||||
isMapNavigation: boolean;
|
||||
/** When true, map panning is enabled using the mouse. */
|
||||
isPan: boolean;
|
||||
/** When true, pan arrows are displayed around the edge of the map. */
|
||||
isPanArrows: boolean;
|
||||
/** Indicates whether pinch zoom navigation is enabled on touch-enabled devices. */
|
||||
isPinchZoom: boolean;
|
||||
/** When true, rubberband zoom is enabled. */
|
||||
isRubberBandZoom: boolean;
|
||||
/** It indicates whether map navigation based on mouse scroll wheel is enabled. */
|
||||
isScrollWheel: boolean;
|
||||
/** When true, the mouse scroll wheel zoom is enabled. */
|
||||
isScrollWheelZoom: boolean;
|
||||
/** When true, shift double click zoom is enabled. */
|
||||
@@ -11853,8 +11920,11 @@ declare module "esri/map" {
|
||||
disableMapNavigation(): void;
|
||||
/** Disallows panning a map using the mouse. */
|
||||
disablePan(): void;
|
||||
disablePinchZoom(): void;
|
||||
/** Disallows zooming in or out on a map using a bounding box. */
|
||||
disableRubberBandZoom(): void;
|
||||
/** Disables navigation of the map based on mouse scroll wheel. */
|
||||
disableScrollWheel(): void;
|
||||
/** Disallows zooming in or out on a map using the mouse scroll wheel. */
|
||||
disableScrollWheelZoom(): void;
|
||||
/** Disallows shift double clicking on a map to zoom in a level and center the map. */
|
||||
@@ -11871,8 +11941,12 @@ declare module "esri/map" {
|
||||
enableMapNavigation(): void;
|
||||
/** Permits users to pan a map using the mouse. */
|
||||
enablePan(): void;
|
||||
/** Enables the user to work with pinch zoom navigation for touch-enabled devices. */
|
||||
enablePinchZoom(): void;
|
||||
/** Permits users to zoom in or out on a map using a bounding box. */
|
||||
enableRubberBandZoom(): void;
|
||||
/** Enables the user to navigate the map based on mouse scroll wheel. */
|
||||
enableScrollWheel(): void;
|
||||
/** Permits users to zoom in or out on a map using the mouse scroll wheel. */
|
||||
enableScrollWheelZoom(): void;
|
||||
/** Permits users to shift double click on a map to zoom in a level and center the map. */
|
||||
@@ -12947,7 +13021,7 @@ declare module "esri/renderers/HeatmapRenderer" {
|
||||
import esri = require("esri");
|
||||
import Renderer = require("esri/renderers/Renderer");
|
||||
|
||||
/** The HeatmapRenderer renders point data into a raster visualization that emphasizes areas of higher density or weighted values. */
|
||||
/** The HeatmapRenderer renders feature layer point data into a raster visualization that emphasizes areas of higher density or weighted values. */
|
||||
class HeatmapRenderer extends Renderer {
|
||||
/** The radius (in pixels) of the circle over which the majority of each points value is spread out over. */
|
||||
blurRadius: number;
|
||||
@@ -13052,7 +13126,7 @@ declare module "esri/renderers/Renderer" {
|
||||
* Returns the visual variable of the specified type.
|
||||
* @param type The type of visual variable desired.
|
||||
*/
|
||||
getVisualVariablesForType(type: string): any;
|
||||
getVisualVariablesForType(type: string): any[];
|
||||
/** Indicates if the renderer has defined visualVariables. */
|
||||
hasVisualVariables(): boolean;
|
||||
/**
|
||||
@@ -14873,7 +14947,7 @@ declare module "esri/tasks/GeometryService" {
|
||||
distance(params: DistanceParameters, callback?: Function, errback?: Function): any;
|
||||
/**
|
||||
* Converts an array of well-known strings into xy-coordinates based on the conversion type and spatial reference supplied by the user.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback An error object is returned if an error occurs during task execution.
|
||||
*/
|
||||
@@ -14945,7 +15019,7 @@ declare module "esri/tasks/GeometryService" {
|
||||
simplify(geometries: Geometry[], callback?: Function, errback?: Function): any;
|
||||
/**
|
||||
* Converts an array of xy-coordinates into well-known strings based on the conversion type and spatial reference supplied by the user.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param params See the object specifications table below for the structure of the params object.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback An error object is returned if an error occurs during task execution.
|
||||
*/
|
||||
@@ -15890,7 +15964,7 @@ declare module "esri/tasks/RouteParameters" {
|
||||
startTimeIsUTC: boolean;
|
||||
/** The set of stops loaded as network locations during analysis. */
|
||||
stops: any;
|
||||
/** If true , the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). */
|
||||
/** If true, the TimeWindowStart and TimeWindowEnd attributes of a stop are in UTC time (milliseconds). */
|
||||
timeWindowsAreUTC: boolean;
|
||||
/** Travel modes define how a pedestrian, car, truck or other medium of transportation moves through the street network. */
|
||||
travelMode: any;
|
||||
@@ -17172,7 +17246,7 @@ declare module "esri/tasks/locator" {
|
||||
*/
|
||||
constructor(url: string);
|
||||
/**
|
||||
* Find address candidates for the input addresses.
|
||||
* Find address candidates for multiple input addresses.
|
||||
* @param params The input addresses in the format supported by the geocoding service.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback The function to call if an error occurs on the server during task execution.
|
||||
@@ -17180,7 +17254,7 @@ declare module "esri/tasks/locator" {
|
||||
addressesToLocations(params: any, callback: Function, errback: Function): any;
|
||||
/**
|
||||
* Sends a request to the ArcGIS REST geocode resource to find candidates for a single address specified in the address parameter.
|
||||
* @param params Specify the address and optionally specify the outFields and searchExtent.
|
||||
* @param params Specify at least the address and optionally other properties.
|
||||
* @param callback The function to call when the method has completed.
|
||||
* @param errback An error object is returned if an error occurs on the Server during task execution.
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
import * as Archiver from 'archiver';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const options: Archiver.ArchiverOptions = {
|
||||
statConcurrency: 1,
|
||||
allowHalfOpen: true,
|
||||
readableObjectMode: true,
|
||||
writeableObjectMode: true,
|
||||
decodeStrings: true,
|
||||
encoding: 'test',
|
||||
highWaterMark: 1,
|
||||
objectmode: true,
|
||||
comment: 'test',
|
||||
forceLocalTime: true,
|
||||
forceZip64: true,
|
||||
store: true,
|
||||
zlib: {},
|
||||
gzip: true,
|
||||
gzipOptions: {},
|
||||
};
|
||||
|
||||
Archiver('zip', options);
|
||||
|
||||
const archiver = Archiver.create('zip');
|
||||
|
||||
const writeStream = fs.createWriteStream('./archiver.d.ts');
|
||||
@@ -14,8 +34,6 @@ archiver.append(readStream, { name: 'archiver.d.ts' });
|
||||
archiver.append(readStream, {name: 'archiver.d.ts'})
|
||||
.append(readStream, {name: 'archiver.d.ts'});
|
||||
|
||||
archiver.bulk({ mappaing: {} });
|
||||
|
||||
archiver.directory('./path', './someOtherPath');
|
||||
archiver.directory('./path', { name: "testName" });
|
||||
archiver.directory('./', "", {});
|
||||
@@ -38,4 +56,6 @@ archiver.setModule(() => {});
|
||||
archiver.pointer();
|
||||
archiver.use(() => {});
|
||||
|
||||
archiver.finalize();
|
||||
archiver.finalize().then();
|
||||
|
||||
archiver.symlink('./path', './target');
|
||||
|
||||
Vendored
+31
-25
@@ -1,24 +1,11 @@
|
||||
// Type definitions for archiver 1.3
|
||||
// Type definitions for archiver 2.0
|
||||
// Project: https://github.com/archiverjs/node-archiver
|
||||
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>, Dolan Miu <https://github.com/dolanmiu>
|
||||
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>, Dolan Miu <https://github.com/dolanmiu>, Crevil <https://github.com/crevil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/* =================== USAGE ===================
|
||||
|
||||
import Archiver = require('archiver);
|
||||
var archiver = Archiver.create('zip');
|
||||
archiver.pipe(fs.createWriteStream('xxx'));
|
||||
archiver.append(fs.createReadStream('xxx'));
|
||||
archiver.finalize();
|
||||
|
||||
=============================================== */
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as stream from 'stream';
|
||||
import * as express from 'express';
|
||||
import * as glob from 'glob';
|
||||
import { ZlibOptions } from 'zlib';
|
||||
|
||||
declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver;
|
||||
|
||||
@@ -38,29 +25,48 @@ declare namespace archiver {
|
||||
abort(): this;
|
||||
append(source: stream.Readable | Buffer | string, name?: EntryData): this;
|
||||
|
||||
bulk(mappings: any): this;
|
||||
|
||||
directory(dirpath: string, options: EntryData | string, data?: EntryData): this;
|
||||
|
||||
file(filename: string, data: EntryData): this;
|
||||
glob(pattern: string, options?: glob.IOptions, data?: EntryData): this;
|
||||
finalize(): this;
|
||||
|
||||
pipe(stream: fs.WriteStream | express.Response): void;
|
||||
finalize(): Promise<void>;
|
||||
|
||||
setFormat(format: string): this;
|
||||
setModule(module: Function): this;
|
||||
|
||||
pointer(): number;
|
||||
use(plugin: Function): this;
|
||||
|
||||
symlink(filepath: string, target: string): this;
|
||||
}
|
||||
|
||||
interface ArchiverOptions {
|
||||
type ArchiverOptions = CoreOptions & TransformOptions & ZipOptions & TarOptions;
|
||||
|
||||
interface CoreOptions {
|
||||
statConcurrency?: number;
|
||||
}
|
||||
|
||||
interface TransformOptions {
|
||||
allowHalfOpen?: boolean;
|
||||
readableObjectMode?: boolean;
|
||||
writeableObjectMode?: boolean;
|
||||
decodeStrings?: boolean;
|
||||
encoding?: string;
|
||||
highWaterMark?: number;
|
||||
objectmode?: boolean;
|
||||
}
|
||||
|
||||
interface ZipOptions {
|
||||
comment?: string;
|
||||
forceLocalTime?: boolean;
|
||||
forceZip64?: boolean;
|
||||
store?: boolean;
|
||||
zlib?: ZlibOptions;
|
||||
}
|
||||
|
||||
interface TarOptions {
|
||||
gzip?: boolean;
|
||||
gzipOptions?: {
|
||||
level: number,
|
||||
};
|
||||
gzipOptions?: ZlibOptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import arrify = require("arrify");
|
||||
|
||||
arrify(null);
|
||||
arrify<number>(null);
|
||||
|
||||
arrify(undefined);
|
||||
arrify<number>(undefined);
|
||||
|
||||
arrify(1);
|
||||
arrify([2, 3]);
|
||||
|
||||
function test(val?: string | string[]) {
|
||||
arrify(val);
|
||||
}
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for arrify 1.0.1
|
||||
// Project: https://github.com/sindresorhus/arrify
|
||||
// Definitions by: AnJun Wang <https://github.com/wanganjun>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* @example
|
||||
* arrify(undefined) // returns []
|
||||
* @example
|
||||
* arrify(null) // returns []
|
||||
* @example
|
||||
* arrify(1) // returns [1]
|
||||
* @example
|
||||
* arrify([2, 3]) // returns [2, 3]
|
||||
* @param val
|
||||
*/
|
||||
declare function arrify<T>(val: undefined | null | T | T[]): T[];
|
||||
export = arrify;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"arrify-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import {nextTick} from 'async.nexttick';
|
||||
|
||||
function calledOnNextTick(a: string): number {
|
||||
return parseInt(a, 10);
|
||||
}
|
||||
|
||||
const aString = 'Hi!';
|
||||
|
||||
nextTick(() => {
|
||||
calledOnNextTick(aString);
|
||||
});
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// Type definitions for async.nexttick 0.5
|
||||
// Project: https://www.npmjs.com/package/async.nexttick
|
||||
// Definitions by: Damien "pyrho" Rajon <https://github.com/pyrho>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function nextTick(callback: () => void, ...args: any[]): void;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"async.nexttick-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -7,7 +7,8 @@ const management = new auth0.ManagementClient({
|
||||
|
||||
const auth = new auth0.AuthenticationClient({
|
||||
domain: '{YOUR_ACCOUNT}.auth0.com',
|
||||
clientId: '{OPTIONAL_CLIENT_ID}'
|
||||
clientId: '{OPTIONAL_CLIENT_ID}',
|
||||
clientSecret: '{OPTIONAL_CLIENT_SECRET}'
|
||||
});
|
||||
|
||||
// Using a callback.
|
||||
|
||||
Vendored
+19
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for auth0 3.0
|
||||
// Type definitions for auth0 2.3
|
||||
// Project: https://github.com/auth0/node-auth0
|
||||
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>, Amiram Korach <https://github.com/amiram>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -83,6 +83,7 @@ export interface Identity {
|
||||
|
||||
export interface AuthenticationClientOptions {
|
||||
clientId?: string;
|
||||
clientSecret?: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
@@ -131,6 +132,16 @@ export interface ResetPasswordEmailOptions {
|
||||
connection: string;
|
||||
}
|
||||
|
||||
export interface ClientCredentialsGrantOptions {
|
||||
audience: string;
|
||||
}
|
||||
|
||||
export interface PasswordGrantOptions {
|
||||
username: string;
|
||||
password: string;
|
||||
realm?: string;
|
||||
}
|
||||
|
||||
export interface ObjectWithId {
|
||||
id: string;
|
||||
}
|
||||
@@ -187,7 +198,8 @@ export interface UnlinkAccountsResponse {
|
||||
|
||||
export interface LinkAccountsData {
|
||||
user_id: string;
|
||||
connection_id: string;
|
||||
connection_id?: string;
|
||||
provider?: string;
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
@@ -254,8 +266,11 @@ export class AuthenticationClient {
|
||||
getProfile(accessToken: string): Promise<any>;
|
||||
getProfile(accessToken: string, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
getCredentialsGrant(scope: string): Promise<any>;
|
||||
getCredentialsGrant(scope: string, cb: (err: Error, message: string) => void): void;
|
||||
clientCredentialsGrant(options: ClientCredentialsGrantOptions): Promise<any>;
|
||||
clientCredentialsGrant(options: ClientCredentialsGrantOptions, cb: (err: Error, response: any) => void): void;
|
||||
|
||||
passwordGrant(options: PasswordGrantOptions): Promise<any>;
|
||||
passwordGrant(options: PasswordGrantOptions, cb: (err: Error, response: any) => void): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
|
||||
|
||||
import AutoLaunch = require('auto-launch');
|
||||
|
||||
var a1 = new AutoLaunch({
|
||||
name: 'Foo',
|
||||
const minecraftAutoLauncher = new AutoLaunch({
|
||||
name: 'Minecraft',
|
||||
path: '/Applications/Minecraft.app',
|
||||
mac: {
|
||||
useLaunchAgent: true
|
||||
}
|
||||
});
|
||||
|
||||
var a2 = new AutoLaunch({
|
||||
name: 'Foo',
|
||||
path: '/Applications/Foo.app',
|
||||
isHidden: true,
|
||||
});
|
||||
minecraftAutoLauncher.enable();
|
||||
minecraftAutoLauncher.disable();
|
||||
|
||||
a1.enable();
|
||||
a2.disable();
|
||||
|
||||
a1.isEnabled(function(enabled: boolean) {
|
||||
if (enabled) {
|
||||
return;
|
||||
minecraftAutoLauncher.isEnabled()
|
||||
.then((isEnabled) => {
|
||||
if (isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
a1.enable(function(err){ console.log(err.message); });
|
||||
});
|
||||
minecraftAutoLauncher.enable();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
Vendored
+39
-33
@@ -1,41 +1,47 @@
|
||||
// Type definitions for auto-launch 0.1.18
|
||||
// Type definitions for auto-launch 5.0
|
||||
// Project: https://github.com/Teamwork/node-auto-launch
|
||||
// Definitions by: rhysd <https://github.com/rhysd>
|
||||
// Definitions by: rhysd <https://github.com/rhysd>, Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface AutoLaunchOption {
|
||||
/**
|
||||
* Application name.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Hidden on launch or not. Default is false.
|
||||
*/
|
||||
isHidden?: boolean;
|
||||
/**
|
||||
* Path to application directory.
|
||||
* Default is process.execPath.
|
||||
*/
|
||||
path?: string;
|
||||
interface AutoLaunchOptions {
|
||||
/**
|
||||
* Application name.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Path to application. Default is `process.execPath`.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* Hidden on launch. Default is `false`.
|
||||
*/
|
||||
isHidden?: boolean;
|
||||
/**
|
||||
* For Mac-only options.
|
||||
*/
|
||||
mac?: {
|
||||
/**
|
||||
* By default, AppleScript is used to add a Login Item. If this is `true`, Launch Agent will be used to auto-launch your app. Defaults is `false`.
|
||||
*/
|
||||
useLaunchAgent?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
declare class AutoLaunch {
|
||||
constructor(opts: AutoLaunchOption);
|
||||
/**
|
||||
* Enables to launch at start up
|
||||
*/
|
||||
enable(callback?: (err: Error) => void): void;
|
||||
/**
|
||||
* Disables to launch at start up
|
||||
*/
|
||||
disable(callback?: (err: Error) => void): void;
|
||||
/**
|
||||
* Returns if auto start up is enabled
|
||||
*/
|
||||
isEnabled(callback: (enabled: boolean) => void): void;
|
||||
constructor(options: AutoLaunchOptions);
|
||||
|
||||
/**
|
||||
* Enables auto-launch at start up.
|
||||
*/
|
||||
enable(): Promise<void>;
|
||||
/**
|
||||
* Disables auto-launch at start up.
|
||||
*/
|
||||
disable(): Promise<void>;
|
||||
/**
|
||||
* Returns true if auto-launch is enabled.
|
||||
*/
|
||||
isEnabled(): Promise<boolean>;
|
||||
}
|
||||
|
||||
declare module "auto-launch" {
|
||||
var al: typeof AutoLaunch;
|
||||
export = al;
|
||||
}
|
||||
export = AutoLaunch;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"auto-launch-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,7 +1,3 @@
|
||||
/// <reference types="babylon" />
|
||||
|
||||
|
||||
|
||||
// Example from https://github.com/babel/babel/tree/master/packages/babel-generator
|
||||
import {parse} from 'babylon';
|
||||
import generate from 'babel-generator';
|
||||
@@ -14,13 +10,13 @@ ast.loc.start;
|
||||
|
||||
const output = generate(ast, { /* options */ }, code);
|
||||
|
||||
|
||||
// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-generator
|
||||
let result = generate(ast, {
|
||||
retainLines: false,
|
||||
compact: "auto",
|
||||
concise: false,
|
||||
quotes: "double",
|
||||
jsonCompatibleStrings: true,
|
||||
// ...
|
||||
}, code);
|
||||
result.code;
|
||||
|
||||
Vendored
+14
-13
@@ -1,12 +1,10 @@
|
||||
// Type definitions for babel-generator v6.7
|
||||
// Type definitions for babel-generator 6.25
|
||||
// Project: https://github.com/babel/babel/tree/master/packages/babel-generator
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Johnny Estilles <https://github.com/johnnyestilles>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="babel-types" />
|
||||
|
||||
import * as t from 'babel-types';
|
||||
type Node = t.Node;
|
||||
|
||||
/**
|
||||
* Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.
|
||||
@@ -15,18 +13,17 @@ type Node = t.Node;
|
||||
* @param code - the original source code, used for source maps.
|
||||
* @returns - an object containing the output code and source map.
|
||||
*/
|
||||
export default function generate(ast: Node, opts?: GeneratorOptions, code?: string | {[filename: string]: string}): GeneratorResult;
|
||||
export default function generate(ast: t.Node, opts?: GeneratorOptions, code?: string | {[filename: string]: string}): GeneratorResult;
|
||||
|
||||
export interface GeneratorOptions {
|
||||
|
||||
/**
|
||||
* Optional string to add as a block comment at the start of the output file.
|
||||
*/
|
||||
*/
|
||||
auxiliaryCommentBefore?: string;
|
||||
|
||||
/**
|
||||
* Optional string to add as a block comment at the end of the output file.
|
||||
*/
|
||||
*/
|
||||
auxiliaryCommentAfter?: string;
|
||||
|
||||
/**
|
||||
@@ -34,7 +31,7 @@ export interface GeneratorOptions {
|
||||
* By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment
|
||||
* contains `@preserve` or `@license`.
|
||||
*/
|
||||
shouldPrintComment?: (comment: string) => boolean;
|
||||
shouldPrintComment?(comment: string): boolean;
|
||||
|
||||
/**
|
||||
* Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).
|
||||
@@ -60,7 +57,7 @@ export interface GeneratorOptions {
|
||||
/**
|
||||
* Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.
|
||||
*/
|
||||
concise?: boolean;
|
||||
concise?: boolean;
|
||||
|
||||
/**
|
||||
* The type of quote to use in the output. If omitted, autodetects based on `ast.tokens`.
|
||||
@@ -70,7 +67,7 @@ export interface GeneratorOptions {
|
||||
/**
|
||||
* Used in warning messages
|
||||
*/
|
||||
filename?: string;
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* Enable generating source maps. Defaults to `false`.
|
||||
@@ -92,10 +89,14 @@ export interface GeneratorOptions {
|
||||
* This will only be used if `code` is a string.
|
||||
*/
|
||||
sourceFileName?: string;
|
||||
|
||||
/**
|
||||
* Set to true to run jsesc with "json": true to print "\u00A9" vs. "©";
|
||||
*/
|
||||
jsonCompatibleStrings?: boolean;
|
||||
}
|
||||
|
||||
export interface GeneratorResult {
|
||||
map: Object;
|
||||
map: {};
|
||||
code: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+8
-8
@@ -1265,17 +1265,17 @@ declare namespace Marionette {
|
||||
*/
|
||||
start(options?: any): void;
|
||||
|
||||
/** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/
|
||||
addRegions(regions: any): any;
|
||||
/** Root region of the application*/
|
||||
region: string;
|
||||
|
||||
/** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/
|
||||
emptyRegions(): void;
|
||||
/** Get the root region */
|
||||
getRegion(): Region;
|
||||
|
||||
/** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/
|
||||
removeRegion(region: Region): void;
|
||||
/** Show a view in the root region */
|
||||
showView(view: Backbone.View<Backbone.Model>): void;
|
||||
|
||||
/** Deprecated! nstead of using the Application as the root of your view tree, you should use a Layout View.*/
|
||||
getRegion(regionName: string): Region;
|
||||
/** Get the view from the root region*/
|
||||
getView(): any;
|
||||
|
||||
module(moduleNames: any, moduleDefinition: any): Module;
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import * as block from "bem-cn";
|
||||
import { Settings } from "bem-cn";
|
||||
|
||||
// expected 'block'
|
||||
block("block")();
|
||||
|
||||
// expected 'block__elem'
|
||||
block("block")("elem")();
|
||||
|
||||
// expected 'block__elem block__elem_disabled block__elem_size_small'
|
||||
block("block")("elem", { disabled: true, size: 'small' })();
|
||||
|
||||
// expected 'block block_disabled'
|
||||
block("block")({ disabled: true})();
|
||||
|
||||
// expected 'block mix'
|
||||
block("block").mix("mix");
|
||||
|
||||
// expected 'block mix mix2'
|
||||
block("block").mix(["mix", "mix2"]);
|
||||
|
||||
// expected 'block is-hidden'
|
||||
block("block").state({ hidden: true });
|
||||
|
||||
// expected 'block'
|
||||
block("block").state({ hidden: false });
|
||||
|
||||
// expected 'block is-hidden is-error'
|
||||
block("block").state({ hidden: true, error: true });
|
||||
|
||||
// expected 'block is-loading'
|
||||
block("block").is({ loading: true });
|
||||
|
||||
// expected 'block has-content'
|
||||
block("block").has({ content: true });
|
||||
|
||||
block.setup({
|
||||
el: '~~',
|
||||
mod: '--',
|
||||
modValue: '-'
|
||||
});
|
||||
|
||||
// expected 'block~~elem'
|
||||
block("block")("elem");
|
||||
|
||||
// expected 'block block--mod-value'
|
||||
block("block")({ mod: "value"});
|
||||
|
||||
// I can use bem-cn interfaces
|
||||
const customSettings: Settings = {
|
||||
ns: 'prefix'
|
||||
};
|
||||
|
||||
block.setup(customSettings);
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for bem-cn 2.1
|
||||
// Project: https://github.com/albburtsev/bem-cn
|
||||
// Definitions by: Vitaly Selkin <https://github.com/selkinvitaly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type StateFn = (states: { [key: string]: boolean }) => BemCn.Inner;
|
||||
declare function BemCn(name: string): BemCn.Inner;
|
||||
|
||||
declare namespace BemCn {
|
||||
function reset(): void;
|
||||
function setup(settings?: Settings): void;
|
||||
|
||||
interface Modifications {
|
||||
[key: string]: (string | boolean);
|
||||
}
|
||||
|
||||
interface Inner {
|
||||
(elem: string | Modifications): Inner;
|
||||
(elem: string, mods: Modifications): Inner;
|
||||
(): string;
|
||||
|
||||
mix(mixes: string | string[]): Inner;
|
||||
has: StateFn;
|
||||
state: StateFn;
|
||||
is: StateFn;
|
||||
toString(): string;
|
||||
valueOf(): string;
|
||||
split(separator: string, limit?: number): string[];
|
||||
}
|
||||
|
||||
interface Settings {
|
||||
ns?: string;
|
||||
el?: string;
|
||||
mod?: string;
|
||||
modValue?: string;
|
||||
classMap?: { [className: string]: string } | null;
|
||||
}
|
||||
}
|
||||
|
||||
export as namespace BemCn;
|
||||
export = BemCn;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bem-cn-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+119
@@ -0,0 +1,119 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/** Options used to customize the autosuggest functionality. */
|
||||
export interface IAutosuggestOptions {
|
||||
/** Specifies if street address suggestions should be returned. Default: true */
|
||||
addressSuggestions?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies if the user’s location should be auto detected using their IP address, if no location information is provided
|
||||
* in the userLocation property. Default: true
|
||||
*/
|
||||
autoDetectLocation?: boolean;
|
||||
|
||||
/**
|
||||
* A bounding box that is used to help influence the results such that locations that are in or near this bounding box
|
||||
* are given more weight than they would normally.
|
||||
*/
|
||||
bounds?: LocationRect;
|
||||
|
||||
/**
|
||||
* A reference to a map instance. If the useMapView property is set to true, the bounding box of the map view will be used
|
||||
* to influence the weight of suggestions.
|
||||
*/
|
||||
map?: Map;
|
||||
|
||||
/** The maximum number of results to return. Can be any value between 1 and 10. Default: 5 */
|
||||
maxResults?: number;
|
||||
|
||||
/** Specifies if place suggestions (city, landmark, etc.) should be returned. Default: true */
|
||||
placeSuggestions?: boolean;
|
||||
|
||||
/**
|
||||
* Indicates if the maps bounding box should be used to influence the suggested results. Ignored if the bounds property is
|
||||
* set. Default: true
|
||||
*/
|
||||
useMapView?: boolean;
|
||||
|
||||
/** A coordinate indicating where the user is located. This will influence the results to be more relevant to the user. */
|
||||
userLocation?: Location;
|
||||
}
|
||||
|
||||
/** Represents the suggestion result from the Autosuggest manager. */
|
||||
export interface ISuggestionResult {
|
||||
/** A structured address object for the result. */
|
||||
address: IAddress;
|
||||
|
||||
/** A LocationRect that can be used to set the map view over the result. */
|
||||
bestView: LocationRect;
|
||||
|
||||
/** Unique entity id to be used for searching the entity. */
|
||||
entityId: string;
|
||||
|
||||
/** The type of the result; Address, Place */
|
||||
entityType: string;
|
||||
|
||||
/** The sub type of result; Address, RoadBlock, PopulatedPlace, CountryRegion, etc. */
|
||||
entitySubType: string;
|
||||
|
||||
/** A nicely formatted suggestion string for the result based on market. */
|
||||
formattedSuggestion: string;
|
||||
|
||||
/**
|
||||
* The coordinate of the result. This value is only returned for place (city, landmarks) results and not for addresses.
|
||||
* Street addresses will need to be geocoded to get their location.
|
||||
*/
|
||||
location: Location;
|
||||
|
||||
/** A secondary title that provides additional context to the title value of the suggestion. **/
|
||||
subtitle: string;
|
||||
|
||||
/** The display title for the result (i.e. “Redmond”). */
|
||||
title: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The AutosuggestManager is the primary class in the Autosuggest module that powers the autosuggest functionality.
|
||||
* @requires The Microsoft.Maps.Autosuggest module.
|
||||
*/
|
||||
export class AutosuggestManager {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Autosuggest module.
|
||||
* @param options The options to use with the autosuggest manager.
|
||||
*/
|
||||
constructor(options?: IAutosuggestOptions);
|
||||
|
||||
/**
|
||||
* Attaches the Autosuggest functionality to an input box.
|
||||
* @param suggestionBoxId The HTML element identifier of the input box.
|
||||
* @param suggestionContainerId The Id of container where suggestions will be displayed.
|
||||
* @param selectedSuggestionCallback A reference to a callback function that will be called when a user selects a suggestion from the Autosuggest UI.
|
||||
*/
|
||||
public attachAutosuggest(suggestionBoxId: string, suggestionContainerId: string, selectedSuggestionCallback: (result: ISuggestionResult) => void) : void;
|
||||
|
||||
/** Detaches the autosuggest functionality from the input box, freeing any resources it has or events it has tied to. */
|
||||
public detachAutosuggest(): void;
|
||||
|
||||
/** Disposes the Autosuggest object, freeing any resources it has or events it has tied to. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets the options currently used by the autosuggest manager.
|
||||
* @returns The options currently used by the autosuggest manager.
|
||||
*/
|
||||
public getOptions(): IAutosuggestOptions;
|
||||
|
||||
/**
|
||||
* Sets the options currently used by the autosuggest manager.
|
||||
* @param options The options to use with the autosuggest manager.
|
||||
*/
|
||||
public setOptions(options?: IAutosuggestOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
+149
@@ -0,0 +1,149 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/** The options used to customize how the ClusterLayer functions. */
|
||||
export interface IClusterLayerOptions {
|
||||
/**
|
||||
* A callback function that is fired after the clustering for a map view has completed. This is useful if you want to generate a list of locations based on what is in the current view.
|
||||
*/
|
||||
callback?: () => void;
|
||||
|
||||
/**
|
||||
* A callback function that allows you to process a clustered pushpin before it is added to a layer. This is useful if you want to add events or set style options on the clustered pushpin.
|
||||
*/
|
||||
clusteredPinCallback?: (pin: ClusterPushpin) => void;
|
||||
|
||||
/**
|
||||
* Indicates if the layer should cluster the locations or not. Default: true
|
||||
*/
|
||||
clusteringEnabled?: boolean;
|
||||
|
||||
/**
|
||||
* Defines how clusters are positioned on the map. Default: MeanAverage
|
||||
*/
|
||||
clusterPlacementType?: ClusterPlacementType;
|
||||
|
||||
/**
|
||||
* The width and height of the gird cells used for clustering in pixels. Default: 45
|
||||
*/
|
||||
gridSize?: number;
|
||||
|
||||
/**
|
||||
* Offsets the placement of clustered pushpins by a set number of pixels. This option is only available when the placement type is set to GridCenter.
|
||||
* This is useful if you have multiple cluster layers on the map and you want to offset the clustered pushpins between the layers so that they are visible,
|
||||
* otherwise the clusters from the different layers would overlap completely.
|
||||
*/
|
||||
layerOffset?: Point;
|
||||
|
||||
/**
|
||||
* A boolean indicating if the layer is visible or not.
|
||||
*/
|
||||
visible?: boolean;
|
||||
|
||||
/**
|
||||
* The z-index of the layer.
|
||||
*/
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to specify how a clustered pushpin should be positioned relative to the pushpins it contains.
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
*/
|
||||
export enum ClusterPlacementType {
|
||||
/**
|
||||
* Mean Average placement calculates the average position of a group of coordinates. This method creates a more realistic representation of the data,
|
||||
* however requires more processing power and increases the chances of pushpins overlapping.
|
||||
*/
|
||||
MeanAverage,
|
||||
|
||||
/**
|
||||
* This method is the simplest way to represent a cluster. It places the cluster at the first location in the cluster. This method may not accurately
|
||||
* represent the data but requires little processing power.
|
||||
*/
|
||||
FirstLocation
|
||||
}
|
||||
|
||||
/**
|
||||
* This class extends the Pushpin class and has all the same methods and properties plus the following properties.
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
*/
|
||||
export class ClusterPushpin extends Pushpin {
|
||||
/** An array of all the pushpins that are in the cluster. */
|
||||
containedPushpins: Pushpin[];
|
||||
|
||||
/**
|
||||
* The grid cell key that can be used retrieve the clustered pushpin(s) from the clustering layer. This is useful when creating a clickable list that
|
||||
* link items in the list to clusters or pushpins on the map. Your list just needs to store the gridKey value.
|
||||
*/
|
||||
gridKey: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows you to easily add in client side clustering to your application. Client Side Clustering is a method where pushpins that are close
|
||||
* together are grouped and represented as a single pushpin, often using a different icon to indicate the cluster. This is a great way to improve both
|
||||
* the user experience and performance of the map.
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
*/
|
||||
export class ClusterLayer implements IDataLayer {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Clustering module.
|
||||
* @param pushpins An array of pushpins to cluster in the layer.
|
||||
* @param options The options used to customize how the ClusterLayer functions.
|
||||
*/
|
||||
constructor(pushpins: Pushpin[], options?: IClusterLayerOptions);
|
||||
|
||||
/** Clears all the data in the cluster layer. */
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Gets all the pushpins that are in the current map view. If clustering is disabled, all pushpins in the clustering layer are returned.
|
||||
* @returns All the pushpins that are in the current map view. If clustering is disabled, all pushpins in the clustering layer are returned.
|
||||
*/
|
||||
public getDisplayedPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Gets the current options used by the cluster layer.
|
||||
* @returns The current options used by the cluster layer.
|
||||
*/
|
||||
public getOptions(): IClusterLayerOptions;
|
||||
|
||||
/**
|
||||
* Gets all pushpins that are in the layers.
|
||||
* @returns An array of all the pushpins that are in the layers.
|
||||
*/
|
||||
public getPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Gets the original pushpins that are in the specified grid cell.
|
||||
* @param The gridKey index to retrieve the pushpins for.
|
||||
* @returns The original pushpins that are in the specified grid cell.
|
||||
*/
|
||||
public getPushpinsByGridKey(gridKey: number): Pushpin[];
|
||||
|
||||
/**
|
||||
* Gets the pushpin in the specified cluster grid cell which can be either a ClusterPushpin if there are multiple pushpins in a cell or a single Pushpin.
|
||||
* @param The gridKey index to retrieve the pushpins for.
|
||||
* @returns The pushpin in the specified cluster grid cell which can be either a ClusterPushpin if there are multiple pushpins in a cell or a single Pushpin.
|
||||
*/
|
||||
public getClusterPushpinByGridKey(gridKey: number): ClusterPushpin | Pushpin;
|
||||
|
||||
/**
|
||||
* Sets the clustering options to use in the layer.
|
||||
* @params options The clustering options to use in the layer.
|
||||
*/
|
||||
public setOptions(options: IClusterLayerOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the array of pushpins that are used in the clustering layer.
|
||||
* @param pushpins An array of pushpins that are to be used by the clustering layer.
|
||||
*/
|
||||
public setPushpins(pushpins: Pushpin[]): void;
|
||||
}
|
||||
}
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/**
|
||||
* The contour layer options
|
||||
*/
|
||||
interface IContourLayerOptions {
|
||||
/** The z-index of this layer */
|
||||
zIndex?: number;
|
||||
|
||||
/** Whether the layer is visible */
|
||||
visible?: boolean;
|
||||
|
||||
/** A callback function which defines the color of the contour line fill. */
|
||||
colorCallback?: (contourValue: number | string) => string | Color;
|
||||
|
||||
/** The polygon options that apply to all contour lines of this layer */
|
||||
polygonOptions?: IPolygonOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* The contour line of a contour layer
|
||||
*/
|
||||
export class ContourLine extends Polygon {
|
||||
/** The contour lines that are directly nested inside this contour line */
|
||||
public innerContourLines: ContourLine[];
|
||||
|
||||
/** The outer/parent contour line of this contour */
|
||||
public outerContourLine: ContourLine;
|
||||
|
||||
/** The data value associated with this contour line */
|
||||
public contourValue: number | string;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param boundary The boundary of this contour line
|
||||
* @param contourValue The value associated with this contour line
|
||||
*/
|
||||
constructor(boundary: Location[], contourValue?: number | string);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contour layer class.
|
||||
*/
|
||||
export class ContourLayer extends Layer {
|
||||
/**
|
||||
* @constructor
|
||||
* @param contourLines The contour lines that compose this layer.
|
||||
* @param options The contour layer options.
|
||||
*/
|
||||
constructor(contourLines: ContourLine[], options?: IContourLayerOptions);
|
||||
|
||||
/**
|
||||
* Clears all data on the contour layer.
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Gets the contour lines of this layer.
|
||||
* @returns The contour lines of this layer.
|
||||
*/
|
||||
public getContourLines(): ContourLine[];
|
||||
|
||||
/**
|
||||
* Gets the polygons that were generated from the contour lines in this layer.
|
||||
* @returns The polygons that were generated from the contour lines in this layer.
|
||||
*/
|
||||
public getContourPolygons(): Polygon[];
|
||||
|
||||
/**
|
||||
* Retrieves the options of this contour layer.
|
||||
* @returns The options of this contour layer.
|
||||
*/
|
||||
public getOptions(): IContourLayerOptions;
|
||||
|
||||
/**
|
||||
* Sets the contour lines used to calculate the polygon areas of this layer.
|
||||
* @param contourLines The contour lines used to calculate the polygon areas of this layer.
|
||||
*/
|
||||
public setContourLines(contourLines: ContourLine[]): void;
|
||||
|
||||
/**
|
||||
* Sets the options of the contour layer.
|
||||
* @param options The new options to update the layer.
|
||||
*/
|
||||
public setOptions(options: IContourLayerOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
+154
@@ -0,0 +1,154 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
/// <reference path="SpatialMath.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/**
|
||||
* Specifies the shape of data bin rendered in the layer.
|
||||
*/
|
||||
export enum DataBinType {
|
||||
/* Renders data bins as circles in a square grid. */
|
||||
circle,
|
||||
|
||||
/* Renders data bins as hexagons with a flat top edge. */
|
||||
hexagon,
|
||||
|
||||
/* Renders data bins as circles in a hexagonal grid. */
|
||||
hexCircle,
|
||||
|
||||
/* Renders data bins as hexagons with a pointy top corner. */
|
||||
pointyHexagon,
|
||||
|
||||
/* Renders data bins as a square grid. */
|
||||
square
|
||||
}
|
||||
|
||||
/**
|
||||
* A set options the define how a data binning layer is rendered.
|
||||
*/
|
||||
export interface IDataBinningOptions {
|
||||
/* The name of a property in the Pushpin.metadata object on which to perform calculations (average, count, sum) against the pushpins in each data bin. */
|
||||
aggregationProperty?: string;
|
||||
|
||||
/*
|
||||
* A callback function which defines the color a data bin polygon should be. This callback recieves data bin information
|
||||
* along with the min and max calculated metrics for the data set. If set, this callback function must return a color value.
|
||||
*/
|
||||
colorCallback?: (binInfo: IDataBinInfo, min: IDataBinMetrics, max: IDataBinMetrics) => string | Color;
|
||||
|
||||
/* The shape of the data bin to generate. Default: hexagon */
|
||||
dataBinType?: DataBinType;
|
||||
|
||||
/* The distance units of the radius option. Default: meters */
|
||||
distanceUnits?: SpatialMath.DistanceUnits;
|
||||
|
||||
/* The default options used for rendering the data bin polygons. */
|
||||
polygonOptions?: IPolygonOptions;
|
||||
|
||||
/*
|
||||
* A spatial distance which will be converted into a pixel distance at the equater and used to generate symetrically sized data bins
|
||||
* that have the apprimate spatial distance radius. Default: 1000
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/*
|
||||
* A callback function which defines how much to scale a data bins size. This callback recieves data bin information
|
||||
* along with the min and max calculated metrics for the data set. If set, this callback function must return a number between 0 and 1.
|
||||
*/
|
||||
scaleCallback?: (binInfo: IDataBinInfo, min: IDataBinMetrics, max: IDataBinMetrics) => number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A set of values calculated from the pushpins in a data bin.
|
||||
*/
|
||||
export interface IDataBinMetrics {
|
||||
|
||||
/* The average value of the aggregation property of the pushpins in a data bin. */
|
||||
average?: number;
|
||||
|
||||
/* The number of pushpins in a data bin. */
|
||||
count?: number;
|
||||
|
||||
/* The number of pushpins in the data bin who's aggregation property has a value. */
|
||||
countNotBlank?: number;
|
||||
|
||||
/* The number of pushpins in the data bin who's aggregation property is a valid number. */
|
||||
countNumbers?: number;
|
||||
|
||||
/* The sum of the aggregation property of the pushpins in a data bin. */
|
||||
sum?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of a calculated data bin.
|
||||
*/
|
||||
export interface IDataBinInfo {
|
||||
/* An array of all the pushpins that are in the data bin. */
|
||||
containedPushpins: Microsoft.Maps.Pushpin[];
|
||||
|
||||
/* A set of calculated metric values determined using the aggregationProperty value of all the pushpins contained in the data bin. */
|
||||
metrics: IDataBinMetrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* A polygon which represents a data bin on the map and contains the data bin information.
|
||||
*/
|
||||
|
||||
export class DataBinPolygon extends Polygon {
|
||||
/* Information about the data bin; the contained pushpins and calculated metrics. */
|
||||
public dataBinInfo: IDataBinInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides a data binning visualization for the map. It takes in an array of pushpins, groups them into
|
||||
* symmetrical shapes that fit together in a grid such as hexagons. Aggregation of data values are done and can be
|
||||
* used to customize how the data bins are rendered on the map (i.e. scale / color) .
|
||||
*/
|
||||
export class DataBinningLayer extends Layer {
|
||||
/**
|
||||
* Initializes the data binning layer.
|
||||
* @param pushpins The array of pushpins that are used to generate the data bins.
|
||||
* @param options The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
constructor(pushpins?: Pushpin[], options?: IDataBinningOptions);
|
||||
|
||||
/**
|
||||
* Gets the options used for calculating and rendering the data bins.
|
||||
* @returns The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
public getOptions(): IDataBinningOptions;
|
||||
|
||||
/**
|
||||
* Gets all pushpins that are in the layers.
|
||||
* @returns All pushpins that are in the layers.
|
||||
*/
|
||||
public getPushpins(): Pushpin[];
|
||||
|
||||
/**
|
||||
* Sets the array of pushpins that are used to generate the data bins.
|
||||
* @param pushpins The array of pushpins that are used to generate the data bins.
|
||||
*/
|
||||
public setPushpins(pushpins: Pushpin[]): void;
|
||||
|
||||
/**
|
||||
* Clears all the data in the data binning layer.
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* Cleans up any resources this object is consuming.
|
||||
*/
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Sets the options used for calculating and rendering the data bins.
|
||||
* @param options The options used for calculating and rendering the data bins.
|
||||
*/
|
||||
public setOptions(options: IDataBinningOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
+618
@@ -0,0 +1,618 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps.Directions {
|
||||
/////////////////////////////////////
|
||||
/// Enumerations
|
||||
////////////////////////////////////
|
||||
|
||||
/** Distance units for calculating the directions in. */
|
||||
export enum DistanceUnit {
|
||||
|
||||
/** A distance in Kilometers. */
|
||||
km,
|
||||
|
||||
/** A distance in Miles. */
|
||||
miles
|
||||
}
|
||||
|
||||
/** Defines the type of route to calculate. */
|
||||
export enum RouteMode {
|
||||
/** Driving directions are calculated. */
|
||||
driving,
|
||||
|
||||
/** Transit directions are calculated. */
|
||||
transit,
|
||||
|
||||
/** Walking directions are calculated. */
|
||||
walking
|
||||
}
|
||||
|
||||
/** Defines features to avoid when calculating the route. */
|
||||
export enum RouteAvoidance {
|
||||
/** Calculate the best route using any travel option available. */
|
||||
none = 0,
|
||||
|
||||
/** Reduce the use of limited access highways when calculating the route. */
|
||||
minimizeHighways = 1,
|
||||
|
||||
/** Reduce the use of roads with tolls when calculating the route. */
|
||||
minimizeToll = 2,
|
||||
|
||||
/** Avoid using limited access highways when calculating the route. */
|
||||
avoidHighways = 4,
|
||||
|
||||
/** Avoid using roads with tolls when calculating the route. */
|
||||
avoidToll = 8,
|
||||
|
||||
/** Avoid using express trains when calculating the route. This option only affects routes with a transitRouteMode that have the culture set to ja-jp. */
|
||||
avoidExpressTrain = 16,
|
||||
|
||||
/** Avoid using airlines when calculating the route. This option only affects routes with a transitRouteMode that have the culture set to ja-jp. */
|
||||
avoidAirline = 32,
|
||||
|
||||
/** Avoid using bullet trains when calculating the route. This option only affects routes with a transitRouteMode that have the culture set to ja-jp. */
|
||||
avoidBulletTrain = 64
|
||||
}
|
||||
|
||||
/** Response codes for a route calculation request. */
|
||||
export enum RouteResponseCode {
|
||||
/** The route was successfully calculated. */
|
||||
success = 0,
|
||||
|
||||
/** An unknown error has occurred. */
|
||||
unknownError = 1,
|
||||
|
||||
/** A nearby road cannot be found for one or more of the route waypoints. */
|
||||
cannotFindNearbyRoad = 2,
|
||||
|
||||
/**
|
||||
* The distance between two route waypoints, or the total length of the route exceeds the limit of the route mode.
|
||||
* Modify the waypoint locations so that they are closer together.
|
||||
*/
|
||||
tooFar = 3,
|
||||
|
||||
/**
|
||||
* A route cannot be calculated for the specified waypoints. For example, this code is returned when a route between
|
||||
* “Seattle, WA” and “Honolulu, HI” is requested.
|
||||
*/
|
||||
noSolution = 4,
|
||||
|
||||
/** There is no route data for the specified waypoints. */
|
||||
dataSourceNotFound = 5,
|
||||
|
||||
/** There are no transit options available for the specified time. */
|
||||
noAvailableTransitTrip = 7,
|
||||
|
||||
/** The transit stops are so close that walking is always a better option. */
|
||||
transitStopsTooClose = 8,
|
||||
|
||||
/** The transit stops are so close that walking is a better option. */
|
||||
walkingBestAlternative = 9,
|
||||
|
||||
/**
|
||||
* There is no transit data available for the route or for one or more of the specified waypoints,
|
||||
* or the waypoints are in different transit areas that do not overlap.
|
||||
*/
|
||||
outOfTransitBounds = 10,
|
||||
|
||||
/** The directions calculation request has timed out. */
|
||||
timeOut = 11,
|
||||
|
||||
/**
|
||||
* One or more waypoints need to be disambiguated. This error does not occur if the
|
||||
* autoDisplayDisambiguation directions render option is set to true.
|
||||
*/
|
||||
waypointDisambiguation = 12,
|
||||
|
||||
/** One or more waypoints do not have an address or location specified. */
|
||||
hasEmptyWaypoint = 13,
|
||||
|
||||
/** The maximum number of waypoints, which is 25, has been exceeded. */
|
||||
exceedMaxWaypointLimit = 14,
|
||||
|
||||
/** At least two waypoints are required to calculate a route. */
|
||||
atleastTwoWaypointRequired = 15,
|
||||
|
||||
/** The first or last waypoint is a via point, which is not allowed. */
|
||||
firstOrLastStoppointIsVia = 16,
|
||||
|
||||
/** The search service failed to return results. */
|
||||
searchServiceFailed = 17,
|
||||
|
||||
/** The credentials passed to the Directions module are invalid. */
|
||||
invalidCredentials = 18
|
||||
}
|
||||
|
||||
/** Defines optimization options for calculating directions. */
|
||||
export enum RouteOptimization {
|
||||
/** Calculate a route the shortest time. */
|
||||
shortestTime = 0,
|
||||
|
||||
/** Calculate a route with the shortest distance. */
|
||||
shortestDistance = 1,
|
||||
|
||||
/** The route is calculated to minimize the time and uses current traffic information. */
|
||||
timeWithTraffic = 2,
|
||||
|
||||
/** The route is calculated to minimize the time and avoid road closures. Traffic information is not used in the calculation. */
|
||||
timeAvoidClosure = 3,
|
||||
|
||||
/** Minimize the cost when calculating directions. This option only affects routes with a transitRouteMode that have the culture set to ja-jp.*/
|
||||
minimizeMoney = 4,
|
||||
|
||||
/** Minimize transit transfers when calculating directions. This option only affects routes with a transitRouteMode that have the culture set to ja-jp.*/
|
||||
minimizeTransfers = 5,
|
||||
|
||||
/** Minimize the amount of walking when calculating directions. This option only affects routes with a transitRouteMode that have the culture set to ja-jp.*/
|
||||
minimizeWalking = 6
|
||||
}
|
||||
|
||||
/** An enumeration that specifies the releance of a dateTime when calculating a route. */
|
||||
export enum TimeType {
|
||||
/** The dateTime parameter contains the desired arrival time for a transit request. */
|
||||
arrival,
|
||||
|
||||
/** The dateTime parameter contains the desired departure time for a transit request. */
|
||||
departure,
|
||||
|
||||
/** The dateTime parameter should be ignored and the first available transit taken. */
|
||||
firstAvailable,
|
||||
|
||||
/** The dateTime parameter contains the latest departure time available for a transit request. */
|
||||
lastAvailable
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Interfaces
|
||||
////////////////////////////////////
|
||||
|
||||
/** Contains the arguments for directions events. */
|
||||
export interface IDirectionsEventArgs {
|
||||
/** The calculated route (or routes, if the route mode is transit). */
|
||||
route: IRoute[];
|
||||
|
||||
/** The route summary (or summaries) of the route(s) defined in the route property. */
|
||||
routeSummary: IRouteSummary[];
|
||||
}
|
||||
|
||||
/** Contains arguments for directions error events. */
|
||||
export interface IDirectionsErrorEventArgs {
|
||||
/** The code which identifies the error that occurred. */
|
||||
responseCode: RouteResponseCode;
|
||||
|
||||
/** The error message. */
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** Represents one direction in a set of route directions. */
|
||||
export interface IDirectionsStep {
|
||||
/** The child direction items for this directions step. */
|
||||
childItineraryItems: IDirectionsStep[];
|
||||
|
||||
/** The location of the start of the direction. */
|
||||
coordinate: Location;
|
||||
|
||||
/** The total distance of the step in the unit specified in the distanceUnit property of the DirectionsRequestOptions. */
|
||||
distance: string;
|
||||
|
||||
/** The total time, in seconds, of the direction step. */
|
||||
durationInSeconds: number;
|
||||
|
||||
/** The HTML formatted route instruction associated with the step. */
|
||||
formattedText: string;
|
||||
|
||||
/** A boolean indicating whether the maneuver image is a road shield image. */
|
||||
isImageRoadShield: boolean;
|
||||
|
||||
/** The name of the maneuver image. */
|
||||
maneuverImageName: string;
|
||||
|
||||
/** An array of strings, where each string is a hint to help determine when to move to the next direction step. Not all direction steps have hints. */
|
||||
postIntersectionHints: string[];
|
||||
|
||||
/** An array of strings, where each string is a hint to help determine when you have arrived at this direction step. Not all direction steps have hints. */
|
||||
preIntersectionHints: string[];
|
||||
|
||||
/** The name of the transit stop where this step originates. */
|
||||
startStopName: string;
|
||||
|
||||
/** The transit line associated with this step. */
|
||||
transitLine: ITransitLine;
|
||||
|
||||
/** The URL of the image to use for transit direction steps. */
|
||||
transitStepIcon: string;
|
||||
|
||||
/** The ID of the transit stop. */
|
||||
transitStopId: string;
|
||||
|
||||
/** The name of the transit line end. */
|
||||
transitTerminus: string;
|
||||
}
|
||||
|
||||
/** Represents a route. */
|
||||
export interface IRoute {
|
||||
/** The legs of the route. Each route leg represents the route between two waypoints. */
|
||||
routeLegs: IRouteLeg[];
|
||||
|
||||
/** An array of locations that makes up the path of the route. */
|
||||
routePath: Location[];
|
||||
}
|
||||
|
||||
/** Represents a leg of a route. A route leg is the part of the route between two stop waypoints. */
|
||||
export interface IRouteLeg {
|
||||
/** The end time of the route leg. This property only applies when the routeMode of the DirectionsRequestOptions is set to transit. */
|
||||
endTime: Date;
|
||||
|
||||
/** The location of the last waypoint of this leg. */
|
||||
endWaypointLocation: Location;
|
||||
|
||||
/** The directions steps associated with this route leg. */
|
||||
itineraryItems: IDirectionsStep[];
|
||||
|
||||
/** The index of the route to which this route leg belongs. */
|
||||
originalRouteIndex: number;
|
||||
|
||||
/** The start time of the route leg. This property only applies when the routeMode of the DirectionsRequestOptions is set to transit. */
|
||||
startTime: Date;
|
||||
|
||||
/** The location of the first waypoint of this route leg. */
|
||||
startWaypointLocation: Location;
|
||||
|
||||
/** The sub legs of this route leg. A sub leg of a route is the part of the route between a stop point and a via point or between two via points.*/
|
||||
subLegs: IRouteSubLeg[];
|
||||
|
||||
/** The summary which describes this route leg. */
|
||||
summary: IRouteSummary;
|
||||
}
|
||||
|
||||
/** Represents a route sub leg. A route sub leg is the part of the route between a stop point and a via point or between two via points. */
|
||||
export interface IRouteSubLeg {
|
||||
/** The location of the last waypoint of the sub leg. */
|
||||
actualEnd: Location;
|
||||
|
||||
/** The location of the first waypoint of the sub leg. */
|
||||
actualStart: Location;
|
||||
|
||||
/** The description of the last waypoint of the sub leg. */
|
||||
endDescription: string;
|
||||
|
||||
/** The description of the first waypoint of the sub leg. */
|
||||
startDescription: string;
|
||||
}
|
||||
|
||||
/** Represents a route summary. */
|
||||
export interface IRouteSummary {
|
||||
/** The total travel distance of the route */
|
||||
distance: number;
|
||||
|
||||
/** The cost of the route. This property is only returned if the routeMode of the IDirectionsRequestOptions is set to transit and the map culture is set to ja-jp. */
|
||||
monetaryCost: number;
|
||||
|
||||
/** The location of the northeast corner of bounding box that defines the best map view of the route. */
|
||||
northEast: Location;
|
||||
|
||||
/** The location of the southwest corner of bounding box that defines the best map view of the route. */
|
||||
southWest: Location;
|
||||
|
||||
/** The total travel time, in seconds, for the route. */
|
||||
time: number;
|
||||
|
||||
/**
|
||||
* The total travel time, in seconds, taking into account traffic delays, for the route.
|
||||
* This property is 0 if the avoidTraffic property of the IDirectionsRequestOptions is set to false.
|
||||
*/
|
||||
timeWithTraffic: number;
|
||||
}
|
||||
|
||||
/** Contains information about a transit line. */
|
||||
export interface ITransitLine {
|
||||
/** The short name for the transit line. */
|
||||
abbreviatedName: string;
|
||||
|
||||
/** The ID of the agency that owns the transit line. */
|
||||
agencyId: number;
|
||||
|
||||
/** The name of the agency that owns the transit line. */
|
||||
agencyName: string;
|
||||
|
||||
/** The URL of the website of the agency that owns the transit line. */
|
||||
agencyUrl: string;
|
||||
|
||||
/** Phone number for the transit agency. */
|
||||
phoneNumber: string;
|
||||
|
||||
/** Information about the provider of this transit line data. */
|
||||
providerInfo: string;
|
||||
|
||||
/** The uri for the transit agencies website. */
|
||||
uri: string;
|
||||
|
||||
/** The full name of this transit line. */
|
||||
verboseName: string;
|
||||
}
|
||||
|
||||
/** Options that can be used to define a waypoint. */
|
||||
export interface IWaypointOptions {
|
||||
/**
|
||||
* The address string of the waypoint. For example, the following strings are valid for this parameter: "Seattle", "1 Microsoft Way, Redmond, WA". Either the address or location property must be specified.
|
||||
*/
|
||||
address?: string;
|
||||
|
||||
/**
|
||||
* A boolean indicating whether the waypoint is a via point. A via point is a point along the route that is not a stop point. Set this property to
|
||||
* true if you just want the route to pass through this location. Default: false
|
||||
*/
|
||||
isViaPoint?: boolean;
|
||||
|
||||
/** The location of the waypoint. Either the address or location property must be specified. */
|
||||
location?: Location;
|
||||
}
|
||||
|
||||
/** Contains options for the directions to calculate. */
|
||||
export interface IDirectionsRequestOptions {
|
||||
/** The unit to use when displaying direction distances. */
|
||||
distanceUnit?: DistanceUnit;
|
||||
|
||||
/** The number of routes to calculate. */
|
||||
maxRoutes?: number;
|
||||
|
||||
/** The features to avoid when calculating the route. */
|
||||
routeAvoidance?: RouteAvoidance[];
|
||||
|
||||
/** A boolean indicating whether the route line on the map can be dragged with the mouse cursor. */
|
||||
routeDraggable?: boolean;
|
||||
|
||||
/** If multiple routes are returned, the index of the route and directions to display. */
|
||||
routeIndex?: number;
|
||||
|
||||
/** The type of directions to calculate. */
|
||||
routeMode?: RouteMode;
|
||||
|
||||
/** The optimization setting for the route calculation. */
|
||||
routeOptimization?: RouteOptimization;
|
||||
|
||||
/** The type of the time specified. The default value is departure. */
|
||||
timeType?: TimeType;
|
||||
|
||||
/** The time to use when calculating the route. If this property is set to null, the current time is used */
|
||||
time?: Date;
|
||||
}
|
||||
|
||||
/** Represents render options for a route. */
|
||||
export interface IDirectionsRenderOptions {
|
||||
/** A boolean indicating whether to automatically set the map view to the best map view of the calculated route. Default: true */
|
||||
autoUpdateMapView?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display the disclaimer about the accuracy of the directions. Default: true */
|
||||
displayDisclaimer?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display the icons for each direction maneuver. Default: true */
|
||||
displayManeuverIcons?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display direction hints that describe when a direction step was missed. Default: true */
|
||||
displayPostItineraryItemHints?: boolean;
|
||||
|
||||
/**
|
||||
* A boolean indicating whether to display direction hints that describe what to look for before you come to the next
|
||||
* direction step. The default value is true.
|
||||
*/
|
||||
displayPreItineraryItemHints?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display the route selector control. Default: true */
|
||||
displayRouteSelector?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display direction warnings. Default: true */
|
||||
displayStepWarnings?: boolean;
|
||||
|
||||
/** A boolean indicating whether to display a warning about walking directions. Default: true */
|
||||
displayWalkingWarning?: boolean;
|
||||
|
||||
/** The polyline options that define how to draw the route line on the map, if the RouteMode is driving. */
|
||||
drivingPolylineOptions?: IPolylineOptions;
|
||||
|
||||
/** The pushpin options that define how the first waypoint should be rendered. */
|
||||
firstWaypointPushpinOptions?: IPushpinOptions;
|
||||
|
||||
/** The DOM element inside which the directions itinerary will be rendered. */
|
||||
itineraryContainer?: HTMLElement;
|
||||
|
||||
/** The pushpin options that define how the last waypoint should be rendered. */
|
||||
lastWaypointPushpinOptions?: IPushpinOptions;
|
||||
|
||||
/** A boolean indicating whether to show the input panel. Default: false */
|
||||
showInputPanel?: boolean;
|
||||
|
||||
/** The options that define how to draw the route line on the map, if the RouteMode is transit. */
|
||||
transitPolylineOptions?: IPolylineOptions;
|
||||
|
||||
/** The options that define how to draw the route line on the map, if the RouteMode is walking. */
|
||||
walkingPolylineOptions?: IPolylineOptions;
|
||||
|
||||
/** The options that define the pushpin to use for all route waypoints by default. The first and last waypoints in the route will be overriden by firstWaypointPushpinOptions and lastWaypointPushpinOptions if set. */
|
||||
waypointPushpinOptions?: IPushpinOptions;
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
/// Classes
|
||||
////////////////////////////////////
|
||||
|
||||
/** An object used to define a start, end or stop location along a route. */
|
||||
export class Waypoint {
|
||||
/**
|
||||
* @constructor
|
||||
* @param options: Options used to define the Waypoint.
|
||||
*/
|
||||
constructor(options: IWaypointOptions);
|
||||
|
||||
/** Releases any resources associated with the waypoint. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets the address associated with the waypoint.
|
||||
* @returns The address associated with the waypoint.
|
||||
*/
|
||||
public getAddress(): string;
|
||||
|
||||
/**
|
||||
* Gets the location of the waypoint.
|
||||
* @returns The location of the waypoint.
|
||||
*/
|
||||
public getLocation(): Location;
|
||||
|
||||
/**
|
||||
* Gets a boolean value indicating whether the waypoint is a via point.
|
||||
* @returns A boolean value indicating whether the waypoint is a via point.
|
||||
*/
|
||||
public isViapoint(): boolean;
|
||||
|
||||
/**
|
||||
* Sets options for the waypoint. For these options to take effect, you must recalculate the route.
|
||||
* @param options Options used to define the Waypoint.
|
||||
*/
|
||||
public setOptions(options: IWaypointOptions): void;
|
||||
}
|
||||
|
||||
/** The main class in the Directions module that process direction calculations and rendering. */
|
||||
export class DirectionsManager {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param map A map to calculate directions for.
|
||||
* @param waypoints An array of waypoints to be added to the route.
|
||||
*/
|
||||
constructor(map: Map, waypoints?: Waypoint[]);
|
||||
|
||||
/**
|
||||
* Adds a waypoint to the route at the given index, if specified. If an index is not specified, the waypoint is added as the last waypoint in the route. The maximum number of walking or driving waypoints is 25. The maximum number of transit waypoints is 2. Up to 10 via points are allowed between two stop waypoints. To recalculate the route, use calculateDirections.
|
||||
* @param waypoint The waypoint to be added to the directions manager.
|
||||
* @param index An index at which the waypoint is to be added.
|
||||
*/
|
||||
public addWaypoint(waypoint: Waypoint, index?: number): void;
|
||||
|
||||
/**
|
||||
* Calculates directions based on request and render options set
|
||||
*/
|
||||
public calculateDirections(): void;
|
||||
|
||||
/** Clears the directions request and render options and removes all waypoints */
|
||||
public clearAll(): void;
|
||||
|
||||
/**
|
||||
* Clears the directions displayed and removes the route line from the map.
|
||||
* This method does not remove waypoints from the route and retains all calculated direction information and option settings.
|
||||
*/
|
||||
public clearDisplay(): void;
|
||||
|
||||
/** Deletes the DirectionsManager object and releases any associated resources. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets all the waypoints in the directions manager.
|
||||
* @returns All the waypoints in the directions manager.
|
||||
*/
|
||||
public getAllWaypoints(): Waypoint[];
|
||||
|
||||
/**
|
||||
* Gets the currently displayed route information.
|
||||
* @returns The currently displayed route information.
|
||||
*/
|
||||
public getCurrentRoute(): IRoute;
|
||||
|
||||
/**
|
||||
* Gets the route render options.
|
||||
* @returns The route render options
|
||||
*/
|
||||
public getRenderOptions(): IDirectionsRenderOptions;
|
||||
|
||||
/**
|
||||
* Gets the directions request options.
|
||||
* @returns The directions request options.
|
||||
*/
|
||||
public getRequestOptions(): IDirectionsRequestOptions;
|
||||
|
||||
/**
|
||||
* Gets the current calculated route(s)
|
||||
* @returns The current calculated route(s). If the route was not successfully calculated, null is returned.
|
||||
*/
|
||||
public getRouteResult(): IRoute[];
|
||||
|
||||
/**
|
||||
* Removes the given waypoint or the waypoint identified by the given index from the route.
|
||||
* @param waypointOrIndex A Waypoint object to be removed or the index of the waypoint to be removed
|
||||
*/
|
||||
public removeWaypoint(waypointOrIndex: Waypoint | number): void;
|
||||
|
||||
/**
|
||||
* Sets the specified render options for the route.
|
||||
* @param options The options that customize the rendering of the calculated route.
|
||||
*/
|
||||
public setRenderOptions(options: IDirectionsRenderOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the specified route calculation options.
|
||||
* @param options The route calculation options.
|
||||
*/
|
||||
public setRequestOptions(options: IDirectionsRequestOptions): void;
|
||||
|
||||
/**
|
||||
* Displays an input panel for calculating directions in the specified container. Provides autosuggest for location inputs.
|
||||
* @param inputContainerId The id name of the HTML container in which to render the directions input panel.
|
||||
*/
|
||||
public showInputPanel(inputContainerId: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/** A static class that manages events within the map SDK. */
|
||||
module Events {
|
||||
/////////////////////////////////////
|
||||
/// addHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target. Use the return object to remove the handler using the removeHandler method.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* • directionsError
|
||||
* • directionsUpdated
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addHandler(target: Directions.DirectionsManager, eventName: string, handler: (eventArg?: Directions.IDirectionsEventArgs | Directions.IDirectionsErrorEventArgs) => void): IHandlerId;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addOne Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, but only triggers the handler the first once after being attached.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* • directionsError
|
||||
* • directionsUpdated
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
*/
|
||||
export function addOne(target: Directions.DirectionsManager, eventName: string, handler: (eventArg?: Directions.IDirectionsEventArgs | Directions.IDirectionsErrorEventArgs) => void): void;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addThrottledHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, where the minimum interval between events (in milliseconds) is specified as a parameter.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* • directionsError
|
||||
* • directionsUpdated
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @param throttleInterval throttle interval (in ms)
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addThrottledHandler(target: Directions.DirectionsManager, eventName: string, handler: (eventArg?: Directions.IDirectionsEventArgs | Directions.IDirectionsErrorEventArgs) => void, throttleInterval: number): IHandlerId;
|
||||
}
|
||||
}
|
||||
Vendored
+241
@@ -0,0 +1,241 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/** An object that contains the event arguments for when the drawing mode changes in the drawing tools. **/
|
||||
export interface IDrawingModeChangedData {
|
||||
|
||||
/** The shape being modified by the drawing tools. **/
|
||||
shape: IPrimitive;
|
||||
|
||||
/** The new drawing mode. **/
|
||||
mode: DrawingTools.DrawingMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* The DrawingManager class manages the ability to draw and edit multiple shapes on the map. Shapes managed by this class are rendered on a separate drawing layer.
|
||||
* User can use a mouse or a touch screen to draw on the map. When they are done, pressing the escape button or any button on the toolbar will exit the current drawing mode.
|
||||
* This class does not have a publicly accessible constructor and can only be accessed using the showDrawingManager of the DrawingTools class.
|
||||
*/
|
||||
export interface DrawingManager {
|
||||
/**
|
||||
* Adds a shapes to the layer, at the specified index if specified.
|
||||
• @param data The shape(s) to be added to the layer.
|
||||
• @param index The index at which to insert the shape into the layer.
|
||||
*/
|
||||
add(data: IPrimitive | IPrimitive[], index?: number): void;
|
||||
|
||||
/**
|
||||
* Disposes the drawing manager instance.
|
||||
*/
|
||||
dispose(): void;
|
||||
|
||||
/**
|
||||
* Resets the drawing manager and clears all shapes in the drawing layer.
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
* Gets the current drawing mode of the drawing manager.
|
||||
* @returns The current drawing mode of the drawing manager.
|
||||
*/
|
||||
getDrawingMode(): DrawingTools.DrawingMode;
|
||||
|
||||
/**
|
||||
* Gets an array of shapes that are in the layer. This can be used to iterate over the individual shapes.
|
||||
* @returns An array of shapes that are in the layer. This can be used to iterate over the individual shapes.
|
||||
*/
|
||||
getPrimitives(): IPrimitive[];
|
||||
|
||||
/**
|
||||
* Returns the index of the shape in the drawing layer.
|
||||
* @param primitive The shape to find the index of.
|
||||
* @param fromIndex The index to start the search from.
|
||||
* @returns The index of the shape in the drawing layer. Returns -1 if shape is not found.
|
||||
*/
|
||||
indexOf(primitive: IPrimitive, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Removes a shape from the layer and returns it.
|
||||
* @param primitive The shape to remove from the layer.
|
||||
* @returns The shape that was removed from the layer.
|
||||
*/
|
||||
remove(primitive: IPrimitive): IPrimitive;
|
||||
|
||||
/**
|
||||
* Removes a shape from the layer at the specified index.
|
||||
* @param index The index of the shape to remove from the layer.
|
||||
* @returns The shape that was removed from the layer.
|
||||
*/
|
||||
removeAt(index: number): IPrimitive;
|
||||
|
||||
/**
|
||||
* Sets the drawing mode of the drawing manager.
|
||||
* @param mode The drawing mode to set the DrawingManager to.
|
||||
*/
|
||||
setDrawingMode(mode: DrawingTools.DrawingMode): void;
|
||||
|
||||
/**
|
||||
* Replaces all shapes in the layer with the new array of shapes that have been provided.
|
||||
* @param primitives An array of shapes to add to the drawing layer.
|
||||
*/
|
||||
setPrimitives(primitives: IPrimitive[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a set of tools for drawing and editing shapes on top of the map.
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
*/
|
||||
export class DrawingTools {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
* @param map A map instanct to attach the drawing tools to.
|
||||
*/
|
||||
constructor(map: Map);
|
||||
|
||||
/**
|
||||
* Initializes the drawing layer and instructs it to create a new shape of a given type.
|
||||
* @param shapeType The type of new shape to create.
|
||||
* @param created A callback function that is fired after the initial shape is created.
|
||||
*/
|
||||
public create(shapeType: DrawingTools.ShapeType, created?: (shape: IPrimitive) => void): void;
|
||||
|
||||
/** Disposes the instance of the DrawingTools class. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Adds a shape to the drawing layer and puts it into edit mode.
|
||||
* @param shape A shape to put into editting mode.
|
||||
*/
|
||||
public edit(shape: IPrimitive): void;
|
||||
|
||||
/**
|
||||
* Finishes any shape create / edit operation currently in progress, and returns the shape that was created or editted through a specified callback function.
|
||||
* @param finished A callback function to return the completed shape with.
|
||||
*/
|
||||
public finish(finished?: (shape: IPrimitive) => void): void;
|
||||
|
||||
/**
|
||||
* Creates a drawing manager which allows multi-shape editing and displays the toolbar.
|
||||
* @param callback A callback function that is triggered after the DrawingTools have loaded.
|
||||
*/
|
||||
public showDrawingManager(callback?: (manager: DrawingManager) => void): void;
|
||||
}
|
||||
|
||||
export module Events {
|
||||
/////////////////////////////////////
|
||||
/// addHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target. Use the return object to remove the handler using the removeHandler method.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* drawingChanged, drawingChanging, drawingEnded, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addHandler(target: DrawingTools, eventName: string, handler: (eventArg?: IPrimitive | IDrawingModeChangedData) => void): IHandlerId;
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target. Use the return object to remove the handler using the removeHandler method.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* disposed, drawingChanged, drawingChanging, drawingEnded, drawingErased, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addHandler(target: DrawingManager, eventName: string, handler: (eventArg?: IPrimitive | DrawingTools.DrawingMode) => void): IHandlerId;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addOne Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, but only triggers the handler the first once after being attached.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* drawingChanged, drawingChanging, drawingEnded, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
*/
|
||||
export function addOne(target: DrawingTools, eventName: string, handler: (eventArg?: IPrimitive | IDrawingModeChangedData) => void): void;
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, but only triggers the handler the first once after being attached.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* disposed, drawingChanged, drawingChanging, drawingEnded, drawingErased, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
*/
|
||||
export function addOne(target: DrawingManager, eventName: string, handler: (eventArg?: IPrimitive | DrawingTools.DrawingMode) => void): void;
|
||||
|
||||
/////////////////////////////////////
|
||||
/// addThrottledHandler Definitions
|
||||
////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, where the minimum interval between events (in milliseconds) is specified as a parameter.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* drawingChanged, drawingChanging, drawingEnded, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addThrottledHandler(target: DrawingTools, eventName: string, handler: (eventArg?: IPrimitive | IDrawingModeChangedData) => void): IHandlerId;
|
||||
|
||||
/**
|
||||
* Attaches the handler for the event that is thrown by the target, where the minimum interval between events (in milliseconds) is specified as a parameter.
|
||||
* @param target The object to attach the event to; Map, IPrimitive, Infobox, Layer, DrawingTools, DrawingManager, DirectionsManager, etc.
|
||||
* @param eventName The type of event to attach. Supported Events:
|
||||
* disposed, drawingChanged, drawingChanging, drawingEnded, drawingErased, drawingModeChanged, drawingStarted
|
||||
* @param handler The callback function to handle the event when triggered.
|
||||
* @param throttleInterval throttle interval (in ms)
|
||||
* @returns The handler id.
|
||||
*/
|
||||
export function addThrottledHandler(target: DrawingManager, eventName: string, handler: (eventArg?: IPrimitive | DrawingTools.DrawingMode) => void, throttleInterval: number): IHandlerId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module Microsoft.Maps.DrawingTools {
|
||||
/**
|
||||
* The different drawing modes that the drawing manager can be set to.
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
*/
|
||||
export enum DrawingMode {
|
||||
/** Edit an existing shape. Click on a shape to edit it. */
|
||||
edit,
|
||||
|
||||
/** Erase and existing shape. Click on the shapes to erase them. */
|
||||
erase,
|
||||
|
||||
/** Sets the drawing manager into an idle mode. */
|
||||
none,
|
||||
|
||||
/** Allow the user to draw a polygon. */
|
||||
polygon,
|
||||
|
||||
/** Allow the user to draw a polyline. */
|
||||
polyline,
|
||||
|
||||
/** Allow the user to draw a pushpin. */
|
||||
pushpin
|
||||
}
|
||||
|
||||
/**
|
||||
* The different types of shapes that are created or edited by the drawing tools.
|
||||
* @requires The Microsoft.Maps.DrawingTools module.
|
||||
*/
|
||||
export enum ShapeType {
|
||||
/** A polygon shape type. */
|
||||
polygon,
|
||||
|
||||
/** A polyline shape type. */
|
||||
polyline
|
||||
}
|
||||
}
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
|
||||
/** GeoJSON object definition */
|
||||
export interface IGeoJsonObject {
|
||||
/**
|
||||
* Type of the object
|
||||
* could be one of the following:
|
||||
* Point
|
||||
* LineString
|
||||
* Polygon
|
||||
* MultiPoint
|
||||
* MultiLineString
|
||||
* MultiPolygon
|
||||
* GeometryCollection
|
||||
* Feature
|
||||
* FeatureCollection
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/** Geometric coordinates of the object */
|
||||
coordinates?: number[] | number[][] | number[][][] | number[][][][];
|
||||
|
||||
/** Additional properties of the object as a key,value pair */
|
||||
properties?: any;
|
||||
|
||||
/** Set of features (only applicable if the type is 'featurecollection') */
|
||||
features?: IGeoJsonObject[];
|
||||
|
||||
/** Set of geometries (only applicable if the type is 'geometrycollection') */
|
||||
geometries?: IGeoJsonObject[];
|
||||
|
||||
/** Geometry (only applicable if the type is 'feature') */
|
||||
geometry?: IGeoJsonObject;
|
||||
|
||||
/** identifier of a feature (only applicable if the type is 'feature') */
|
||||
id?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class responsible for reading/writing geo data in GeoJson format
|
||||
* @requires The Microsoft.Maps.GeoJson module.
|
||||
*/
|
||||
export module GeoJson {
|
||||
/**
|
||||
* Reads the data from a given url and returns the shapes.
|
||||
* @param url GeoJson download url.
|
||||
* @param callback Callback function that needs to be called once the data is downloaded and parsed.
|
||||
* @param jsonpQueryParam The name of the url query param to make a jsonp request.
|
||||
* @param styles Styles that needs to be applied.
|
||||
*/
|
||||
export function readFromUrl(url: string, callback: (data: IPrimitive | IPrimitive[]) => void, jsonpQueryParam?: string, styles?: IStylesOptions): void;
|
||||
|
||||
/**
|
||||
* Reads the data in geoJson format and returns the shapes.
|
||||
* @param geoJson GeoJson data object that needs to be parsed into shapes.
|
||||
* @param styles Styles that needs to be applied.
|
||||
* @returns An array of shapes.
|
||||
*/
|
||||
export function read(geoJson: IGeoJsonObject | string, styles?: IStylesOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Writes the data into geoJson format.
|
||||
* @param data Data that needs to be serialized.
|
||||
* @returns A geoJson formatted string.
|
||||
*/
|
||||
export function write(data: IPrimitive | IPrimitive[]): IGeoJsonObject;
|
||||
}
|
||||
}
|
||||
Vendored
+113
@@ -0,0 +1,113 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/** A standard dictionary object (associative array). */
|
||||
export interface IDictionary<T> {
|
||||
[K: string]: T;
|
||||
}
|
||||
|
||||
/** Options for customizing how the heat map is rendered. */
|
||||
export interface IHeatMapLayerOptions {
|
||||
/**
|
||||
* The temperature gradient that is used to colorize the map. Default gradient:
|
||||
* {
|
||||
* '0.00': 'rgb(255,0,255)', // Magenta
|
||||
* '0.25': 'rgb(0,0,255)', // Blue
|
||||
* '0.50': 'rgb(0,255,0)', // Green
|
||||
* '0.75': 'rgb(255,255,0)', // Yellow
|
||||
* '1.00': 'rgb(255,0,0)' // Red
|
||||
* }
|
||||
*/
|
||||
colorGradient?: IDictionary<string>;
|
||||
|
||||
/**
|
||||
* The intensity of each heat point. This is a decimal value between 0 and 1. This is used to specify how "hot" a single data point should be. Default: 0.5
|
||||
*/
|
||||
intensity?: number;
|
||||
|
||||
/**
|
||||
* The opacity of the HeatMapLayer canvas. Value should be a decimal between 0 and 1. Default: 1
|
||||
*/
|
||||
opacity?: number;
|
||||
|
||||
/**
|
||||
* The radius to draw each data point on the map. Default: 10
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/**
|
||||
* The distance units of the radius. Possible values are:
|
||||
*
|
||||
* • 'pixels' (defualt)
|
||||
* • 'meters'
|
||||
*
|
||||
* When set to pixels the size of each data point will always be the same radius, regardless of zoom level. When set to meters, the size of the data points
|
||||
* will scale based on zoom level so as to ensure that the radius is spatially accurate.
|
||||
*/
|
||||
unit?: 'meters' | 'pixel';
|
||||
|
||||
/** A boolean indicating if the heat map layer is visible or not. **/
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for rendering data as a heat map layer.
|
||||
* @requires The Microsoft.Maps.Heatmap module.
|
||||
*/
|
||||
export class HeatMapLayer implements IDataLayer {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Heatmap module.
|
||||
* @param locations Set of locations to visualize as a heat map.
|
||||
* @param options Options for customizing how the heat map is rendered.
|
||||
*/
|
||||
constructor(locations: (Location | Pushpin)[], options?: IHeatMapLayerOptions);
|
||||
|
||||
/** Clears all data in the heat map layer. */
|
||||
public clear(): void;
|
||||
|
||||
/** Disposes the heat map layer. */
|
||||
public dispose(): void;
|
||||
|
||||
/**
|
||||
* Gets a boolean indicating if the heat map layer is visible or not.
|
||||
* @returns A boolean indicating if the heat map layer is visible or not.
|
||||
*/
|
||||
public getVisible(): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Hides the heat map layer.
|
||||
*/
|
||||
public hide(): void;
|
||||
|
||||
/**
|
||||
* Specifies the locations to use when generating the heat map.
|
||||
* @param locations Set of locations.
|
||||
*/
|
||||
public setLocations(locations: (Location | Pushpin)[]): void;
|
||||
|
||||
/**
|
||||
* Sets the options to use with the heat map layer.
|
||||
* @param options Set of heat map layer options.
|
||||
*/
|
||||
public setOptions(options: IHeatMapLayerOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the visibility of the heat map layer.
|
||||
* @param visible A boolean indicating if the heat map layer is visible or not.
|
||||
*/
|
||||
public setVisible(visible: boolean): void;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Shows the heat map layer.
|
||||
*/
|
||||
public show(): void;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// Type definitions for Microsoft.Maps.AdvancedShapes 7.0
|
||||
// Project: http://msdn.microsoft.com/en-us/library/hh921952.aspx
|
||||
// Definitions by: Eric Todd <https://github.com/ericrtodd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Microsoft.Maps.AdvancedShapes {
|
||||
|
||||
export class EntityCollection {
|
||||
|
||||
constructor(options?: EntityCollectionOptions);
|
||||
|
||||
clear(): void;
|
||||
get(index: number): Entity;
|
||||
getLength(): number;
|
||||
getVisible(): boolean;
|
||||
getZIndex(): number;
|
||||
indexOf(entity: Entity): number;
|
||||
insert(entity: Entity, index: number): void;
|
||||
pop(): Entity;
|
||||
push(entity: Entity): void;
|
||||
remove(entity: Entity): Entity;
|
||||
removeAt(index: number): Entity;
|
||||
setOptions(options: EntityCollectionOptions): void;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export class Polygon implements Entity {
|
||||
|
||||
constructor(locations: Array<Location>, options?: PolygonOptions);
|
||||
|
||||
getFillColor(): Color;
|
||||
getLocations(): Array<Location>;
|
||||
getStrokeColor(): Color;
|
||||
getStrokeDashArray(): string;
|
||||
getStrokeThickness(): number;
|
||||
getVisible(): boolean;
|
||||
setLocations(locations: Location[]): void;
|
||||
setOptions(options: PolylineOptions): void;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
}
|
||||
-434
@@ -1,434 +0,0 @@
|
||||
// Type definitions for Microsoft.Maps.Directions 7.0
|
||||
// Project: http://msdn.microsoft.com/en-us/library/hh312813.aspx
|
||||
// Definitions by: Eric Todd <https://github.com/ericrtodd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Microsoft.Maps.Directions {
|
||||
|
||||
export interface BusinessDetails {
|
||||
|
||||
businessName?: string;
|
||||
entityId?: string;
|
||||
phoneNumber?: string;
|
||||
website?: string;
|
||||
}
|
||||
|
||||
export interface WaypointOptions {
|
||||
|
||||
address?: string;
|
||||
businessDetails?: BusinessDetails;
|
||||
disambiguationContainer?: HTMLElement;
|
||||
exactLocation?: string;
|
||||
isViapoint?: boolean;
|
||||
location?: Location;
|
||||
pushpin?: Pushpin;
|
||||
shortAddress?: string;
|
||||
}
|
||||
|
||||
export interface BusinessDisambiguationSuggestion {
|
||||
|
||||
address?: string;
|
||||
distance?: number;
|
||||
entityId?: number;
|
||||
index?: number;
|
||||
isApproximate?: boolean;
|
||||
location?: Location;
|
||||
name?: string;
|
||||
phoneNumber?: string;
|
||||
photoUrl?: string;
|
||||
rooftopLocation?: Location;
|
||||
website?: string;
|
||||
}
|
||||
|
||||
export interface LocationDisambiguationSuggestion {
|
||||
|
||||
formattedSuggestion?: string;
|
||||
location?: Location;
|
||||
rooftopLocation?: Location;
|
||||
suggestion?: string;
|
||||
}
|
||||
|
||||
export interface Disambiguation {
|
||||
|
||||
businessSuggestions?: Array<BusinessDisambiguationSuggestion>;
|
||||
hasMoreSuggestions?: boolean;
|
||||
headerText?: string;
|
||||
locationSuggestions?: Array<LocationDisambiguationSuggestion>;
|
||||
}
|
||||
|
||||
export interface WaypointEventArgs {
|
||||
|
||||
waypoint: Waypoint;
|
||||
}
|
||||
|
||||
export class Waypoint {
|
||||
|
||||
constructor(options: WaypointOptions);
|
||||
|
||||
clear(): void;
|
||||
dispose(): void;
|
||||
getAddress(): string;
|
||||
getBusinessDetails(): BusinessDetails;
|
||||
getDisambiguationContainer(): HTMLElement;
|
||||
getDisambiguationResult(): Disambiguation;
|
||||
getLocation(): Location;
|
||||
getPushpin(): Pushpin;
|
||||
getShortAddress(): string;
|
||||
isExactLocation(): boolean;
|
||||
isViapoint(): boolean;
|
||||
setOptions(options: WaypointOptions): void;
|
||||
}
|
||||
|
||||
export interface DirectionsRenderOptions {
|
||||
|
||||
autoDisplayDisambiguation?: boolean;
|
||||
autoUpdateMapView?: boolean;
|
||||
disambiguationPushpinOptions?: PushpinOptions;
|
||||
displayDisclaimer?: boolean;
|
||||
displayManeuverIcons?: boolean;
|
||||
displayPostItineraryItemHints?: boolean;
|
||||
displayPreItineraryItemHints?: boolean;
|
||||
displayRouteSelector?: boolean;
|
||||
displayStepWarnings?: boolean;
|
||||
displayTrafficAvoidanceOption?: boolean;
|
||||
displayWalkingWarning?: boolean;
|
||||
drivingPolylineOptions?: PolylineOptions;
|
||||
itineraryContainer?: HTMLElement;
|
||||
lastWaypointIcon?: string;
|
||||
middleWaypointIcon?: string;
|
||||
stepPushpinOptions?: PushpinOptions;
|
||||
transitPolylineOptions?: PolylineOptions;
|
||||
viapointPushpinsOptions?: PushpinOptions;
|
||||
walkingPolylineOptions?: PolylineOptions;
|
||||
waypointPushpinOptions?: PushpinOptions;
|
||||
}
|
||||
|
||||
export enum DistanceUnit {
|
||||
kilometers= 0,
|
||||
miles= 1
|
||||
}
|
||||
|
||||
export enum RouteAvoidance {
|
||||
none= 0,
|
||||
minimizeLimitedAccessHighway= 1,
|
||||
minimizeToll= 2,
|
||||
avoidLimitedAccessHighway= 4,
|
||||
avoidToll= 8,
|
||||
avoidExpressTrain= 16,
|
||||
avoidAirline= 32,
|
||||
avoidBulletTrain= 64
|
||||
}
|
||||
|
||||
export enum RouteMode {
|
||||
driving,
|
||||
transit,
|
||||
walking
|
||||
}
|
||||
|
||||
export enum RouteOptimization {
|
||||
shortestTime= 0,
|
||||
shortestDistance= 1,
|
||||
minimizeMoney= 3,
|
||||
minimizeTransfers= 4,
|
||||
minimizeWalking= 5
|
||||
}
|
||||
|
||||
export enum TimeType {
|
||||
arrival,
|
||||
departure,
|
||||
lastAvailable
|
||||
}
|
||||
|
||||
export interface TransitOptions {
|
||||
timeType?: TimeType;
|
||||
transitTime?: Date;
|
||||
}
|
||||
|
||||
export interface DirectionsRequestOptions {
|
||||
|
||||
avoidTraffic?: boolean;
|
||||
distanceUnit?: DistanceUnit;
|
||||
maxRoutes?: number;
|
||||
routeAvoidance?: Array<RouteAvoidance>;
|
||||
routeDraggable?: boolean;
|
||||
routeIndex?: boolean;
|
||||
routeMode?: RouteMode;
|
||||
routeOptimization?: RouteOptimization;
|
||||
transitOptions?: TransitOptions;
|
||||
}
|
||||
|
||||
export class DirectionsManager {
|
||||
|
||||
constructor(map: Microsoft.Maps.Map);
|
||||
|
||||
resetDirections(): void;
|
||||
addWaypoint(waypoint: Waypoint, index?: number): void;
|
||||
calculateDirections(): void;
|
||||
clearDisplay(): void;
|
||||
dispose(): void;
|
||||
getAllWaypoints(): Array<Waypoint>;
|
||||
getMap(): Map;
|
||||
getNearbyMajorRoads(location: Location, callback: any, errorCallback: any, userData: any): void;
|
||||
getRenderOptions(): DirectionsRenderOptions;
|
||||
getRequestOptions(): DirectionsRequestOptions;
|
||||
getRouteResult(): Array<Route>;
|
||||
removeWaypoint(waypoint: Waypoint): void;
|
||||
removeWaypoint(index: number): void;
|
||||
resetDirections(options: ResetDirectionsOptions): void;
|
||||
reverseGeocode(location: Location, callback: any, errorCallback: any, userData: any): void;
|
||||
setMapView(): void;
|
||||
setRenderOptions(options: DirectionsRenderOptions): void;
|
||||
setRequestOptions(options: DirectionsRequestOptions): void;
|
||||
}
|
||||
|
||||
export interface DirectionsStepEventArgs {
|
||||
handled: boolean;
|
||||
location: Location;
|
||||
routeIndex: number;
|
||||
routeLegIndex: number;
|
||||
step: DirectionsStep;
|
||||
stepIndex: number;
|
||||
stepNumber: number;
|
||||
}
|
||||
|
||||
export interface DirectionsErrorEventArgs {
|
||||
responseCode: RouteResponseCode;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface DirectionsEventArgs {
|
||||
routeSummary: Array<RouteSummary>;
|
||||
route: Array<Route>;
|
||||
}
|
||||
|
||||
export interface DisambiguationRenderEventArgs {
|
||||
containerElement: HTMLElement;
|
||||
handled: boolean;
|
||||
waypoint: Waypoint;
|
||||
}
|
||||
|
||||
export interface DirectionsStepRenderEventArgs {
|
||||
containerElement: HTMLElement;
|
||||
handled: boolean;
|
||||
lastStep: boolean;
|
||||
routeIndex: number;
|
||||
routeLegIndex: number;
|
||||
step: DirectionsStep;
|
||||
stepIndex: number;
|
||||
}
|
||||
|
||||
export interface RouteSummaryRenderEventArgs {
|
||||
containerElement: HTMLElement;
|
||||
handled: boolean;
|
||||
routeLegIndex: number;
|
||||
summary: RouteSummary;
|
||||
}
|
||||
|
||||
export interface WaypointRenderEventArgs {
|
||||
containerElement: HTMLElement;
|
||||
handled: boolean;
|
||||
waypoint: Waypoint;
|
||||
}
|
||||
|
||||
export interface DirectionsStep {
|
||||
|
||||
childItineraryItems: Array<DirectionsStep>;
|
||||
coordinate: Location;
|
||||
distance: string;
|
||||
durationInSeconds: number;
|
||||
formattedText: string;
|
||||
iconType: IconType;
|
||||
isImageRoadShield: boolean;
|
||||
maneuver: Maneuver;
|
||||
maneuverImageName: string;
|
||||
monetaryCost: number;
|
||||
postIntersectionHints: Array<string>;
|
||||
preIntersectionHings: Array<string>;
|
||||
startStopName: string;
|
||||
transitLine: TransitLine;
|
||||
transitStepIcon: string;
|
||||
transitStopId: string;
|
||||
transitTerminus: string;
|
||||
warnings: Array<DirectionsStepWarning>;
|
||||
}
|
||||
|
||||
export enum IconType {
|
||||
none,
|
||||
other,
|
||||
auto,
|
||||
ferry,
|
||||
walk,
|
||||
bus,
|
||||
train,
|
||||
airline
|
||||
}
|
||||
|
||||
export enum Maneuver {
|
||||
none= 0,
|
||||
unknown= 1,
|
||||
departStart= 2,
|
||||
departIntermediateStop= 3,
|
||||
departIntermediateStopReturning= 4,
|
||||
arriveFinish= 5,
|
||||
arriveIntermediateStop= 6,
|
||||
turnLeft= 7,
|
||||
turnRight= 8,
|
||||
turnBack= 9,
|
||||
uTurn= 10,
|
||||
turnToStayLeft= 11,
|
||||
turnToStayRight= 12,
|
||||
bearLeft= 13,
|
||||
bearRight= 14,
|
||||
keepToStayLeft= 15,
|
||||
keepToStayRight= 16,
|
||||
keepToStayStraight= 17,
|
||||
keepLeft= 18,
|
||||
keepRight= 19,
|
||||
keepStraight= 20,
|
||||
take= 21,
|
||||
takeRampLeft= 22,
|
||||
takeRampRight= 23,
|
||||
takeRampStraight= 24,
|
||||
keepOnRampLeft= 25,
|
||||
keepOnRampRight= 26,
|
||||
keepOnRampStraight= 27,
|
||||
merge= 28,
|
||||
continueRoute= 29,
|
||||
roadNameChange= 30,
|
||||
enterRoundabout= 31,
|
||||
exitRoundabout= 32,
|
||||
turnRightThenTurnRight= 33,
|
||||
turnRightThenTurnLeft= 34,
|
||||
turnRightThenBearRight= 35,
|
||||
turnRightThenBearLeft= 36,
|
||||
turnLeftThenTurnLeft= 37,
|
||||
turnLeftThenTurnRight= 38,
|
||||
turnLeftThenBearLeft= 39,
|
||||
turnLeftThenBearRight= 40,
|
||||
bearRightThenTurnRight= 41,
|
||||
bearRightThenTurnLeft= 42,
|
||||
bearRightThenBearRight= 43,
|
||||
bearRightThenBearLeft= 44,
|
||||
bearLeftThenTurnLeft= 45,
|
||||
bearLeftThenTurnRight= 46,
|
||||
bearLeftThenBearRight= 47,
|
||||
bearLeftThenBearLeft= 48,
|
||||
rampThenHighwayRight= 49,
|
||||
rampThenHighwayLeft= 50,
|
||||
rampToHighwayStraight= 51,
|
||||
enterThenExitRoundabout= 52,
|
||||
bearThenMerge= 53,
|
||||
turnThenMerge= 54,
|
||||
bearThenKeep= 55,
|
||||
transfer= 56,
|
||||
wait = 57,
|
||||
takeTransit= 58,
|
||||
walk = 59,
|
||||
transitDepart = 60,
|
||||
transitArrive= 61,
|
||||
}
|
||||
|
||||
export interface TransitLine {
|
||||
abbreviatedName: string;
|
||||
agencyId: number;
|
||||
agencyName: string;
|
||||
agencyUrl: string;
|
||||
lineColor: Color;
|
||||
lineTextColor: Color;
|
||||
providerInfo: string;
|
||||
verboseName: string;
|
||||
}
|
||||
|
||||
export interface DirectionsStepWarning {
|
||||
style: StepWarningStyle;
|
||||
text: string;
|
||||
}
|
||||
|
||||
export enum StepWarningStyle {
|
||||
info= 0,
|
||||
minor= 1,
|
||||
moderate= 2,
|
||||
major= 3,
|
||||
ccZoneEnter= 4,
|
||||
ccZoneExit= 5
|
||||
}
|
||||
|
||||
export interface ResetDirectionsOptions {
|
||||
removeAllWaypoints?: boolean;
|
||||
resetRenderOptions?: boolean;
|
||||
resetRequestOptions?: boolean;
|
||||
}
|
||||
|
||||
export interface Route {
|
||||
routeLegs: Array<RouteLeg>;
|
||||
}
|
||||
|
||||
export interface RouteLeg {
|
||||
endTime: Date;
|
||||
endWaypointLocation: Location;
|
||||
itineraryItems: Array<DirectionsStep>;
|
||||
originalRouteIndex: number;
|
||||
startTime: Date;
|
||||
startWaypointLocation: Location;
|
||||
subLegs: Array<RouteSubLeg>;
|
||||
summary: RouteSummary;
|
||||
}
|
||||
|
||||
export interface RouteSubLeg {
|
||||
actualEnd: Location;
|
||||
actualStart: Location;
|
||||
endDescription: string;
|
||||
routePath: RoutePath;
|
||||
startDescription: string;
|
||||
summary: RouteSummary;
|
||||
}
|
||||
|
||||
export interface RoutePath {
|
||||
decodedLatitudes: Array<number>;
|
||||
decodedLongitudes: Array<number>;
|
||||
decodedRegions: Array<any>;
|
||||
}
|
||||
|
||||
export interface RouteSummary {
|
||||
distance: number;
|
||||
monetaryCost: number;
|
||||
northEast: Location;
|
||||
southWest: Location;
|
||||
time: number;
|
||||
timeWithTraffic: number;
|
||||
}
|
||||
|
||||
export enum RouteResponseCode {
|
||||
success= 0,
|
||||
unknownError= 1,
|
||||
cannotFindNearbyRoad= 2,
|
||||
tooFar= 3,
|
||||
noSolution= 4,
|
||||
dataSourceNotFound= 5,
|
||||
noAvailableTransitTrip= 7,
|
||||
transitStopsTooClose= 8,
|
||||
walkingBestAlternative= 9,
|
||||
outOfTransitBounds= 10,
|
||||
timeout= 11,
|
||||
waypointDisambiguation= 12,
|
||||
hasEmptyWaypoint= 13,
|
||||
exceedMaxWaypointLimit= 14,
|
||||
atleastTwoWaypointRequired= 15,
|
||||
firstOrLastStoppointsIsVia= 16,
|
||||
searchServiceFailed= 17,
|
||||
invalidCredentials= 18
|
||||
}
|
||||
|
||||
export interface RouteSelectorEventArgs {
|
||||
handled: boolean;
|
||||
routeIndex: number;
|
||||
}
|
||||
|
||||
export interface RouteSelectorRenderEventArgs {
|
||||
containerElement: HTMLElement;
|
||||
handled: boolean;
|
||||
routeIndex: number;
|
||||
routeLeg: RouteLeg;
|
||||
}
|
||||
|
||||
}
|
||||
-150
@@ -1,150 +0,0 @@
|
||||
// Type definitions for Microsoft.Maps.Search 7.0
|
||||
// Project: http://msdn.microsoft.com/en-us/library/hh868061.aspx
|
||||
// Definitions by: Eric Todd <https://github.com/ericrtodd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Microsoft.Maps.Search {
|
||||
|
||||
export interface Address {
|
||||
addressLine: string;
|
||||
adminDistrict: string;
|
||||
countryRegion: string;
|
||||
district: string;
|
||||
formattedAddress: string;
|
||||
locality: string;
|
||||
postalCode: string;
|
||||
postalTown:string;
|
||||
}
|
||||
|
||||
export interface GeocodeLocation {
|
||||
location: Location;
|
||||
name: string;
|
||||
precision:LocationPrecision;
|
||||
}
|
||||
|
||||
export interface GeocodeRequestOptions {
|
||||
bounds?: LocationRect;
|
||||
callback?: (result: GeocodeResult, userData: any) => any;
|
||||
count: number;
|
||||
errorCallback?: (options: GeocodeRequestOptions) => any;
|
||||
timeout?: number;
|
||||
userData?: any;
|
||||
where:string;
|
||||
}
|
||||
|
||||
export interface GeocodeResult {
|
||||
parsedAddress: Address;
|
||||
parsedKeyword: string;
|
||||
parsedSeparator: string;
|
||||
results:Array<PlaceResult>;
|
||||
}
|
||||
|
||||
export enum LocationPrecision {
|
||||
interpolated,
|
||||
rooftop,
|
||||
}
|
||||
|
||||
export enum MatchCode {
|
||||
none,
|
||||
good,
|
||||
ambiguous,
|
||||
upHierarchy,
|
||||
modified,
|
||||
}
|
||||
|
||||
export enum MatchConfidence {
|
||||
high,
|
||||
medium,
|
||||
low,
|
||||
unknown,
|
||||
}
|
||||
|
||||
export interface PlaceResult {
|
||||
bestView: LocationRect;
|
||||
location: GeocodeLocation;
|
||||
locations: Array<GeocodeLocation>;
|
||||
matchCode: MatchCode;
|
||||
matchConfidence: MatchConfidence;
|
||||
name:string;
|
||||
}
|
||||
|
||||
export interface ReverseGeocodeRequestOptions {
|
||||
callback?: (result: PlaceResult, userData: any) => any;
|
||||
errorCallback?: (options: ReverseGeocodeRequestOptions) => any;
|
||||
location?: Location;
|
||||
timeout?: number;
|
||||
userData?:any;
|
||||
}
|
||||
|
||||
export class SearchManager {
|
||||
|
||||
constructor(map: Map);
|
||||
|
||||
geocode(request: GeocodeRequestOptions): void;
|
||||
reverseGeocode(request: ReverseGeocodeRequestOptions): void;
|
||||
search(request:SearchRequestOptions):void;
|
||||
}
|
||||
|
||||
export interface SearchParseResult {
|
||||
keyword: string;
|
||||
location: GeocodeLocation;
|
||||
matchConfidence:MatchConfidence;
|
||||
}
|
||||
|
||||
export interface SearchRegion {
|
||||
address: Address;
|
||||
geocodeLocations: Array<GeocodeLocation>;
|
||||
explicitLocation: GeocodeLocation;
|
||||
mapBounds: LocationRect;
|
||||
matchCode: MatchCode;
|
||||
matchConfidence: MatchConfidence;
|
||||
source:string;
|
||||
}
|
||||
|
||||
export interface SearchRequestOptions {
|
||||
callback?:(result: SearchResponse, userData: any)=>any;
|
||||
count: number;
|
||||
errorCallback?:(options: SearchRequestOptions)=>any;
|
||||
query?: string;
|
||||
startIndex?: number;
|
||||
timeout?: number;
|
||||
entityType?: string;
|
||||
userData?: any;
|
||||
what?: string;
|
||||
where?:string;
|
||||
}
|
||||
|
||||
export interface SearchResponse {
|
||||
alternateSearchRegions: Array<SearchRegion>;
|
||||
hasMore: boolean;
|
||||
parseResults: Array<SearchParseResult>;
|
||||
responseSummary: SearchResponseSummary;
|
||||
searchRegion: SearchRegion;
|
||||
searchResults:Array<SearchResult>;
|
||||
}
|
||||
|
||||
export interface SearchResponseSummary {
|
||||
authResultCode: number;
|
||||
copyright: string;
|
||||
errorMessage: string;
|
||||
statusCode: number;
|
||||
traceId:number;
|
||||
}
|
||||
|
||||
export interface SearchResult {
|
||||
address: Address;
|
||||
city: string;
|
||||
country: string;
|
||||
entityType: string;
|
||||
hoursOfOperation: string;
|
||||
id: number;
|
||||
location: Location;
|
||||
name: string;
|
||||
phone: string;
|
||||
postalCode: string;
|
||||
reviewCount: number;
|
||||
userRating: number;
|
||||
website:string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// Type definitions for Microsoft.Maps.Themes 7.0
|
||||
// Project: http://msdn.microsoft.com/en-us/library/hh868061.aspx
|
||||
// Definitions by: Eric Todd <https://github.com/ericrtodd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Microsoft.Maps.Themes {
|
||||
|
||||
export class BingTheme {
|
||||
constructor();
|
||||
}
|
||||
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
// Type definitions for Microsoft.Maps.Traffic 7.0
|
||||
// Project: http://msdn.microsoft.com/en-us/library/hh312840.aspx
|
||||
// Definitions by: Eric Todd <https://github.com/ericrtodd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Microsoft.Maps.Traffic {
|
||||
|
||||
export class TrafficManager {
|
||||
|
||||
constructor(map: Map);
|
||||
|
||||
hide(): void;
|
||||
hideFlow(): void;
|
||||
hideIncidents(): void;
|
||||
hideLegend(): void;
|
||||
show(): void;
|
||||
showFlow(): void;
|
||||
showIncidents(): void;
|
||||
showLegend():void;
|
||||
}
|
||||
|
||||
}
|
||||
-136
@@ -1,136 +0,0 @@
|
||||
// Type definitions for Microsoft.Maps.VenueMaps 7.0
|
||||
// Project: http://msdn.microsoft.com/en-us/library/hh312797.aspx
|
||||
// Definitions by: Eric Todd <https://github.com/ericrtodd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace Microsoft.Maps.VenueMaps {
|
||||
|
||||
export interface MouseResponse {
|
||||
eventArgs: MouseEventArgs;
|
||||
}
|
||||
|
||||
export interface PrimitiveResponse {
|
||||
eventArgs: Primitive;
|
||||
}
|
||||
|
||||
export interface Directory {
|
||||
|
||||
addToDOM(div: HTMLElement, sortOrder: DirectorySortOrder, to_group_or_not: DirectoryGrouping): void;
|
||||
createUIElements(): void;
|
||||
handleMouseClick(e: (response: MouseResponse) => void): void;
|
||||
handleMouseClick(e: (response: PrimitiveResponse) => void): void;
|
||||
handleMouseOut(e: (response: MouseResponse) => void): void;
|
||||
handleMouseOut(e: (response: PrimitiveResponse) => void): void;
|
||||
handleMouseOver(e: (response: MouseResponse) => void): void;
|
||||
handleMouseOver(e: (response: PrimitiveResponse) => void): void;
|
||||
isInDOM(): boolean;
|
||||
removeFromDOM(): void;
|
||||
setHeight(height: number): void;
|
||||
}
|
||||
|
||||
export enum DirectoryGrouping {
|
||||
byCategory,
|
||||
none,
|
||||
}
|
||||
|
||||
export enum DirectorySortOrder {
|
||||
alphabetical,
|
||||
byFloor,
|
||||
}
|
||||
|
||||
export interface Floor {
|
||||
name: string;
|
||||
primitives: Array<Primitive>;
|
||||
zoomRange: Array<number>;
|
||||
}
|
||||
|
||||
export interface Footprint {
|
||||
polygons: Array<Polygon>;
|
||||
zoomRange: Array<number>;
|
||||
}
|
||||
|
||||
export interface Metadata {
|
||||
CenterLatitude: number;
|
||||
CenterLongitude: number;
|
||||
DefaultFloor: string;
|
||||
FloorHeader: string;
|
||||
Floors: Array<Floor>;
|
||||
Footprint: Footprint;
|
||||
MapId: string;
|
||||
MapType: string;
|
||||
Name: string;
|
||||
YpId: string;
|
||||
}
|
||||
|
||||
export interface NearbyVenue {
|
||||
distance: number;
|
||||
metadata: Metadata;
|
||||
}
|
||||
|
||||
export interface NearbyVenueOptions {
|
||||
callback?: (maps: Array<VenueMap>) => any;
|
||||
location?: Location;
|
||||
map?: Map;
|
||||
radius?: number;
|
||||
}
|
||||
|
||||
export interface Polygon {
|
||||
bounds: LocationRect;
|
||||
center: Location;
|
||||
locations: Array<Location>;
|
||||
}
|
||||
|
||||
export interface Primitive {
|
||||
|
||||
bounds: LocationRect;
|
||||
businessId: string;
|
||||
categoryId: string;
|
||||
categoryName: string;
|
||||
center: Location;
|
||||
floor: Floor;
|
||||
id: string;
|
||||
locations: Array<Location>;
|
||||
name: string;
|
||||
|
||||
highlight(): void;
|
||||
unhighlight(): void;
|
||||
}
|
||||
|
||||
export interface VenueMap {
|
||||
|
||||
address: string;
|
||||
bestMapView: ViewOptions;
|
||||
businessId: string;
|
||||
center: Location;
|
||||
defaultFloor: string;
|
||||
directory: Directory;
|
||||
floorHeader: string;
|
||||
floors: Array<Floor>;
|
||||
footprint: Footprint;
|
||||
id: string;
|
||||
name: string;
|
||||
phoneNumber: string;
|
||||
type: string;
|
||||
|
||||
dispose(): void;
|
||||
getActiveFloor(): string;
|
||||
hide(): void;
|
||||
setActiveFloor(floor: string): void;
|
||||
show(): void;
|
||||
}
|
||||
|
||||
export interface VenueMapCreationOptions {
|
||||
error: (errorCode: number, args: any) => any;
|
||||
success: (venueMap: VenueMap, args: any) => any;
|
||||
venueMapId: string;
|
||||
}
|
||||
|
||||
export class VenueMapFactory {
|
||||
|
||||
constructor(map: Map);
|
||||
|
||||
create(options: VenueMapCreationOptions): void;
|
||||
getNearbyVenues(options: NearbyVenueOptions): void;
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+235
@@ -0,0 +1,235 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
/**
|
||||
* Provides an easy method for geocoding address and searching for points of interest from JavaScript.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
declare module Microsoft.Maps.Search {
|
||||
/**
|
||||
* Defines the match precision of a geocdoed result.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export enum LocationPrecision {
|
||||
/** The geocode result was matched to a point on a road using interpolation. */
|
||||
interpolated,
|
||||
|
||||
/**
|
||||
* The geocode result was matched to a point on a road using interpolation with an additional offset to shift the
|
||||
* Location to the side of the street.
|
||||
*/
|
||||
InterpolatedOffset,
|
||||
|
||||
/** The geocode result was matched to the center of a parcel (property boundary). */
|
||||
parcel,
|
||||
|
||||
/** The geocode result was matched to the rooftop of a building. */
|
||||
rooftop
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the geocoding level of the location match found by the geocoder.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export enum MatchCode {
|
||||
/** No match was found. */
|
||||
none,
|
||||
|
||||
/** The match was good. */
|
||||
good,
|
||||
|
||||
/** The match was ambiguous. Multiple results were returned. */
|
||||
ambiguous,
|
||||
|
||||
/** The match was found by a broader search. */
|
||||
upHierarchy,
|
||||
|
||||
/** The match was found, but possibly using a modified query. */
|
||||
modified
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the confidence of the location match found by the geocoding service.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export enum MatchConfidence {
|
||||
/** The confidence of the match is high. */
|
||||
high,
|
||||
|
||||
/** The confidence of the match is medium. */
|
||||
medium,
|
||||
|
||||
/** The confidence of the match is low. */
|
||||
low,
|
||||
|
||||
/** The confidence of the match is unknown. */
|
||||
unknown
|
||||
}
|
||||
|
||||
/** A object that represents a geocoded location. */
|
||||
export interface IGeocodeLocation {
|
||||
/** The map location of this geocode location match. */
|
||||
location: Location;
|
||||
|
||||
/** The name of this geocode location match. */
|
||||
name: string;
|
||||
|
||||
/** The precision of this geocode location match. */
|
||||
precision: string | LocationPrecision;
|
||||
}
|
||||
|
||||
/** An object that represents an place result. */
|
||||
export interface IPlaceResult {
|
||||
/** The geocoded address of the place result. */
|
||||
address: IAddress;
|
||||
|
||||
/** The location rectangle that defines the boundaries of the best map view of the place result. */
|
||||
bestView: LocationRect;
|
||||
|
||||
/** The classification of the geographic entity returned, such as PopulatedPlace. */
|
||||
entityType: string;
|
||||
|
||||
/** The geocoded location of the best result. */
|
||||
location: Location;
|
||||
|
||||
/** The geocoded locations. */
|
||||
locations: IGeocodeLocation[];
|
||||
|
||||
/** The match code of the best result. */
|
||||
matchCode: string | MatchCode;
|
||||
|
||||
/** The match confidence of the best result. */
|
||||
matchConfidence: string | MatchConfidence;
|
||||
|
||||
/** The name of the place result, if one exists. */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** An object that represents a geocode result returned by REST service. */
|
||||
export interface IGeocodeResult {
|
||||
/** An array of geocode results. */
|
||||
results: IPlaceResult[];
|
||||
}
|
||||
|
||||
/** The options for a geocode request. */
|
||||
export interface IGeocodeRequestOptions {
|
||||
/**
|
||||
* A location rectangle that defines the boundaries of the area in which to search for
|
||||
* location results. The default is the bounds of the map view associated with this
|
||||
* instance of the SearchManager, which is usually the current map view.
|
||||
*/
|
||||
bounds?: LocationRect;
|
||||
|
||||
/**
|
||||
* The name of the function to call when a successful result is returned from the
|
||||
* geocode request. The callback function must accept two parameters: result, which is
|
||||
* a GeocodeResult type, and a userData object.
|
||||
*/
|
||||
callback: (geocodeResult: IGeocodeResult, userData: any) => void;
|
||||
|
||||
/** The maximum number of results to return. Required. The maximum number than can be returned is 20. */
|
||||
count?: number;
|
||||
|
||||
/**
|
||||
* The name of the function to call when the request is returned with an error. The
|
||||
* error callback function must accept an IGeocodeRequestOptions object.
|
||||
*/
|
||||
errorCallback?: (geocodeRequestOptions: IGeocodeRequestOptions) => void;
|
||||
|
||||
/** Specifies to include the two-letter ISO country code. */
|
||||
includeCountryIso2?: boolean;
|
||||
|
||||
/** Specifies to include the neighborhood in the response when it is available. */
|
||||
includeNeighborhood?: boolean;
|
||||
|
||||
/** A number indicating how long to wait, in seconds, for the geocode request to return. The default value is 5 seconds. */
|
||||
timeout?: number;
|
||||
|
||||
/** An object containing any data that needs to be passed to the callback when the request is completed. */
|
||||
userData?: any;
|
||||
|
||||
/** A string containing the address or place to be matched to a location on the map. */
|
||||
where: string;
|
||||
}
|
||||
|
||||
/** The options for a reverse geocode request. */
|
||||
export interface ReverseGeocodeRequestOptions {
|
||||
/**
|
||||
* A reference to a function to call when a successful result is returned from the geocode request. The callback function
|
||||
* will receive a PlaceResult object as an argument.
|
||||
*/
|
||||
callback: (placeResult: IPlaceResult, userData: any) => void;
|
||||
|
||||
/**
|
||||
* A reference to a function to call when the request is returned with an error. The error callback function will receive
|
||||
* an object containing the geocode request options used in the request.
|
||||
*/
|
||||
errorCallback?: (reverseGeocodeRequestOptions: ReverseGeocodeRequestOptions) => void;
|
||||
|
||||
/** Specifies to include the two-letter ISO country code. Default: false */
|
||||
includeCountryIso2?: boolean;
|
||||
|
||||
/**
|
||||
* An array of entity types selected from the following options.
|
||||
* • Address
|
||||
* • Neighborhood
|
||||
* • PopulatedPlace
|
||||
* • Postcode1
|
||||
* • AdminDivision1
|
||||
* • AdminDivision2
|
||||
* • CountryRegion
|
||||
* These entity types are ordered from the most specific entity to the least specific entity. When entities of more than one entity type are found, only the most specific
|
||||
* entity is returned. For example, if you specify Address and AdminDistrict1 as entity types and entities were found for both types, only the Address entity information is
|
||||
* returned in the response. One exception to this rule is when both PopulatedPlace and Neighborhood entity types are specified and information is found for both. In this case,
|
||||
* the information for both entity types is returned. Also, more than one Neighborhood may be returned because the area covered by two different neighborhoods can overlap.
|
||||
*/
|
||||
includeEntityTypes?: string[];
|
||||
|
||||
/**
|
||||
* Specifies to include the neighborhood in the response when it is available. Note: This feature isn’t
|
||||
* available in all locations.
|
||||
*/
|
||||
includeNeighborhood?: boolean;
|
||||
|
||||
/** The location to use to match to geographic entities and addresses. */
|
||||
location: Location;
|
||||
|
||||
/** A number indicating how long to wait, in seconds, for the reverse geocode request to return. The default value is 5 seconds. */
|
||||
timeout?: number;
|
||||
|
||||
/** An object containing any data that needs to be passed to the callback when the request is completed. */
|
||||
userData?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class that contains methods for returning search and location results.
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
*/
|
||||
export class SearchManager {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Search module.
|
||||
* @param map A Map object
|
||||
*/
|
||||
constructor(map: Map);
|
||||
|
||||
/**
|
||||
* Matches the address or place query in the specified request
|
||||
* options to a location and returns the results to the request
|
||||
* options callback function.
|
||||
* @param request Options for sending geocode request
|
||||
*/
|
||||
public geocode(request: IGeocodeRequestOptions): void;
|
||||
|
||||
/**
|
||||
* Matches the specified location to an address and returns the
|
||||
* address results to the specified request options callback function.
|
||||
* @param request Options for sending reverse geocode request
|
||||
*/
|
||||
public reverseGeocode(request: ReverseGeocodeRequestOptions): void;
|
||||
}
|
||||
}
|
||||
+447
@@ -0,0 +1,447 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
/**
|
||||
* This module wraps the Query and GeoData REST API’s in the Bing Spatial Dara Services and expose them as an easy to use JavaScript library.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialDataService {
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// GeoData API
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/** Represents the options for requests boundary data from the GeoData API in the Bing Spatial Data Services. */
|
||||
export interface IGetBoundaryRequestOptions {
|
||||
/**
|
||||
* The level of detail for the boundary polygons returned. An integer between 0 and 3, where 0 specifies the coarsest level of boundary detail and 3
|
||||
* specifies the best. Default: 0
|
||||
*/
|
||||
lod?: number;
|
||||
|
||||
/**
|
||||
* The entity type to return. Default: CountryRegion
|
||||
* Supported entity types:
|
||||
* AdminDivision1, AdminDivision2, CountryRegion, eighborhood, PopulatedPlace, Postcode1, Postcode2, Postcode3, Postcode4
|
||||
* Note: Not all entity types are available in all areas.
|
||||
*/
|
||||
entityType?: string;
|
||||
|
||||
/**
|
||||
* Specifies the preferred language to use for any metadata text about the entity or polygons. Defaults to the culture used by the map control, which
|
||||
* usually automatically detected based on user's browser settings. Setting this property will override the default value.
|
||||
*/
|
||||
culture?: string;
|
||||
|
||||
/**
|
||||
* Specifies whether the response should include all of the boundary polygons for the requested entity or just return a single polygon that represents
|
||||
* the main outline of the entity. Default: false
|
||||
*/
|
||||
getAllPolygons?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies whether the response should include metadata about the entity, such as AreaSqKm and others. Default: false
|
||||
*/
|
||||
getEntityMetadata?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies the user’s home country or region.Defaults to the region setting of the user who loads the map.
|
||||
* Warning: Setting this property will override the default value, which is the region the user is actually in, and will allow the user to see boundaries
|
||||
* which may not align with the views of their region.This could result in geopolitically sensitive borders being returned.
|
||||
*/
|
||||
userRegion?: string;
|
||||
}
|
||||
|
||||
/** Represents the primitive object for a boundary returned by the GeoData API. */
|
||||
export interface IGeoDataPrimitive {
|
||||
/** A unique ID associated with this polygon primitive. */
|
||||
PrimitiveID: string;
|
||||
|
||||
/**
|
||||
* A comma-delimited sequence starting with the version number of the polygon set followed by a list of compressed polygon
|
||||
* "rings" (closed paths represented by sequences of latitude and-longitude points).
|
||||
*/
|
||||
Shape: string;
|
||||
|
||||
/** The number of vertex points used to define the polygon. */
|
||||
NumPoints: string;
|
||||
|
||||
/**
|
||||
* An ID identifying the data provider that supplied the data. This ID number will reference one of the sources listed in the
|
||||
* array of CopyrightSources in the Copyright property of the GeoDataResultSet object.
|
||||
*/
|
||||
SourceID: string;
|
||||
}
|
||||
|
||||
/** Represents the copyright source object for a boundary returned by the GeoData API. */
|
||||
export interface ICopyrightSource {
|
||||
/** The copyright string from the source. */
|
||||
Copyright: string;
|
||||
|
||||
/** An ID identifying the data provider that supplied the data. */
|
||||
SourceID: string;
|
||||
|
||||
/** The name of the data provider represented by this Source element. */
|
||||
SourceName: string;
|
||||
}
|
||||
|
||||
/** Represents the copyright object for a boundary returned by the GeoData API. */
|
||||
export interface ICopyright {
|
||||
/** The copyright URL for the GeoData service. */
|
||||
CopyrightURL: string;
|
||||
|
||||
/** A collection of CopyrightSource objects that give information about the sources of the polygon data that is returned. */
|
||||
Sources: ICopyrightSource[];
|
||||
}
|
||||
|
||||
/** Represents the name object for a boundary returned by the GeoData API. */
|
||||
export interface IName {
|
||||
/** The name of boundary. Example: "United States" */
|
||||
EntityName: string;
|
||||
|
||||
/** The culture of the region. */
|
||||
Culture: string;
|
||||
|
||||
/** An ID identifying the data provider that supplied the data. */
|
||||
SourceID: string;
|
||||
}
|
||||
|
||||
/** Represents the metadata object for a boundary returned by the GeoData API. Not all properties will be returned for all results. */
|
||||
export interface IMetadata {
|
||||
/** The approximate total surface area (in square kilometers) covered by all the polygons that comprise this entity. */
|
||||
AreaSqKm: string;
|
||||
|
||||
/**
|
||||
* An area on the Earth that provides the best map view for this entity. This area is defined as a bounding box in the format of a
|
||||
* “MULTIPOINT ((WestLongitude SouthLatitude), (EastLongitude NorthLatitude))”.
|
||||
*/
|
||||
BestMapViewBox: string;
|
||||
|
||||
/** The culture associated with this entity. Example: en */
|
||||
OfficialCulture: string;
|
||||
|
||||
/** The approximate population within this entity. Example: PopClass20000to99999 */
|
||||
PopulationClass: string;
|
||||
|
||||
/** The regional culture associated with this entity. */
|
||||
RegionalCulture: string;
|
||||
}
|
||||
|
||||
/** Represents a single result object returned by the GeoData API. */
|
||||
export interface IGeoDataResult {
|
||||
/** Copyright information for the returned boundary data. */
|
||||
Copyright: ICopyright;
|
||||
|
||||
/** A unique ID number associated with this entity. */
|
||||
EntityID: string;
|
||||
|
||||
/**
|
||||
* A collection of metadata information associated with the entity. The getEntityMetadata option of the request must be set
|
||||
* to true. Note, not all boundaries will return this metadata.
|
||||
*/
|
||||
EntityMetadata: IMetadata;
|
||||
|
||||
/** Information about the name of the boundary location. */
|
||||
Name: IName;
|
||||
|
||||
/** A Polygon object that has been generated from the data in the Primitives property. */
|
||||
Polygons: Polygon[];
|
||||
|
||||
/** An array of objects that contain the polygon information for the boundary. */
|
||||
Primitives: IGeoDataPrimitive[];
|
||||
}
|
||||
|
||||
/** Represents the set of results returned by the GeoData API. */
|
||||
export interface IGeoDataResultSet {
|
||||
/** Copyright information for the GeoData API. */
|
||||
Copyright: string;
|
||||
|
||||
/** The location provided in the query that generated this result. */
|
||||
location: string | Location;
|
||||
|
||||
/** Results of the boundary data. */
|
||||
results: IGeoDataResult[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a static class that provides the ability to request polygons that describe the boundaries of a geographic entities, such as an AdminDivision1
|
||||
* (such as a state or province) or a Postcode1 (such as a zip code) that contain a given point (latitude and longitude) or address. This uses the GeoData
|
||||
* API in the Bing Spatial Data Services.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export module GeoDataAPIManager {
|
||||
/**
|
||||
* Gets a boundary for the specified request. If the specified location value is a string, it will be geocoded and the coordinates of the result will
|
||||
* be used to find a boundary of the specified entityType that intersects with this coordinate.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param locations The locations to retrieve boundaries for. If the specified location value is a string, it will be geocoded and the coordinates of
|
||||
* the result will be used to find a boundary of the specified entityType that intersects with this coordinate.
|
||||
* @param request The request options for retrieving a boundary.
|
||||
* @param credentials A bing maps key or a map instance which can be used to provide credentials to access the data source. Note that the map will need
|
||||
* to be loaded with a bing maps key that has access to the data source.
|
||||
* @param callback A callback function to return the results to. If an array of locations are specified the callback function will be triggered for each location in the array.
|
||||
*/
|
||||
export function getBoundary(locations: string | Location | (string | Location)[], request: IGetBoundaryRequestOptions, credentials: string | Map, callback: (results: IGeoDataResultSet) => void): void;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Query API
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* An enumeration that defines how to compare the filters value against the corresponding property value.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export enum FilterCompareOperator {
|
||||
/** Determines if a string value ends with a specified string value. */
|
||||
endsWith,
|
||||
|
||||
/** Determines if two values are equal. */
|
||||
equals,
|
||||
|
||||
/** Determines if a first value is greater than a second value. */
|
||||
greaterThan,
|
||||
|
||||
/** Determines if a first value is greater than or equal to a second value. */
|
||||
greaterThanOrEqual,
|
||||
|
||||
/** Determines if a value is within an array. */
|
||||
isIn,
|
||||
|
||||
/** Determines if a first value is less than a second value. */
|
||||
lessThan,
|
||||
|
||||
/** Determines if a first value is less than or equal a second value. */
|
||||
lessThanOrEqual,
|
||||
|
||||
/** Determines if a string value does not end with a specified string value. */
|
||||
notEndsWith,
|
||||
|
||||
/** Determines if two values are not equal. */
|
||||
notEquals,
|
||||
|
||||
/** Determines if a string value does not start with a specified string value. */
|
||||
notStartsWith,
|
||||
|
||||
/** Determines if a string value starts with a specified string value. */
|
||||
startsWith
|
||||
}
|
||||
|
||||
/**
|
||||
* An enumeration that defines how two or more filters are linked together.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export enum FilterLogicalOperator {
|
||||
/** Connects two or more filters that both must be true. */
|
||||
and,
|
||||
|
||||
/** Connects two or more filters where one of them must be true. */
|
||||
or
|
||||
}
|
||||
|
||||
/**
|
||||
* A Fitler object that defines the logic behind a filter expression that can be executed against a JSON object or generate
|
||||
* a filter string that can be used with the Bing Spatial Data Services.
|
||||
*/
|
||||
export interface IFilter {
|
||||
/**
|
||||
* Executes the filter logic against a JSON object and returns a boolean indicating if the object meets the requirements of the Filter.
|
||||
* @returns A boolean indicating if the specified object meets the requirements of the Filter.
|
||||
*/
|
||||
execute(object: any): boolean;
|
||||
|
||||
/**
|
||||
* Converts the filter logic into a string format that is compatible with the Bing Spatial Data Services.
|
||||
* @returns A filter string that is formatted such that it is compatible with the Bing Spatial Data Services.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Fitler class defines the logic behind a filter expression that can be executed against a JSON object or generate
|
||||
* a filter string that can be used with the Bing Spatial Data Services.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export class Filter implements IFilter {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param propertyName The name of the property in the object to test against. Can also provide child properties i.e. 'root.child'.
|
||||
* @param operator The operator to use when comparing the specified property to value to the provided value.
|
||||
* @param value A value to compare against.
|
||||
*/
|
||||
constructor(propertyName: string, operator: string | FilterCompareOperator, value: any);
|
||||
|
||||
/**
|
||||
* Executes the filter logic against a JSON object and returns a boolean indicating if the object meets the requirements of the Filter.
|
||||
* @returns A boolean indicating if the specified object meets the requirements of the Filter.
|
||||
*/
|
||||
public execute(object: any): boolean;
|
||||
|
||||
/**
|
||||
* Converts the filter logic into a string format that is compatible with the Bing Spatial Data Services.
|
||||
* @returns A filter string that is formatted such that it is compatible with the Bing Spatial Data Services.
|
||||
*/
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* A class that groups two or more logical filters or filter groups together. It can be executed against a JSON or generate
|
||||
* a filter string that can be used with the Bing Spatial Data Services.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export class FilterGroup implements IFilter {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param filters An array consisting of Filter or FilterGroup objects to combine.
|
||||
* @param operator The logical operator for combining the filters together.
|
||||
* @param not A boolean is the logical inverse should of the filter should be used.
|
||||
*/
|
||||
constructor(filters: IFilter[], operator: FilterLogicalOperator, not?: boolean)
|
||||
|
||||
/**
|
||||
* Executes the filter logic against a JSON object and returns a boolean indicating if the object meets the requirements of the Filter.
|
||||
* @returns A boolean indicating if the specified object meets the requirements of the Filter.
|
||||
*/
|
||||
public execute(object: any): boolean;
|
||||
|
||||
/**
|
||||
* Converts the filter logic into a string format that is compatible with the Bing Spatial Data Services.
|
||||
* @returns A filter string that is formatted such that it is compatible with the Bing Spatial Data Services.
|
||||
*/
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
/** Options for find near route query API. */
|
||||
export interface ISpatialFilterOptions {
|
||||
/**
|
||||
* One of the following values:
|
||||
* • nearby – Searches in a radius around a location.
|
||||
* • nearRoute – Searches for results that are within 1 mile of a route.
|
||||
* • intersects – Searches for results that intersect with the specified geometry.
|
||||
* Note: Note that the NavteqNA and NavteqEU data sources only support nearby queries.
|
||||
*/
|
||||
spatialFilterType: string;
|
||||
|
||||
/** Location at which the filter should be applied (only for nearby filter). */
|
||||
location?: string | Location;
|
||||
|
||||
/**
|
||||
* Radius to use when performing a nearby search. The distance in kilometers and must be between 0.16 and 1000 kilometers
|
||||
* (only for nearby filter).
|
||||
*/
|
||||
radius?: number;
|
||||
|
||||
/** Start location of the route (only for nearroute filter). */
|
||||
start?: string | Location;
|
||||
|
||||
/** End location of the route (only for nearroute filter). */
|
||||
end?: string | Location;
|
||||
|
||||
/** Intersection object. Can be a well known text string or a LocationRect object (only for intersects filter). */
|
||||
intersects?: string | LocationRect | IPrimitive;
|
||||
}
|
||||
|
||||
/** Options for find near route query API. */
|
||||
export interface IFindNearRouteOptions extends ISpatialFilterOptions {
|
||||
/**
|
||||
* One of the following values:
|
||||
* • Driving [default]
|
||||
* • Walking
|
||||
*/
|
||||
travelMode?: string;
|
||||
|
||||
/**
|
||||
* An integer value between 0 and 359 that represents degrees from north
|
||||
* where north is 0 degrees and the heading is specified clockwise from north.
|
||||
* For example, setting the heading of 270 degrees creates a route that initially heads west
|
||||
*/
|
||||
heading?: number;
|
||||
|
||||
/**
|
||||
* An integer distance specified in meters.
|
||||
* Use this parameter to make sure that the moving vehicle has enough distance
|
||||
* to make the first turn
|
||||
*/
|
||||
distanceBeforeFirstTurn?: number;
|
||||
|
||||
/**
|
||||
* A list of values that limit the use of highways and toll roads in the route.
|
||||
* Use one of the following values:
|
||||
* • highways - Avoids the use of highways in the route.
|
||||
* • tolls - Avoids the use of toll roads in the route.
|
||||
* • minimizeHighways - Minimizes (tries to avoid) the use of highways in the route.
|
||||
* • minimizeTolls - Minimizes (tries to avoid) the use of toll roads in the route.
|
||||
*/
|
||||
avoid?: string[];
|
||||
|
||||
/**
|
||||
* One of the following values:
|
||||
* • distance - The route is calculated to minimize the distance.Traffic information is not used.
|
||||
* • time[default] - The route is calculated to minimize the time.Traffic information is not used.
|
||||
* • timeWithTraffic - The route is calculated to minimize the time and uses current traffic information.
|
||||
*/
|
||||
optimize?: string;
|
||||
}
|
||||
|
||||
/** Set of options that can be specified for query APIs. */
|
||||
export interface IQueryAPIOptions {
|
||||
/** A queryurl containing the access id, data source name and the entity type name. */
|
||||
queryUrl: string;
|
||||
|
||||
/** Specifies a conditional expression for a list of properties and values. */
|
||||
filter?: IFilter;
|
||||
|
||||
/** Specifies whether or not to return a count of the results in the response. Default: false */
|
||||
inlineCount?: boolean;
|
||||
|
||||
/** Specifies to query the staged version of the data source instead of the published version. Default: false */
|
||||
isStaging?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies one or more properties to use to sort the results of a query.
|
||||
* You can specify up to three (3) properties. Results are sorted in ascending order.
|
||||
* Note: You cannot use the latitude and longitude properties to sort results. You can use the elevation property.
|
||||
*/
|
||||
orderBy?: string[];
|
||||
|
||||
/**
|
||||
* Specifies the data source properties to return in the response. If the $select query option is not specified or
|
||||
* if it is set to "" ($select=), all data source properties are returned. Default: "*,_distance"
|
||||
*/
|
||||
select?: string[];
|
||||
|
||||
/** Specifies to not return a specified number of query results. */
|
||||
skip?: number;
|
||||
|
||||
/** Spatial filter options to apply. */
|
||||
spatialFilter?: ISpatialFilterOptions | IFindNearRouteOptions;
|
||||
|
||||
/** Specifies the maximum number of results to return in the query response. Default: 25 */
|
||||
top?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a static class that provides that ability to query data sources that are hosted by the Bing Spatial Data Services using the Query API.
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
*/
|
||||
export module QueryAPIManager {
|
||||
/**
|
||||
* Perform a search
|
||||
* @requires The Microsoft.Maps.SpatialDataService module.
|
||||
* @param queryOptions - Options for the query
|
||||
* @param credentials - Credentials for the query
|
||||
* @param callback - The function to call once the results are retrieved
|
||||
* @param styles - (Optional) Styles of the data that needs to be rendered on map
|
||||
*/
|
||||
export function search(queryOptions: IQueryAPIOptions,
|
||||
credentials: string | Map,
|
||||
callback: (data: IPrimitive[], inlineCount?: number) => void,
|
||||
styles?: IStylesOptions): void;
|
||||
}
|
||||
}
|
||||
Vendored
+537
@@ -0,0 +1,537 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Core Library
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* This module provides a bunch of useful spatial math calculations.
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialMath {
|
||||
|
||||
/**
|
||||
* Distance Unit enumerator
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
**/
|
||||
export enum DistanceUnits {
|
||||
/** A distance in meters */
|
||||
Meters,
|
||||
|
||||
/** A distance in kilometers */
|
||||
Kilometers,
|
||||
|
||||
/** A distance in miles */
|
||||
Miles,
|
||||
|
||||
/** A distance in Feet */
|
||||
Feet,
|
||||
|
||||
/** A distance in Yards */
|
||||
Yards,
|
||||
|
||||
/** A distance in Nautical Miles */
|
||||
NauticalMiles
|
||||
}
|
||||
|
||||
/**
|
||||
* Area units enumerator
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
**/
|
||||
export enum AreaUnits {
|
||||
/** Area in square meters */
|
||||
SquareMeters,
|
||||
|
||||
/** Area in square kilometers */
|
||||
SquareKilometers,
|
||||
|
||||
/** Area in square miles */
|
||||
SquareMiles,
|
||||
|
||||
/** Area in square Feet */
|
||||
SquareFeet,
|
||||
|
||||
/** Area in square Yards */
|
||||
SquareYards,
|
||||
|
||||
/** Area in Acres */
|
||||
Acres,
|
||||
|
||||
/** Area in Hectares */
|
||||
Hectares
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Core Calculations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Converts an area from one area units to another.
|
||||
* @param area A number that represents an area to convert.
|
||||
* @param fromUnits The area units the original area is in.
|
||||
* @param toUnits The area units to convert to.
|
||||
* @returns An area in the new units.
|
||||
**/
|
||||
export function convertArea(area: number, fromUnits: AreaUnits, toUnits: AreaUnits): number;
|
||||
|
||||
/**
|
||||
* Converts a distance from one distance units to another.
|
||||
* @param distance A number that represents a distance to convert.
|
||||
* @param fromUnits The distance units the original distance is in.
|
||||
* @param toUnits The disired distance units to convert to.
|
||||
* @returns A distance in the new units.
|
||||
**/
|
||||
export function convertDistance(distance: number, fromUnits: DistanceUnits, toUnits: DistanceUnits): number;
|
||||
|
||||
/**
|
||||
* Calculates an array of locations that form a cardinal spline between the specified array of locations.
|
||||
* @param locations The array of locations to calculate the spline through.
|
||||
* @param tension A number that indicates the tightness of the curve. Can be any number, although a value between 0 and 1 is usually used. Default: 0.5
|
||||
* @param nodeSize Number of nodes to insert between each Location. Default: 15
|
||||
* @param close A boolean indicating if the spline should be a closed ring or not. Default: false
|
||||
* @returns An array of locations that form a cardinal spline between the specified array of locations.
|
||||
*/
|
||||
export function getCardinalSpline(locations: Location[], tension ?: number, nodeSize ?: number, close ?: boolean): Location[];
|
||||
|
||||
/**
|
||||
* Calculates a destination Location based on a starting Location, a heading, a distance, and a distance unit type.
|
||||
* @param origin Location that the destination is relative to.
|
||||
* @param bearing A heading angle between 0 - 360 degrees. 0 - North, 90 - East, 180 - South, 270 - West.
|
||||
* @param distance Distance that destination is away.
|
||||
* @param units Unit of distance measurement. Default is Meters.
|
||||
* @returns A Location that is the specified distance away from the origin.
|
||||
**/
|
||||
export function getDestination(origin: Location, bearing: number, distance: number, units?: DistanceUnits): Location;
|
||||
|
||||
/**
|
||||
* Calculate the distance between two Location objects on the surface of the earth using the Haversine formula.
|
||||
* @param origin First Location to calculate distance between.
|
||||
* @param destination Second Location to calculate distance between.
|
||||
* @param units Unit of distance measurement. Default is Meters.
|
||||
* @param highAccuracy When set enabled, will use the slower but more accurate Vincenty formula for calculating distances, rather than the Haversine formula.
|
||||
* @returns The shortest distance between two Locations in the specifed units.
|
||||
**/
|
||||
export function getDistanceTo(origin: Location, destination: Location, units?: DistanceUnits, highAccuracy?: boolean): number;
|
||||
|
||||
/**
|
||||
* Retrieves the radius of the earth in a specific distance unit for WGS84.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @returns A number that represents the radius of the earth in a specific distance unit.
|
||||
**/
|
||||
export function getEarthRadius(units?: DistanceUnits): number;
|
||||
|
||||
/**
|
||||
* Takes an array of Locations objects and fills in the space between them with accurately positioned Locations to form an approximated Geodesic path.
|
||||
* @param path Array of Location objects that form a path to fill in.
|
||||
* @param nodeSize Number of nodes to insert between each Location. Default: 15
|
||||
* @returns An array of Location objects that form a geodesic paths.
|
||||
**/
|
||||
export function getGeodesicPath(path: Location[], nodeSize?: number): Location[];
|
||||
|
||||
/**
|
||||
* Calculates the heading from one Location object to another.
|
||||
* @param origin Point of origin.
|
||||
* @param destination Destination to calculate relative heading to.
|
||||
* @returns A heading in degrees between 0 and 360. 0 degrees points due North.
|
||||
**/
|
||||
export function getHeading(origin: Location, destination: Location): number;
|
||||
|
||||
/**
|
||||
* Calculates the distance between all Location objects in an array.
|
||||
* @param path The array of Location objects that make up the path to calculate the length of.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @param highAccuracy If set to true, uses the more accurate Vincenty algorithm for calcuating distances. Otherwise the faster Haversine formula is used.
|
||||
* @returns The distance between all Locations in between all Location objects in an array on the surface of a earth in the specifed units.
|
||||
**/
|
||||
export function getLengthOfPath(path: Location[], units?: DistanceUnits, highAccuracy?: boolean): number;
|
||||
|
||||
/**
|
||||
* Calculates the Location object on a path that is a specified distance away from the start of the path. If the specified distance is longer
|
||||
* than the length of the path, the last Location of the path will be returned.
|
||||
* @param path A polyline or array of Location coordinates that form a path.
|
||||
* @param distance The distance along the path (from the start) to calculate the location for.
|
||||
* @param units Unit of distance measurement. Default is Meters.
|
||||
* @returns A Location object that is the specified distance away from the start of the path when following the path.
|
||||
**/
|
||||
export function getLocationAlongPath(path: Polyline | Location[], distance: number, units?: DistanceUnits): Location;
|
||||
|
||||
/**
|
||||
* Calculates an array of Location objects that are an equal distance away from a central point to create a regular polygon.
|
||||
* @param origin Center of the regular polygon.
|
||||
* @param radius Radius of the regular polygon.
|
||||
* @param numberOfPoints Number of points the polygon should have.
|
||||
* @param units Unit of distance measurement for radius. Default is Meters.
|
||||
* @param offset An offset to rotate the polygon clockwise in degrees. When 0 the first Location will align with North.
|
||||
* @returns An array of Location objects that form a regular polygon.
|
||||
**/
|
||||
export function getRegularPolygon(origin: Location, radius: number, numberOfPoints: number, units?: DistanceUnits, offset?: number): Location[];
|
||||
|
||||
/**
|
||||
* Calculates a Location object that is a fractional distance between two Location objects.
|
||||
* @param origin First Location to calculate mid-point between.
|
||||
* @param destination Second Location to calculate mid-point between.
|
||||
* @param fraction The fractional parameter to calculate a mid-point for. Default 0.5.
|
||||
* @returns A Location that lies a fraction of the distance between two Location objects, relative to the first Location object.
|
||||
**/
|
||||
export function interpolate(origin: Location, destination: Location, fraction?: number): Location;
|
||||
|
||||
/**
|
||||
* Takes a LocationRect and converts it to a polygon.
|
||||
* @param bounds The LocationRect to convert to a Polygon.
|
||||
* @returns A polygon representation of the LocationRect.
|
||||
**/
|
||||
export function locationRectToPolygon(bounds: LocationRect): Polygon;
|
||||
|
||||
/**
|
||||
* Takes a Location object and converts it into a Degree Minute Seconds string in the format. For example: 40° 26′ 46″ N 79° 58′ 56″ W
|
||||
* @param loc The Location object to convert into a Degree Minute Seconds string.
|
||||
* @returns A string in Degree Minute Seconds format or null if invalid Location object is provided.
|
||||
*/
|
||||
export function toDegMinSec(loc: Location): string;
|
||||
|
||||
/**
|
||||
* Tries to parse the given string that is in Degree Minute Seconds format. For Example: 35° 26′ 31″ E or 40° 26′ 46″ N 79° 58′ 56″ W
|
||||
* @param input A string in Degree Minute Seconds format to parse.
|
||||
* @returns Returns a decimal degree value if only a single angle is provided. If two angles provided in the string, then a
|
||||
* Location object is returned. If string is in an invalid format, null is returned.
|
||||
*/
|
||||
export function tryParseDegMinSec(input: string): number | Location;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Tile Calculations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A colleciton of mathematical algorithms based on the tile pyramid used by Bign Maps.
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialMath.Tiles {
|
||||
//Based on https://msdn.microsoft.com/en-us/library/bb259689.aspx
|
||||
|
||||
/**
|
||||
* Calculates the full width of the map in pixels at a specific zoom level from -180 degrees to 180 degrees.
|
||||
* @param zoom Zoom level to calculate width at.
|
||||
* @param tileWidth Width of tile.
|
||||
* @returns Width of map in pixels.
|
||||
**/
|
||||
export function mapSize(zoom: number): number;
|
||||
|
||||
/**
|
||||
* Calculates the Ground resolution at a specific degree of latitude in the specified units per pixel.
|
||||
* @param latitude Degree of latitude to calculate resolution at.
|
||||
* @param zoom Zoom level to calculate resolution at.
|
||||
* @param units Distance unit type to calculate resolution in.
|
||||
* @returns Ground resolution in distance unit per pixels.
|
||||
**/
|
||||
export function groundResolution(latitude: number, zoom: number, units?: SpatialMath.DistanceUnits): number;
|
||||
|
||||
/**
|
||||
* Converts a Pixel coordinate into a Geospatial Location at a specified zoom level.
|
||||
* Global Pixel coordinates are relative to the top left corner of the map (90, -180)
|
||||
* @param point Pixel coordinate.
|
||||
* @param zoom Zoom level.
|
||||
* @returns A Location that is at the specified pixel location at a specified zoom level.
|
||||
**/
|
||||
export function globalPixelToLocation(point: Point, zoom: number): Location;
|
||||
|
||||
/**
|
||||
* Converts a point from latitude/longitude WGS-84 Location (in degrees)
|
||||
* into pixel XY coordinates at a specified level of detail.
|
||||
* @param loc Location to convert to a global pixel.
|
||||
* @param zoom Level of detail, from 1 (lowest detail) to 23 (highest detail).
|
||||
* @returns Point object containing the the global pixel location of a Location.
|
||||
**/
|
||||
export function locationToGlobalPixel(loc: Location, zoom: number): Point;
|
||||
|
||||
/**
|
||||
* Calculates the PyramidTileId that a global pixel intersects with at a specific zoom level.
|
||||
* @param pixel The pixel coordinate to calculate the tile for.
|
||||
* @param zoom The zoom level to calculate the tile for.
|
||||
* @returns A PyramidTileId that a global pixel intersects with at a specific zoom level.
|
||||
**/
|
||||
export function globalPixelToTile(pixel: Point, zoom: number): PyramidTileId;
|
||||
|
||||
/**
|
||||
* Converts a PyramidTileId into a global pixel coordinates of the upper-left pixel of the specified tile.
|
||||
* @param tile A PyramidTileId to calculate the upper-left pixel for.
|
||||
* @returns Global pixel coordinate of the top left corner of a tile.
|
||||
**/
|
||||
export function tileToGlobalPixel(tile: PyramidTileId): Point;
|
||||
|
||||
/**
|
||||
* Calculates the PyramidTileId that a Location object intersects with at a specific zoom level.
|
||||
* @param loc The location to calulate the tile for.
|
||||
* @param zoom The zoom level to use to calculate the tile.
|
||||
* @returns A PyramidTileId that a Location object intersects with at a specific zoom level.
|
||||
**/
|
||||
export function locationToTile(loc: Location, zoom: number): PyramidTileId;
|
||||
|
||||
/**
|
||||
* Calculates all the PyramidTileId's that are within a LocationRect at a specific zoom level.
|
||||
* @param bounds A LocationRect to search for tiles in.
|
||||
* @param zoom The zoom level to calculate tiles for.
|
||||
* @returns A list of PyramidTileId's that are within the specified LocationRect and zoom level.
|
||||
**/
|
||||
export function getTilesInBounds(bounds: LocationRect, zoom: number): PyramidTileId[];
|
||||
|
||||
/**
|
||||
* Calculates the LocationRect (bounding box) of a PyramidTileId.
|
||||
* @param tile A PyramidTileId to calculate the LocationRect of.
|
||||
* @returns The bounding box of a tile.
|
||||
**/
|
||||
export function tileToLocationRect(tile: PyramidTileId): LocationRect;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
/// Geometry Calculations
|
||||
//////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* A colleciton of geometry calculations that can be performed against Bing Maps shapes.
|
||||
* @requires The Microsoft.Maps.SpatialMath module.
|
||||
*/
|
||||
declare module Microsoft.Maps.SpatialMath.Geometry {
|
||||
|
||||
/** Defines how the end of a line should be buffered. */
|
||||
export enum BufferEndCap {
|
||||
/** Adds a rounded end to a buffered line. */
|
||||
Round,
|
||||
|
||||
/** Adds a flat end to a buffered line that touches the end of the line. */
|
||||
Flat,
|
||||
|
||||
/** Adds a square end to a buffered line that has a buffer area at the end of the line. */
|
||||
Square
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the area of a shape.
|
||||
* @param shape The shape to calculate the area of.
|
||||
* @param areaUnits The unit of measurement to calculate the area in.
|
||||
* @returns The area of a shape in the specified unit of measurement.
|
||||
*/
|
||||
export function area(shape: IPrimitive | IPrimitive[], areaUnits?: AreaUnits): number;
|
||||
|
||||
/**
|
||||
* Calculates a bounding box that encloses a set of shapes and/or locations.
|
||||
* @param shapes The shape(s) to calculate the bounding box for.
|
||||
* @returns A location rect that encloses the shapes and/or locations.
|
||||
*/
|
||||
export function bounds(shapes: Location | IPrimitive | (Location | IPrimitive)[]): LocationRect;
|
||||
|
||||
/**
|
||||
* Calcuates a shape with an updated boundary that has been inflated/deflated by a speicifed distance.
|
||||
* @param shape The shape to buffer.
|
||||
* @param distance The distance to buffer the shape by.
|
||||
* @param units The distance units to buffer the shape by.
|
||||
* @param endCapType The type of end cap to use for the joints of the buffer, default value is round.
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns A buffered version of the shape.
|
||||
*/
|
||||
export function buffer(shape: Location | IPrimitive | (Location | IPrimitive)[], distance: number, units?: DistanceUnits, endCapType?: BufferEndCap, options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Calculates the center of a shape.
|
||||
* @param shape The shape to calculate the center of.
|
||||
* @returns The center of the specified shape.
|
||||
*/
|
||||
export function centroid(shape: IPrimitive | IPrimitive[]): Location;
|
||||
|
||||
/**
|
||||
* Calculates an approximate concave hull that best fits the data.
|
||||
* A concave hull is a shape that represents that a possible concave geometry that encloses all shapes in the specified data set.
|
||||
* If a single unique Location is in the data set, a Pushpin is returned. If only two unique Locations are provided, or if all Locations form a line, a Polyline is returned.
|
||||
* If 3 or more unique Locations are in the data set a Polygon, or array of Polygons will be returned.
|
||||
* @param shapes Shape(s) whose Location(s) or Location(s) are to be used to generate a concave hull.
|
||||
* @param allowMultiPolygons A boolean indicating if the resulting concave hull can be a MultiPolygon. Default: false
|
||||
* @param allowHoles A boolean indicating if the polygons in the resulting concave hull can have holes in them. Default: false
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns An approximate concave hull that best fits the data.
|
||||
* If a single unique Location is in the data set, a Pushpin is returned. If only two unique Locations are provided, or if all Locations form a line, a Polyline is returned.
|
||||
* If 3 or more unique Locations are in the data set a Polygon, or array of Polygons will be returned.
|
||||
*/
|
||||
export function concaveHull(shapes: Location | IPrimitive | (Location | IPrimitive)[], allowMultiPolygons?: boolean, allowHoles?: boolean, options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Given two shapes, determines if the first one contains the second one
|
||||
* (or, the second shape is a subset of the first shape) or not.
|
||||
* @param shapeA The first shape to test against the second.
|
||||
* @param shapeB The second shape to test against the first.
|
||||
* @returns A boolean indicating if the first shape contains the second shape.
|
||||
*/
|
||||
export function contains(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): boolean;
|
||||
|
||||
/**
|
||||
* Calculates a convex hull. A convex hull is a shape that represents that minimum convex geometry that encloses all shapes in the specified data set.
|
||||
* @param shapes Shape(s) whose Location(s) or Location(s) are to be used to generate a convex hull.
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns An array of locations that form a convex hull that encloses all locations of the shapes provided in an array.
|
||||
*/
|
||||
export function convexHull(shapes: Location | IPrimitive | (Location | IPrimitive)[], options?: IPolygonOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Creates Delaunay Triangles from the Location objects of the provided shapes.
|
||||
* @param shapes Location(s) of shape(s) or Location(s) to generate a Delaunay Triangles from.
|
||||
* @param options A set of polyline or polygon options to apply to the generated shape.
|
||||
* @returns An array of shapes that form the polygon triangles of the delaunay triangles.
|
||||
*/
|
||||
export function delaunayTriangles(shapes: Location | IPrimitive | (Location | IPrimitive)[], options?: IPolygonOptions): Polygon[];
|
||||
|
||||
/**
|
||||
* Returns an object that represents area of an initial shape subtracted by the overlapping area of a second shape.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape to subtract from the first.
|
||||
* @returns A set of shapes that represent the area of the first shape that is not overlapped by the second shape.
|
||||
*/
|
||||
export function difference(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Calculates the approximate shortest distance between any two shapes.
|
||||
* @param shapeA The first shape to calculate the distance from.
|
||||
* @param shapeB The second shape to calculate the distance to.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @param highAccuracy If set to true, uses the more accurate Vincenty algorithm for calcuating distances. Otherwise the faster Haversine formula is used.
|
||||
* @returns The shorested distance between the shapes in the specified units.
|
||||
*/
|
||||
export function distance(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[], units?: DistanceUnits, highAccuracy?: boolean): number;
|
||||
|
||||
/**
|
||||
* Returns an object that represents the area where two shapes intersect.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns A set of shapes that represents the area where two shapes intersect.
|
||||
*/
|
||||
export function intersection(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Determines if two shapes intersect or not.
|
||||
* @param shapeA The first shape to test against the second.
|
||||
* @param shapeB The second shape to test against the first.
|
||||
* @returns A boolean indicating if the two shapes intersect.
|
||||
*/
|
||||
export function intersects(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): boolean;
|
||||
|
||||
/**
|
||||
* Tests to see if the shape is valid and meets the requirements of an SQL Geography type and other OGC compliant systems. Polylines & Polygons can't be self intersecting. For Polygons,
|
||||
* coordinates in an exterior rings have a counter-clockwise orientation, while holes have a clockwise orientation.
|
||||
* @param shape The shape to test for validity.
|
||||
* @returns Returns a boolean indicting if the specified shape(s) is valid or not.
|
||||
*/
|
||||
export function isValid(shape: IPrimitive | IPrimitive[]): boolean;
|
||||
|
||||
/**
|
||||
* Calculates the distance between all Locations in a shape. If the shape is a polygon, the length of the perimeter of all rings is calculated.
|
||||
* @param shape The shape to calculate the length of.
|
||||
* @param units Unit of distance measurement. Default: Meters
|
||||
* @param highAccuracy If set to true, uses the more accurate Vincenty algorithm for calcuating distances. Otherwise the faster Haversine formula is used.
|
||||
* @returns The distance between all Locations in a polyline or the perimeter of a ploygon on the surface of a earth in the specifed units.
|
||||
*/
|
||||
export function calculateLength(shape: IPrimitive | IPrimitive[], units ?: DistanceUnits, highAccuracy ?: boolean): number;
|
||||
|
||||
/**
|
||||
* Takes a shape and returns a copy of it that meets the requirements of an SQL Geography type and other OGC compliant systems. Polylines & Polygons can't be self intersecting. For Polygons,
|
||||
* coordinates in an exterior rings have a counter-clockwise orientation, while holes have a clockwise orientation.
|
||||
* @param shape The shape to make valid.
|
||||
* @returns Valiated version of the provided shape. May be a different shape type than what was provided. i.e. A polygon may be broken up into an array of polygons (MultiPolygon).
|
||||
*/
|
||||
export function makeValid(shape: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Calculates the nearest Location objects between to shapes that lie on the shapes.
|
||||
* If the shapes do not overlap, this calculates a location on each shape that is closest to the other shape.
|
||||
* If the shapes overlap, a location that is within the intersection area of the shapes will be added twice to an array, once for each shape, and returned.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns An array of two Location objects that represent the nearest points between two shapes.
|
||||
* The Location objects are in the same order as the input shapes.
|
||||
* Returns null if nearest points were unable to be computed.
|
||||
*/
|
||||
export function nearestLocations(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[]): Location[];
|
||||
|
||||
/**
|
||||
* Reduces the resolution of a shape using the Douglas-Peucker algorithm.
|
||||
* @param shape The shape to reduce the resolution of.
|
||||
* @param tolerance A tolerance distance in meters used by the reduction algorithms.
|
||||
* @returns A version of the specified shape that has been reduced.
|
||||
*/
|
||||
export function reduce(shape: IPrimitive | IPrimitive[], tolerance: number): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Rotates a shape around a given Location for the specified angle of rotation. If an origin is not provided, the centroid of the shape is used.
|
||||
* @param shape The shape to be rotated.
|
||||
* @param angle The amount to rotate the shape in degrees.
|
||||
* @param origin The location to rotate the shape around. Defaults to the centroid of the shape.
|
||||
*/
|
||||
export function rotate(shape: IPrimitive | IPrimitive[], angle: number, origin?: Location): void;
|
||||
|
||||
/**
|
||||
* Calculates the shortest path that between two shapes and returns a Polyline.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @param options A set of polyline options to apply to the generated polyline.
|
||||
* @returns A polyline that represents the shortest path between two shapes.
|
||||
*/
|
||||
export function shortestLineTo(shapeA: Location | IPrimitive | (Location | IPrimitive)[], shapeB: Location | IPrimitive | (Location | IPrimitive)[], options?: IPolylineOptions): Polyline;
|
||||
|
||||
/**
|
||||
* Snaps the locations of one shape that are within the specified tolerance distance away from another shape.
|
||||
* @param locs The locations to snap to the shape.
|
||||
* @param shape The shape to snap the locations to.
|
||||
* @param tolerance A maximum distance (in the specified units) that the snapped location can be from the input location. Default: Infinity
|
||||
* @param toleranceUnits The distance units of the tolerance value. Default: Meters
|
||||
* @returns A snapped location if only one location is provided, otherwise returns an array of snapped locations.
|
||||
*/
|
||||
export function snapLocationsToShape(locs: Location | Location[], shape: IPrimitive | IPrimitive[], tolerance?: number, toleranceUnits?: DistanceUnits): Location | Location[];
|
||||
|
||||
/**
|
||||
* Snaps the locations of one shape that are within the specified tolerance distance away from another shape.
|
||||
* @param shapeToSnap The shape to snap the locations of.
|
||||
* @param shape The shape to snap the locations to.
|
||||
* @param tolerance A maximum distance (in the specified units) that the snapped location can be from the input location. Default: Infinity
|
||||
* @param toleranceUnits The distance units of the tolerance value. Default: Meters
|
||||
*/
|
||||
export function snapShapeToShape(shapeToSnap: IPrimitive | IPrimitive[], shape: IPrimitive | IPrimitive[], tolerance?: number, toleranceUnits?: DistanceUnits): void;
|
||||
|
||||
/**
|
||||
* Returns an object that represents all points that are either in one shape instance or another, but not those points that lie in both instances.
|
||||
* "Sym" stands for Symmetric. symDifference is an OGC standard name for this calculation used in most spatial math libraries, including SQL.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns A shape that represents the symetric difference between two shapes.
|
||||
*/
|
||||
export function symDifference(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Returns an object that represents the union of two shapes. If shapes don't overlap, an array of each individual shapes will be returned.
|
||||
* @param shapeA The first shape.
|
||||
* @param shapeB The second shape.
|
||||
* @returns A shape that represents the union of two shapes.
|
||||
*/
|
||||
export function union(shapeA: IPrimitive | IPrimitive[], shapeB: IPrimitive | IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Performs a union operation on a set of shapes.
|
||||
* If a shape doesn't overlap with the rest, the returned result will be an array of shapes containing this shape and the union of the rest.
|
||||
* @param shapes An array of shapes to union together.
|
||||
* @returns A shape that represents the union of all specified shapes.
|
||||
*/
|
||||
export function unionAggregate(shapes: IPrimitive[]): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Creates a Voronoi diagram from the Location objects of the provided shapes. The diagram is returned as an array of Polygons.
|
||||
* If a clip region is specified, the diagram will be clipped accordingly.
|
||||
* @param shapes Location(s) of shape(s) or Location(s) to generate a Voronoi diagram.
|
||||
* @param clipRegion A region to clip the voronoi diagram to.
|
||||
* @param options A set of polygon options to apply to the generated shape.
|
||||
* @returns An array of polygons that form a Voronoi diagram.
|
||||
*/
|
||||
export function voronoiDiagram(shapes: Location | IPrimitive | (Location | IPrimitive)[], clipRegion?: LocationRect | Polygon, options?: IPolygonOptions): Polygon[];
|
||||
}
|
||||
Vendored
+75
@@ -0,0 +1,75 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="Microsoft.Maps.d.ts"/>
|
||||
|
||||
/**
|
||||
* Adds a traffic incident and flow data to the map.
|
||||
* @requires The Microsoft.Maps.Traffic module.
|
||||
*/
|
||||
declare module Microsoft.Maps.Traffic {
|
||||
/** Options that can be customized in the Traffic manager. */
|
||||
export interface ITrafficOptions {
|
||||
/** Displays the traffic flow layer. */
|
||||
flowVisible?: boolean;
|
||||
|
||||
/** Displays all traffic incidents. */
|
||||
incidentsVisible?: boolean;
|
||||
|
||||
/** Displays the traffic legend. */
|
||||
legendVisible?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the opacity of the traffic flow tile layer. Must be a number between 0 and 1. The default is 1 unless the map
|
||||
* mode is set to lite, in which case the default is set to 0.7.
|
||||
*/
|
||||
opacity?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The TrafficManager class provides the ability to show traffic flow and incident data on top of the map. When creating an
|
||||
* instance of the TrafficManager class the map must be passed as an argument to the constructor.
|
||||
* @requires The Microsoft.Maps.Traffic module.
|
||||
*/
|
||||
export class TrafficManager {
|
||||
/**
|
||||
* @constructor
|
||||
* @requires The Microsoft.Maps.Traffic module.
|
||||
* @param map A map instnce to attach the traffic manager to.
|
||||
*/
|
||||
constructor(map: Map);
|
||||
|
||||
/** Hides all traffic data. */
|
||||
public hide(): void;
|
||||
|
||||
/** Hides the traffic flow layer. */
|
||||
public hideFlow(): void;
|
||||
|
||||
/** Hides all traffic incidents. */
|
||||
public hideIncidents(): void;
|
||||
|
||||
/** Hides the traffic legend. */
|
||||
public hideLegend(): void;
|
||||
|
||||
/**
|
||||
* Sets the options for the traffic manager.
|
||||
* @param options The options for the traffic manager.
|
||||
*/
|
||||
public setOptions(options: ITrafficOptions): void;
|
||||
|
||||
/** Displays all traffic data. */
|
||||
public show(): void;
|
||||
|
||||
/** Displays the traffic flow layer. */
|
||||
public showFlow(): void;
|
||||
|
||||
/** Displays all traffic incidents. */
|
||||
public showIncidents(): void;
|
||||
|
||||
/** Displays the traffic legend. */
|
||||
public showLegend(): void;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,13 @@
|
||||
Microsoft.Maps.AdvancedShapes.d.ts
|
||||
Microsoft.Maps.Directions.d.ts
|
||||
Microsoft.Maps.Search.d.ts
|
||||
Microsoft.Maps.Themes.BingTheme.d.ts
|
||||
Microsoft.Maps.Traffic.d.ts
|
||||
Microsoft.Maps.VenueMaps.d.ts
|
||||
Autosuggest.d.ts
|
||||
Clustering.d.ts
|
||||
Contour.d.ts
|
||||
DataBinning.d.ts
|
||||
Directions.d.ts
|
||||
DrawingTools.d.ts
|
||||
GeoJson.d.ts
|
||||
HeatMapLayer.d.ts
|
||||
Search.d.ts
|
||||
SpatialDataService.d.ts
|
||||
SpatialMath.d.ts
|
||||
Traffic.d.ts
|
||||
WellKnownText.d.ts
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for Microsoft.Maps 8.0 (Change set e6d7cc4)
|
||||
// Project: https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions
|
||||
// Definitions by: Ricky Brundritt <https://github.com/rbrundritt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../Microsoft.Maps.d.ts"/>
|
||||
|
||||
declare module Microsoft.Maps {
|
||||
/**
|
||||
* Class responsible for readon/writing geo data in well known text format
|
||||
* @requires The Microsoft.Maps.WellKnownText module.
|
||||
*/
|
||||
export module WellKnownText {
|
||||
/**
|
||||
* Reads the data in wellknowntext format and returns the shapes. Multi-Geometry type shapes are returned as an array of shapes.
|
||||
* @param wkt The well known text string that needs to be parsed into shapes.
|
||||
* @param styles Styles to apply to the shapes.
|
||||
* @returns One of more shapes.
|
||||
*/
|
||||
export function read(wkt: string, styles?: IStylesOptions): IPrimitive | IPrimitive[];
|
||||
|
||||
/**
|
||||
* Writes the data into wellknowntext format.
|
||||
* @param data The data that needs to be serialized.
|
||||
* @returns Well known text formatted string.
|
||||
*/
|
||||
export function write(data: IPrimitive | IPrimitive[]): string;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace BingMapsTests {
|
||||
|
||||
|
||||
// An interactive set of Bing Maps AJAX control usages can be found at http://www.bingmapsportal.com/isdk/ajaxv7
|
||||
// A full API description can be found at http://msdn.microsoft.com/en-us/library/gg427610.aspx
|
||||
export class TestFixture {
|
||||
@@ -13,27 +13,25 @@ namespace BingMapsTests {
|
||||
mapPositions: Array<Position>,
|
||||
// This will fire if the geolocation fails and will pass the original target (parameter 2)
|
||||
onFailure: (element: HTMLElement) => any) {
|
||||
|
||||
|
||||
var self = this;
|
||||
var map: Microsoft.Maps.Map;
|
||||
|
||||
navigator.geolocation.getCurrentPosition((position: Position) => {
|
||||
|
||||
var locations: Array<Microsoft.Maps.Location> = new Array<Microsoft.Maps.Location>();
|
||||
var options: Microsoft.Maps.MapOptions;
|
||||
var options: Microsoft.Maps.IMapLoadOptions;
|
||||
|
||||
function loadMap() {
|
||||
options = {};
|
||||
options.credentials = bingMapsApiKey;
|
||||
options.enableClickableLogo = false;
|
||||
options.enableSearchLogo = false;
|
||||
options.showDashboard = false;
|
||||
options.showScalebar = false;
|
||||
options.center = self.toLocation(position);
|
||||
options.zoom = 16;
|
||||
options.mapTypeId = Microsoft.Maps.MapTypeId.road;
|
||||
options.height = target.clientHeight;
|
||||
options.width = target.clientWidth;
|
||||
options = {
|
||||
credentials: bingMapsApiKey,
|
||||
enableClickableLogo: false,
|
||||
showDashboard: false,
|
||||
showScalebar: false,
|
||||
center: self.toLocation(position),
|
||||
zoom: 16,
|
||||
mapTypeId: Microsoft.Maps.MapTypeId.road
|
||||
};
|
||||
|
||||
target.innerHTML = "";
|
||||
|
||||
|
||||
Vendored
+2719
-436
File diff suppressed because it is too large
Load Diff
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"bingmaps-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import bigi = require('bigi');
|
||||
import bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
@@ -8,57 +6,57 @@ declare const describe: any;
|
||||
declare const assert: any;
|
||||
|
||||
describe('bitcoinjs-lib (basic)', () => {
|
||||
it('can generate a random bitcoin address', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
it('can generate a random bitcoin address', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
|
||||
// generate random keyPair
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ rng });
|
||||
const address = keyPair.getAddress();
|
||||
// generate random keyPair
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ rng });
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
|
||||
});
|
||||
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
|
||||
});
|
||||
|
||||
it('can generate an address from a SHA256 hash', () => {
|
||||
const hash = bitcoin.crypto.sha256('correct horse battery staple');
|
||||
const d = bigi.fromBuffer(hash);
|
||||
it('can generate an address from a SHA256 hash', () => {
|
||||
const hash = bitcoin.crypto.sha256(Buffer.from('correct horse battery staple', 'utf8'));
|
||||
const d = bigi.fromBuffer(hash);
|
||||
|
||||
const keyPair = new bitcoin.ECPair(d);
|
||||
const address = keyPair.getAddress();
|
||||
const keyPair = new bitcoin.ECPair(d);
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
|
||||
});
|
||||
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
|
||||
});
|
||||
|
||||
it('can generate a random keypair for alternative networks', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
it('can generate a random keypair for alternative networks', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
|
||||
const litecoin = bitcoin.networks.litecoin;
|
||||
const litecoin = bitcoin.networks.litecoin;
|
||||
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
|
||||
const wif = keyPair.toWIF();
|
||||
const address = keyPair.getAddress();
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
|
||||
const wif = keyPair.toWIF();
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
|
||||
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
|
||||
});
|
||||
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
|
||||
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
|
||||
});
|
||||
|
||||
it('can import an address via WIF', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
|
||||
const address = keyPair.getAddress();
|
||||
it('can import an address via WIF', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct', bitcoin.networks.testnet);
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
|
||||
});
|
||||
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
|
||||
});
|
||||
|
||||
it('can create a Transaction', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
|
||||
const tx = new bitcoin.TransactionBuilder();
|
||||
it('can create a Transaction', () => {
|
||||
const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy', bitcoin.networks.testnet);
|
||||
const tx = new bitcoin.TransactionBuilder();
|
||||
|
||||
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
|
||||
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
|
||||
tx.sign(0, keyPair);
|
||||
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
|
||||
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
|
||||
tx.sign(0, keyPair);
|
||||
|
||||
// tslint:disable-next-line:max-line-length
|
||||
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000');
|
||||
});
|
||||
// tslint:disable-next-line:max-line-length
|
||||
assert.strictEqual(tx.build().toHex(), '0100000001313eb630b128102b60241ca895f1d0ffca2170d5a0990e094f2182c102ab94aa000000006b483045022100aefbcf847900b01dd3e3debe054d3b6d03d715d50aea8525f5ea3396f168a1fb022013d181d05b15b90111808b22ef4f9ebe701caf2ab48db269691fdf4e9048f4f60121029f50f51d63b345039a290c94bffd3180c99ed659ff6ea6b1242bca47eb93b59fffffffff01983a0000000000001976a914ad618cf4333b3b248f9744e8e81db2964d0ae39788ac00000000');
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+289
-259
@@ -1,114 +1,238 @@
|
||||
// Type definitions for bitcoinjs-lib 2.3
|
||||
// Project: https://github.com/bitcoinjs/bitcoinjs-lib#readme
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Type definitions for bitcoinjs-lib 3.0
|
||||
// Project: https://github.com/bitcoinjs/bitcoinjs-lib
|
||||
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
|
||||
// Daniel <https://github.com/dlebrecht>
|
||||
// Ron Buckton <https://github.com/rbuckton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Declaration file initially generated by dts-gen for bitcoinjs-lib 3.0.3
|
||||
// based on the flow version found at https://github.com/flowtype/flow-typed/blob/master/definitions/npm/bitcoinjs-lib_v2.x.x/flow_v0.17.x-/bitcoinjs-lib_v2.x.x.js
|
||||
|
||||
export class Block {
|
||||
constructor();
|
||||
checkMerkleRoot(): any;
|
||||
checkProofOfWork(): any;
|
||||
getHash(): any;
|
||||
getId(): any;
|
||||
getUTCDate(): any;
|
||||
toBuffer(headersOnly: any): any;
|
||||
toHex(headersOnly: any): any;
|
||||
static calculateMerkleRoot(transactions: any): any;
|
||||
static calculateTarget(bits: any): any;
|
||||
static fromBuffer(buffer: any): any;
|
||||
static fromHex(hex: any): any;
|
||||
/// <reference types="node" />
|
||||
import BigInteger = require("bigi");
|
||||
|
||||
export interface Utxo {
|
||||
address: string;
|
||||
amount: number;
|
||||
scriptPubKey: Buffer;
|
||||
txid: string;
|
||||
vout: number;
|
||||
}
|
||||
export class ECPair {
|
||||
constructor(d: any, Q?: any, options?: any);
|
||||
getAddress(): string;
|
||||
getNetwork(): Network;
|
||||
getPublicKeyBuffer(): any;
|
||||
sign(hash: any): any;
|
||||
toWIF(): string;
|
||||
verify(hash: any, signature: any): boolean;
|
||||
static fromPublicKeyBuffer(buffer: any, network: Network): ECPair;
|
||||
static fromWIF(string: any, network?: Network): ECPair;
|
||||
static makeRandom(options: any): ECPair;
|
||||
|
||||
export interface Output {
|
||||
script: Buffer;
|
||||
value: number;
|
||||
}
|
||||
export class ECSignature {
|
||||
constructor(r: any, s: any, ...args: any[]);
|
||||
toCompact(i: any, compressed: any): any;
|
||||
toDER(): any;
|
||||
toScriptSignature(hashType: any): any;
|
||||
static fromDER(buffer: any): ECSignature;
|
||||
static parseCompact(buffer: any): ECSignature;
|
||||
static parseScriptSignature(buffer: any): ECSignature;
|
||||
}
|
||||
export class HDNode {
|
||||
constructor(keyPair: any, chainCode: any, ...args: any[]);
|
||||
derive(index: any): any;
|
||||
deriveHardened(index: any): any;
|
||||
derivePath(path: any): any;
|
||||
getAddress(): string;
|
||||
getFingerprint(): any;
|
||||
getIdentifier(): any;
|
||||
getNetwork(): Network;
|
||||
getPublicKeyBuffer(): any;
|
||||
isNeutered(): any;
|
||||
neutered(): any;
|
||||
sign(hash: any): any;
|
||||
toBase58(__isPrivate: any): any;
|
||||
toString(__isPrivate: any): any;
|
||||
verify(hash: any, signature: any): any;
|
||||
static HIGHEST_BIT: number;
|
||||
static LENGTH: number;
|
||||
static fromBase58(string: any, networks: Network[]): HDNode;
|
||||
static fromSeedBuffer(seed: any, network: Network, ...args: any[]): HDNode;
|
||||
static fromSeedHex(hex: any, network: Network): HDNode;
|
||||
}
|
||||
export class Transaction {
|
||||
constructor();
|
||||
addInput(hash: any, index: any, sequence: any, scriptSig: any, ...args: any[]): any;
|
||||
addOutput(scriptPubKey: any, value: any, ...args: any[]): any;
|
||||
byteLength(): number;
|
||||
clone(): Transaction;
|
||||
getHash(): any;
|
||||
getId(): any;
|
||||
hashForSignature(inIndex: any, prevOutScript: any, hashType: any, ...args: any[]): any;
|
||||
isCoinbase(): boolean;
|
||||
setInputScript(index: any, scriptSig: any, ...args: any[]): void;
|
||||
toBuffer(buffer?: any, initialOffset?: any): Buffer;
|
||||
toHex(): string;
|
||||
static DEFAULT_SEQUENCE: number;
|
||||
static SIGHASH_ALL: number;
|
||||
static SIGHASH_ANYONECANPAY: number;
|
||||
static SIGHASH_NONE: number;
|
||||
static SIGHASH_SINGLE: number;
|
||||
static fromBuffer(buffer: any, __noStrict: any): Transaction;
|
||||
static fromHex(hex: any): Transaction;
|
||||
static isCoinbaseHash(buffer: any): Transaction;
|
||||
}
|
||||
export class TransactionBuilder {
|
||||
constructor(network?: Network);
|
||||
addInput(txHash: any, vout: any, sequence?: any, prevOutScript?: any): any;
|
||||
addOutput(scriptPubKey: any, value: any): any;
|
||||
build(): Transaction;
|
||||
buildIncomplete(): Transaction;
|
||||
setLockTime(locktime: number): any;
|
||||
setVersion(version: number): void;
|
||||
sign(index: any, keyPair: any, redeemScript?: any, hashType?: any): any;
|
||||
static fromTransaction(transaction: Transaction, network: Network): TransactionBuilder;
|
||||
|
||||
export interface Input {
|
||||
script: Buffer;
|
||||
hash: Buffer;
|
||||
index: number;
|
||||
sequence: number;
|
||||
}
|
||||
|
||||
export interface Network {
|
||||
bitcoin: {
|
||||
private: number;
|
||||
public: number;
|
||||
};
|
||||
dustThreshold: number;
|
||||
messagePrefix: string;
|
||||
pubKeyHash: number;
|
||||
scriptHash: number;
|
||||
wif: number;
|
||||
bip32: {
|
||||
public: number;
|
||||
private: number;
|
||||
};
|
||||
messagePrefix: string;
|
||||
pubKeyHash: number;
|
||||
scriptHash: number;
|
||||
wif: number;
|
||||
}
|
||||
|
||||
export class Block {
|
||||
constructor();
|
||||
|
||||
byteLength(headersOnly?: boolean): number;
|
||||
|
||||
checkMerkleRoot(): any;
|
||||
|
||||
checkProofOfWork(): any;
|
||||
|
||||
getHash(): Buffer;
|
||||
|
||||
getId(): string;
|
||||
|
||||
getUTCDate(): any;
|
||||
|
||||
toBuffer(headersOnly?: boolean): Buffer;
|
||||
|
||||
toHex(headersOnly?: boolean): string;
|
||||
|
||||
static calculateMerkleRoot(transactions: Transaction[] | Array<{ getHash(): Buffer; }>): Buffer;
|
||||
|
||||
static calculateTarget(bits: number): Buffer;
|
||||
|
||||
static fromBuffer(buffer: Buffer): Block;
|
||||
|
||||
static fromHex(hex: string): Block;
|
||||
}
|
||||
|
||||
export class ECPair {
|
||||
constructor(d: BigInteger, Q?: null | undefined, options?: { compressed?: boolean, network?: Network });
|
||||
|
||||
constructor(d: null | undefined, Q: any, options?: { compressed?: boolean, network?: Network }); // Q should be ECPoint, but not sure how to define such type
|
||||
|
||||
getAddress(): string;
|
||||
|
||||
getNetwork(): Network;
|
||||
|
||||
getPublicKeyBuffer(): Buffer;
|
||||
|
||||
sign(hash: Buffer): Buffer;
|
||||
|
||||
toWIF(): string;
|
||||
|
||||
verify(hash: Buffer, signature: ECSignature): boolean;
|
||||
|
||||
static fromPublicKeyBuffer(buffer: Buffer, network: Network): ECPair;
|
||||
|
||||
static fromWIF(string: string, network: Network): ECPair;
|
||||
|
||||
static makeRandom(options?: { compressed?: boolean, network?: Network, rng?: Rng }): ECPair;
|
||||
}
|
||||
|
||||
export type Rng = (size: number) => Buffer;
|
||||
|
||||
export class ECSignature {
|
||||
constructor(r: BigInteger, s: BigInteger);
|
||||
|
||||
toCompact(i: number, compressed: boolean): Buffer;
|
||||
|
||||
toDER(): Buffer;
|
||||
|
||||
toScriptSignature(hashType: number): Buffer;
|
||||
|
||||
static fromDER(buffer: Buffer): ECSignature;
|
||||
|
||||
static parseCompact(buffer: Buffer): { compressed: boolean, i: number, signature: ECSignature };
|
||||
|
||||
static parseScriptSignature(buffer: Buffer): { signature: ECSignature, hashType: number };
|
||||
}
|
||||
|
||||
export class HDNode {
|
||||
constructor(keyPair: ECPair, chainCode: Buffer);
|
||||
|
||||
keyPair: ECPair;
|
||||
|
||||
derive(index: number): HDNode;
|
||||
|
||||
deriveHardened(index: number): HDNode;
|
||||
|
||||
derivePath(path: string): HDNode;
|
||||
|
||||
getAddress(): string;
|
||||
|
||||
getFingerprint(): Buffer;
|
||||
|
||||
getIdentifier(): Buffer;
|
||||
|
||||
getNetwork(): Network;
|
||||
|
||||
getPublicKeyBuffer(): Buffer;
|
||||
|
||||
isNeutered(): boolean;
|
||||
|
||||
neutered(): HDNode;
|
||||
|
||||
sign(hash: Buffer): ECSignature;
|
||||
|
||||
toBase58(): string;
|
||||
|
||||
verify(hash: Buffer, signature: ECSignature): Buffer;
|
||||
|
||||
static HIGHEST_BIT: number;
|
||||
|
||||
static LENGTH: number;
|
||||
|
||||
static fromBase58(string: string, networks?: Network[] | Network): HDNode;
|
||||
|
||||
static fromSeedBuffer(seed: Buffer, network?: Network): HDNode;
|
||||
|
||||
static fromSeedHex(hex: string, network?: Network): HDNode;
|
||||
|
||||
static MASTER_SECRET: Buffer;
|
||||
}
|
||||
|
||||
export class Transaction {
|
||||
version: number;
|
||||
locktime: number;
|
||||
ins: Input[];
|
||||
outs: Output[];
|
||||
constructor();
|
||||
|
||||
addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer): number;
|
||||
|
||||
addOutput(scriptPubKey: Buffer, value: number): number;
|
||||
|
||||
byteLength(): number;
|
||||
|
||||
clone(): Transaction;
|
||||
|
||||
getHash(): Buffer;
|
||||
|
||||
getId(): string;
|
||||
|
||||
hasWitnesses(): boolean;
|
||||
|
||||
hashForSignature(inIndex: number, prevOutScript: Buffer, hashType: number): Buffer;
|
||||
|
||||
hashForWitnessV0(inIndex: number, prevOutScript: Buffer, value: number, hashType: number): Buffer;
|
||||
|
||||
isCoinbase(): boolean;
|
||||
|
||||
setInputScript(index: number, scriptSig: Buffer): void;
|
||||
|
||||
setWitness(index: number, witness: any, ...args: any[]): void;
|
||||
|
||||
toBuffer(buffer: Buffer, initialOffset?: number): Buffer;
|
||||
|
||||
toHex(): string;
|
||||
|
||||
static ADVANCED_TRANSACTION_FLAG: number;
|
||||
|
||||
static ADVANCED_TRANSACTION_MARKER: number;
|
||||
|
||||
static DEFAULT_SEQUENCE: number;
|
||||
|
||||
static SIGHASH_ALL: number;
|
||||
|
||||
static SIGHASH_ANYONECANPAY: number;
|
||||
|
||||
static SIGHASH_NONE: number;
|
||||
|
||||
static SIGHASH_SINGLE: number;
|
||||
|
||||
static fromBuffer(buffer: Buffer, __noStrict?: boolean): Transaction;
|
||||
|
||||
static fromHex(hex: string): Transaction;
|
||||
|
||||
static isCoinbaseHash(buffer: Buffer): boolean;
|
||||
}
|
||||
|
||||
export class TransactionBuilder {
|
||||
constructor(network?: Network, maximumFeeRate?: number);
|
||||
|
||||
addInput(txhash: Buffer | string | Transaction, vout: number, sequence?: number, prevOutScript?: Buffer): number;
|
||||
|
||||
addOutput(scriptPubKey: Buffer | string, value: number): number;
|
||||
|
||||
build(): Transaction;
|
||||
|
||||
buildIncomplete(): Transaction;
|
||||
|
||||
setLockTime(locktime: number): void;
|
||||
|
||||
setVersion(version: number): void;
|
||||
|
||||
sign(vin: number, keyPair: ECPair, redeemScript?: Buffer, hashType?: number, witnessValue?: number, witnessScript?: Buffer): void;
|
||||
|
||||
static fromTransaction(transaction: Transaction, network: Network): TransactionBuilder;
|
||||
}
|
||||
|
||||
export const networks: {
|
||||
bitcoin: Network;
|
||||
dogecoin: Network;
|
||||
litecoin: Network;
|
||||
testnet: Network;
|
||||
};
|
||||
@@ -232,172 +356,78 @@ export const opcodes: {
|
||||
OP_WITHIN: number;
|
||||
OP_XOR: number;
|
||||
};
|
||||
export namespace HDNode {
|
||||
namespace MASTER_SECRET {
|
||||
const BYTES_PER_ELEMENT: number;
|
||||
const byteLength: number;
|
||||
const byteOffset: number;
|
||||
const length: number;
|
||||
const offset: number;
|
||||
function asciiSlice(): any;
|
||||
function asciiWrite(): any;
|
||||
function base64Slice(): any;
|
||||
function base64Write(): any;
|
||||
function compare(target: any, start: any, end: any, thisStart: any, thisEnd: any): any;
|
||||
function copy(): any;
|
||||
function copyWithin(p0: any, p1: any): any;
|
||||
function entries(): any;
|
||||
function equals(b: any): any;
|
||||
function every(p0: any): any;
|
||||
function fill(val: any, start: any, end: any, encoding: any): any;
|
||||
function filter(p0: any): any;
|
||||
function find(p0: any): any;
|
||||
function findIndex(p0: any): any;
|
||||
function forEach(p0: any): any;
|
||||
function hexSlice(): any;
|
||||
function hexWrite(): any;
|
||||
function includes(val: any, byteOffset: any, encoding: any): any;
|
||||
function indexOf(val: any, byteOffset: any, encoding: any): any;
|
||||
function inspect(): any;
|
||||
function join(p0: any): any;
|
||||
function keys(): any;
|
||||
function lastIndexOf(val: any, byteOffset: any, encoding: any): any;
|
||||
function latin1Slice(): any;
|
||||
function latin1Write(): any;
|
||||
function map(p0: any): any;
|
||||
function readDoubleBE(offset: any, noAssert: any): any;
|
||||
function readDoubleLE(offset: any, noAssert: any): any;
|
||||
function readFloatBE(offset: any, noAssert: any): any;
|
||||
function readFloatLE(offset: any, noAssert: any): any;
|
||||
function readInt16BE(offset: any, noAssert: any): any;
|
||||
function readInt16LE(offset: any, noAssert: any): any;
|
||||
function readInt32BE(offset: any, noAssert: any): any;
|
||||
function readInt32LE(offset: any, noAssert: any): any;
|
||||
function readInt8(offset: any, noAssert: any): any;
|
||||
function readIntBE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readIntLE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readUInt16BE(offset: any, noAssert: any): any;
|
||||
function readUInt16LE(offset: any, noAssert: any): any;
|
||||
function readUInt32BE(offset: any, noAssert: any): any;
|
||||
function readUInt32LE(offset: any, noAssert: any): any;
|
||||
function readUInt8(offset: any, noAssert: any): any;
|
||||
function readUIntBE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function readUIntLE(offset: any, byteLength: any, noAssert: any): any;
|
||||
function reduce(p0: any): any;
|
||||
function reduceRight(p0: any): any;
|
||||
function reverse(): any;
|
||||
function set(p0: any): any;
|
||||
function slice(start: any, end: any): any;
|
||||
function some(p0: any): any;
|
||||
function sort(p0: any): any;
|
||||
function subarray(p0: any, p1: any): any;
|
||||
function swap16(): any;
|
||||
function swap32(): any;
|
||||
function swap64(): any;
|
||||
function toJSON(): any;
|
||||
function toLocaleString(): any;
|
||||
function toString(...args: any[]): any;
|
||||
function ucs2Slice(): any;
|
||||
function ucs2Write(): any;
|
||||
function undefined(): any;
|
||||
function utf8Slice(): any;
|
||||
function utf8Write(): any;
|
||||
function values(): any;
|
||||
function write(string: any, offset: any, length: any, encoding: any): any;
|
||||
function writeDoubleBE(val: any, offset: any, noAssert: any): any;
|
||||
function writeDoubleLE(val: any, offset: any, noAssert: any): any;
|
||||
function writeFloatBE(val: any, offset: any, noAssert: any): any;
|
||||
function writeFloatLE(val: any, offset: any, noAssert: any): any;
|
||||
function writeInt16BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt16LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt32BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt32LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeInt8(value: any, offset: any, noAssert: any): any;
|
||||
function writeIntBE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeIntLE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeUInt16BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt16LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt32BE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt32LE(value: any, offset: any, noAssert: any): any;
|
||||
function writeUInt8(value: any, offset: any, noAssert: any): any;
|
||||
function writeUIntBE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
function writeUIntLE(value: any, offset: any, byteLength: any, noAssert: any): any;
|
||||
namespace buffer {
|
||||
const byteLength: number;
|
||||
function slice(p0: any, p1: any): any;
|
||||
}
|
||||
namespace parent {
|
||||
const byteLength: number;
|
||||
function slice(p0: any, p1: any): any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace address {
|
||||
function fromBase58Check(address: any): any;
|
||||
function fromOutputScript(scriptPubKey: any, network?: Network): any;
|
||||
function toBase58Check(hash: any, version: any, ...args: any[]): any;
|
||||
function toOutputScript(address: any, network?: Network): any;
|
||||
function fromBase58Check(address: string): { hash: Buffer, version: number };
|
||||
|
||||
function fromOutputScript(outputScript: Buffer, network?: Network): { hash: Buffer, version: number };
|
||||
|
||||
function toBase58Check(hash: Buffer, version: number): string;
|
||||
|
||||
function toOutputScript(address: string, network?: Network): string;
|
||||
}
|
||||
|
||||
export namespace bufferutils {
|
||||
function equal(a: any, b: any): any;
|
||||
function pushDataSize(i: any): any;
|
||||
function readPushDataInt(buffer: any, offset: any): any;
|
||||
function readUInt64LE(buffer: any, offset: any): any;
|
||||
function readVarInt(buffer: any, offset: any): any;
|
||||
function reverse(src: any): any;
|
||||
function varIntBuffer(i: any): any;
|
||||
function varIntSize(i: any): any;
|
||||
function writePushDataInt(buffer: any, number: any, offset: any): any;
|
||||
function writeUInt64LE(buffer: any, value: any, offset: any): void;
|
||||
function writeVarInt(buffer: any, number: any, offset: any): any;
|
||||
function pushDataSize(i: number): number;
|
||||
|
||||
function readPushDataInt(buffer: Buffer, offset: number): { opcode: number, number: number, size: number };
|
||||
|
||||
function readUInt64LE(buffer: Buffer, offset: number): number;
|
||||
|
||||
function readVarInt(buffer: Buffer, offset: number): { number: number, size: number };
|
||||
|
||||
function varIntBuffer(number: number, buffer: Buffer, offset: number): Buffer;
|
||||
|
||||
function varIntSize(number: number): number;
|
||||
|
||||
function writePushDataInt(buffer: Buffer, number: number, offset: number): number;
|
||||
|
||||
function writeUInt64LE(buffer: Buffer, value: number, offset: number): number;
|
||||
|
||||
function writeVarInt(buffer: Buffer, number: number, offset: number): number;
|
||||
}
|
||||
|
||||
export namespace crypto {
|
||||
function hash160(buffer: any): any;
|
||||
function hash256(buffer: any): any;
|
||||
function ripemd160(buffer: any): any;
|
||||
function sha1(buffer: any): any;
|
||||
function sha256(buffer: any): any;
|
||||
}
|
||||
export namespace message {
|
||||
function magicHash(message: any, network: any): any;
|
||||
function sign(keyPair: any, message: any, network: any): any;
|
||||
function verify(address: any, signature: any, message: any, network: any): any;
|
||||
function hash160(buffer: Buffer): Buffer;
|
||||
|
||||
function hash256(buffer: Buffer): Buffer;
|
||||
|
||||
function ripemd160(buffer: Buffer): Buffer;
|
||||
|
||||
function sha1(buffer: Buffer): Buffer;
|
||||
|
||||
function sha256(buffer: Buffer): Buffer;
|
||||
}
|
||||
|
||||
export namespace script {
|
||||
function classifyInput(script: any, allowIncomplete: any): any;
|
||||
function classifyOutput(script: any): any;
|
||||
function compile(chunks: any): any;
|
||||
function decompile(buffer: any): any;
|
||||
function fromASM(asm: any): any;
|
||||
function isCanonicalPubKey(buffer: any): any;
|
||||
function isCanonicalSignature(buffer: any): any;
|
||||
function isDefinedHashType(hashType: any): any;
|
||||
function isMultisigInput(script: any, allowIncomplete: any): any;
|
||||
function isMultisigOutput(script: any): any;
|
||||
function isNullDataOutput(script: any): any;
|
||||
function isPubKeyHashInput(script: any): any;
|
||||
function isPubKeyHashOutput(script: any): any;
|
||||
function isPubKeyInput(script: any): any;
|
||||
function isPubKeyOutput(script: any): any;
|
||||
function isScriptHashInput(script: any, allowIncomplete: any): any;
|
||||
function isScriptHashOutput(script: any): any;
|
||||
function isWitnessPubKeyHashOutput(script: any): any;
|
||||
function isWitnessScriptHashOutput(script: any): any;
|
||||
function multisigInput(signatures: any, scriptPubKey: any): any;
|
||||
function multisigOutput(m: any, pubKeys: any, ...args: any[]): any;
|
||||
function nullDataOutput(data: any): any;
|
||||
function pubKeyHashInput(signature: any, pubKey: any, ...args: any[]): any;
|
||||
function pubKeyHashOutput(pubKeyHash: any): any;
|
||||
function pubKeyInput(signature: any): any;
|
||||
function pubKeyOutput(pubKey: any): any;
|
||||
function scriptHashInput(scriptSig: any, scriptPubKey: any): any;
|
||||
function scriptHashOutput(scriptHash: any): any;
|
||||
function toASM(chunks: any): any;
|
||||
function witnessPubKeyHashOutput(pubKeyHash: any): any;
|
||||
function witnessScriptHashInput(scriptSig: any, scriptPubKey: any): any;
|
||||
function witnessScriptHashOutput(scriptHash: any): any;
|
||||
function classifyInput(script: Buffer | Array<Buffer | number>, allowIncomplete: boolean): "pubkeyhash" | "scripthash" | "multisig" | "pubkey" | "nonstandard";
|
||||
|
||||
function classifyOutput(script: Buffer | Array<Buffer | number>): "witnesspubkeyhash" | "witnessscripthash" | "pubkeyhash"
|
||||
| "scripthash" | "multisig" | "pubkey" | "witnesscommitment" | "nulldata" | "nonstandard";
|
||||
|
||||
function classifyWitness(script: Buffer | Array<Buffer | number>, allowIncomplete: boolean): "witnesspubkeyhash" | "witnessscripthash" | "nonstandard";
|
||||
|
||||
function compile(chunks: Array<Buffer | number>): Buffer;
|
||||
|
||||
function decompile(buffer: Buffer): Array<Buffer | number>;
|
||||
|
||||
function fromASM(asm: string): Buffer;
|
||||
|
||||
function isCanonicalPubKey(buffer: Buffer): boolean;
|
||||
|
||||
function isCanonicalSignature(buffer: Buffer): boolean;
|
||||
|
||||
function isDefinedHashType(hashType: any): boolean;
|
||||
|
||||
function isPushOnly(value: any): boolean;
|
||||
|
||||
function toASM(chunks: Buffer | Array<Buffer | number>): string;
|
||||
|
||||
function toStack(chunks: Buffer | Array<Buffer | number>): Buffer[];
|
||||
|
||||
namespace number {
|
||||
function decode(buffer: any, maxLength: any, minimal: any): any;
|
||||
function encode(number: any): any;
|
||||
function decode(buffer: Buffer, maxLength: number, minimal: boolean): number;
|
||||
|
||||
function encode(number: number): Buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"bitcoinjs-lib-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ interface DatepickerOptions {
|
||||
forceParse?: boolean;
|
||||
inputs?: any[];
|
||||
minViewMode?: 0|"days"|1|"months"|2|"years"|3|"decades"|4|"centuries"|"millenium";
|
||||
maxViewMode?: 0|"days"|1|"months"|2|"years"|3|"decades"|4|"centuries"|"millenium";
|
||||
multidate?: boolean|number;
|
||||
multidateSeparator?: string;
|
||||
orientation?: "auto"|"left top"|"left bottom"|"right top"|"right bottom";
|
||||
|
||||
+13
-1
@@ -328,6 +328,18 @@ export interface Datetimepicker {
|
||||
* Usually you should not override those options unless you have a special need in your layout.
|
||||
*/
|
||||
widgetPositioning(value: WidgetPositioningOptions): void;
|
||||
|
||||
/**
|
||||
* JQuery plugin function.
|
||||
* @param {DatetimepickerOptions} options
|
||||
*/
|
||||
(options?: DatetimepickerOptions): JQuery;
|
||||
|
||||
/**
|
||||
* Default options that will be used for all instances.
|
||||
* To change: `$.fn.datetimepicker.defaults`
|
||||
*/
|
||||
defaults: DatetimepickerOptions;
|
||||
}
|
||||
|
||||
export interface DatetimepickerOptions {
|
||||
@@ -581,7 +593,7 @@ export type EventName = "dp.show" | "dp.hide" | "dp.error";
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
datetimepicker(options?: DatetimepickerOptions): JQuery;
|
||||
datetimepicker: Datetimepicker;
|
||||
|
||||
data(key: "DateTimePicker"): Datetimepicker;
|
||||
|
||||
|
||||
Vendored
+1
@@ -119,6 +119,7 @@ interface JQuery {
|
||||
typeahead(options?: TypeaheadOptions): JQuery;
|
||||
|
||||
affix(options?: AffixOptions): JQuery;
|
||||
affix(command: string): JQuery;
|
||||
|
||||
emulateTransitionEnd(duration: number): JQuery;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'browser-report';
|
||||
|
||||
function test_sync() {
|
||||
var browserInfo = window.browserReportSync();
|
||||
console.log(browserInfo.browser.name);
|
||||
}
|
||||
|
||||
function test_async() {
|
||||
window.browserReport((error, result) => {
|
||||
console.log(result.ip + ' ' + result.browser.name);
|
||||
});
|
||||
}
|
||||
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
// Type definitions for browser-report v2.2.9
|
||||
// Project: https://github.com/JTOne123/browser-report
|
||||
// Definitions by: Paul Datsiuk <https://github.com/JTOne123>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Window {
|
||||
browserReport(result: (error: ErrorEvent, report: ReportResult) => any): void;
|
||||
browserReportSync(): ReportResult;
|
||||
}
|
||||
|
||||
interface ReportResult {
|
||||
"browser": {
|
||||
"name": string,
|
||||
"version": string
|
||||
},
|
||||
"cookies": boolean,
|
||||
"flash": {
|
||||
"version": string
|
||||
},
|
||||
"ip": string,
|
||||
"country": {
|
||||
"name": string,
|
||||
"code": string,
|
||||
"city": string,
|
||||
"latitude" : string,
|
||||
"longitude": string,
|
||||
"timezone": string
|
||||
},
|
||||
"java": {
|
||||
"version": string
|
||||
},
|
||||
"lang": Array<string>,
|
||||
"os": {
|
||||
"name": string,
|
||||
"version": string
|
||||
},
|
||||
"screen": {
|
||||
"colors": number,
|
||||
"dppx": number,
|
||||
"height": number,
|
||||
"width": number
|
||||
},
|
||||
"scripts": boolean,
|
||||
"timestamp": string,
|
||||
"userAgent": string,
|
||||
"viewport": {
|
||||
"height": number,
|
||||
"layout": {
|
||||
"height": number,
|
||||
"width": number
|
||||
}
|
||||
"width": number,
|
||||
"zoom": number
|
||||
}
|
||||
"websockets": boolean
|
||||
}
|
||||
@@ -18,6 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"eventemitter2-tests.ts"
|
||||
"browser-report-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
@@ -863,6 +863,7 @@ declare namespace c3 {
|
||||
keys?: { x?: string; value: string[]; }
|
||||
rows?: PrimitiveArray[];
|
||||
columns?: PrimitiveArray[];
|
||||
names?: { [key: string]: string };
|
||||
classes?: { [key: string]: string };
|
||||
categories?: string[];
|
||||
axes?: { [key: string]: string };
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/// <reference types="when" />
|
||||
|
||||
|
||||
import fs = require('fs');
|
||||
import http = require('http');
|
||||
import chai = require('chai');
|
||||
@@ -16,7 +13,7 @@ if (!global.Promise) {
|
||||
chai.request.addPromises(when.promise);
|
||||
}
|
||||
|
||||
var app: http.Server;
|
||||
let app: http.Server;
|
||||
|
||||
chai.request(app).get('/');
|
||||
chai.request('http://localhost:8080').get('/');
|
||||
@@ -58,7 +55,7 @@ chai.request(app)
|
||||
.then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200))
|
||||
.catch((err: any) => { throw err; });
|
||||
|
||||
var agent = chai.request.agent(app);
|
||||
let agent = chai.request.agent(app);
|
||||
|
||||
agent
|
||||
.post('/session')
|
||||
@@ -72,7 +69,7 @@ agent
|
||||
});
|
||||
|
||||
function test1() {
|
||||
var req = chai.request(app).get('/');
|
||||
let req = chai.request(app).get('/');
|
||||
req.then((res: ChaiHttp.Response) => {
|
||||
chai.expect(res).to.have.status(200);
|
||||
chai.expect(res).to.have.header('content-type', 'text/plain');
|
||||
@@ -94,6 +91,7 @@ function test1() {
|
||||
chai.expect(res).to.have.cookie('session_id', '1234');
|
||||
chai.expect(res).to.not.have.cookie('PHPSESSID');
|
||||
chai.expect(res.body).to.have.property('version', '4.0.0');
|
||||
chai.expect(res.text).to.equal('<html><body></body></html>');
|
||||
}, (err: any) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
Vendored
+70
-70
@@ -1,85 +1,85 @@
|
||||
// Type definitions for chai-http
|
||||
// Type definitions for chai-http 3.0
|
||||
// Project: https://github.com/chaijs/chai-http
|
||||
// Definitions by: Wim Looman <https://github.com/Nemo157>
|
||||
// Liam Jones <https://github.com/G1itcher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="chai" />
|
||||
|
||||
declare namespace Chai {
|
||||
declare global {
|
||||
namespace Chai {
|
||||
interface ChaiStatic {
|
||||
request: ChaiHttpRequest;
|
||||
}
|
||||
|
||||
interface ChaiStatic {
|
||||
request: ChaiHttpRequest;
|
||||
interface ChaiHttpRequest {
|
||||
(server: any): ChaiHttp.Agent;
|
||||
agent(server: any): ChaiHttp.Agent;
|
||||
addPromises(promiseConstructor: any): void;
|
||||
}
|
||||
|
||||
interface Assertion {
|
||||
status(code: number): Assertion;
|
||||
header(key: string, value?: string | RegExp): Assertion;
|
||||
headers: Assertion;
|
||||
json: Assertion;
|
||||
text: Assertion;
|
||||
html: Assertion;
|
||||
redirect: Assertion;
|
||||
redirectTo(location: string): Assertion;
|
||||
param(key: string, value?: string): Assertion;
|
||||
cookie(key: string, value?: string): Assertion;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
ip: Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
interface ChaiHttpRequest {
|
||||
(server: any): ChaiHttp.Agent;
|
||||
agent(server: any): ChaiHttp.Agent;
|
||||
addPromises(promiseConstructor: any): void;
|
||||
}
|
||||
namespace ChaiHttp {
|
||||
interface Promise<T> {
|
||||
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise<U>;
|
||||
}
|
||||
|
||||
interface Assertion {
|
||||
status(code: number): Assertion;
|
||||
header(key: string, value?: string): Assertion;
|
||||
header(key: string, value?: RegExp): Assertion;
|
||||
headers: Assertion;
|
||||
json: Assertion;
|
||||
text: Assertion;
|
||||
html: Assertion;
|
||||
redirect: Assertion;
|
||||
redirectTo(location: string): Assertion;
|
||||
param(key: string, value?: string): Assertion;
|
||||
cookie(key: string, value?: string): Assertion;
|
||||
}
|
||||
interface Response {
|
||||
body: any;
|
||||
type: string;
|
||||
status: number;
|
||||
text: string;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
ip: Assertion;
|
||||
interface Request extends FinishedRequest {
|
||||
attach(field: string, file: string|Buffer, filename: string): Request;
|
||||
set(field: string, val: string): Request;
|
||||
query(params: any): Request;
|
||||
send(data: any): Request;
|
||||
auth(user: string, name: string): Request;
|
||||
field(name: string, val: string): Request;
|
||||
buffer(): Request;
|
||||
end(callback?: (err: any, res: Response) => void): FinishedRequest;
|
||||
}
|
||||
|
||||
interface FinishedRequest {
|
||||
then(success?: (res: Response) => void, failure?: (err: any) => void): FinishedRequest;
|
||||
catch(failure?: (err: any) => void): FinishedRequest;
|
||||
}
|
||||
|
||||
interface Agent {
|
||||
get(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
post(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
put(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
head(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
del(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
options(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
patch(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
ip: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace ChaiHttp {
|
||||
interface Promise<T> {
|
||||
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise<U>;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
body: any;
|
||||
type: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
interface Request extends FinishedRequest {
|
||||
attach(field: string, file: string|Buffer, filename: string): Request;
|
||||
set(field: string, val: string): Request;
|
||||
query(params: Object): Request;
|
||||
send(data: Object): Request;
|
||||
auth(user: string, name: string): Request;
|
||||
field(name: string, val: string): Request;
|
||||
buffer(): Request;
|
||||
end(callback?: (err: any, res: Response) => void): FinishedRequest;
|
||||
}
|
||||
|
||||
interface FinishedRequest {
|
||||
then(success?: (res: Response) => void, failure?: (err: any) => void): FinishedRequest;
|
||||
catch(failure?: (err: any) => void): FinishedRequest;
|
||||
}
|
||||
|
||||
interface Agent {
|
||||
get(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
post(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
put(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
head(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
del(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
options(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
patch(url: string, callback?: (err: any, res: Response) => void): Request;
|
||||
}
|
||||
|
||||
interface TypeComparison {
|
||||
ip: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "chai-http" {
|
||||
function chaiHttp(chai: any, utils: any): void;
|
||||
export = chaiHttp;
|
||||
}
|
||||
declare function chaiHttp(chai: any, utils: any): void;
|
||||
export = chaiHttp;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -18,11 +18,36 @@ let chart: Chart = new Chart(new CanvasRenderingContext2D(), {
|
||||
]
|
||||
},
|
||||
options: {
|
||||
hover: {
|
||||
intersect: true
|
||||
},
|
||||
tooltips: {
|
||||
filter: data => Number(data.yLabel) > 0,
|
||||
intersect: true,
|
||||
itemSort: (a, b) => Math.random() - 0.5,
|
||||
position: "average",
|
||||
caretPadding: 2,
|
||||
displayColors: true,
|
||||
borderColor: "rgba(0,0,0,0)",
|
||||
borderWidth: 1,
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
ticks: {
|
||||
callback: Math.floor
|
||||
},
|
||||
gridLines: { display: false }
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
chart.update();
|
||||
|
||||
console.log(chart.ctx && chart.ctx.font);
|
||||
console.log(chart.canvas && chart.canvas.tagName);
|
||||
if (chart.chartArea) {
|
||||
console.log(chart.chartArea.top);
|
||||
console.log(chart.chartArea.right);
|
||||
console.log(chart.chartArea.bottom);
|
||||
console.log(chart.chartArea.left);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user