diff --git a/.gitattributes b/.gitattributes
index dfe0770424..ac1e451d56 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,7 @@
# Auto detect text files and perform LF normalization
* text=auto
+
+# Checkout NPM package files with forced LF lineendings
+# to prevent git conflicts when running npm commands
+package.json text eol=lf
+package-lock.json text eol=lf
diff --git a/notNeededPackages.json b/notNeededPackages.json
index 8c587f7c43..5c649d2368 100644
--- a/notNeededPackages.json
+++ b/notNeededPackages.json
@@ -174,7 +174,7 @@
"sourceRepoURL": "https://github.com/MikeMcl/bignumber.js/",
"asOfVersion": "5.0.0"
},
- {
+ {
"libraryName": "bingmaps",
"typingsPackageName": "bingmaps",
"sourceRepoURL": "https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions",
@@ -234,6 +234,12 @@
"sourceRepoURL": "https://github.com/saltyrtc/chunked-dc-js",
"asOfVersion": "0.2.2"
},
+ {
+ "libraryName": "colors.js (colors)",
+ "typingsPackageName": "colors",
+ "sourceRepoURL": "https://github.com/Marak/colors.js",
+ "asOfVersion": "1.2.1"
+ },
{
"libraryName": "commander",
"typingsPackageName": "commander",
diff --git a/types/adone/adone.d.ts b/types/adone/adone.d.ts
index 91ebc4db7c..d4e8b67b7b 100644
--- a/types/adone/adone.d.ts
+++ b/types/adone/adone.d.ts
@@ -1,4 +1,6 @@
///
+///
+///
declare namespace adone {
const _null: symbol;
@@ -104,4 +106,8 @@ declare namespace adone {
export const expect: assertion.I.ExpectFunction;
export const std: typeof nodestd;
+
+ export const lodash: _.LoDashStatic;
+
+ export const benchmark: typeof tbenchmark;
}
diff --git a/types/adone/benchmark.d.ts b/types/adone/benchmark.d.ts
new file mode 100644
index 0000000000..042e1ae62c
--- /dev/null
+++ b/types/adone/benchmark.d.ts
@@ -0,0 +1,5 @@
+import Benchmark = require("benchmark");
+
+export { Benchmark };
+
+export as namespace tbenchmark;
diff --git a/types/adone/glosses/fs.d.ts b/types/adone/glosses/fs.d.ts
index 7517764faf..2afc6ec8f7 100644
--- a/types/adone/glosses/fs.d.ts
+++ b/types/adone/glosses/fs.d.ts
@@ -1158,37 +1158,35 @@ declare namespace adone {
*/
function watch(paths: string | string[], options?: I.Watcher.ConstructorOptions): Watcher;
- namespace is {
- /**
- * Returns true if the given path refers to a file
- */
- function file(path: string): Promise;
+ /**
+ * Returns true if the given path refers to a file
+ */
+ function isFile(path: string): Promise;
- /**
- * Returns true if the given path refers to a file
- */
- function fileSync(path: string): boolean;
+ /**
+ * Returns true if the given path refers to a file
+ */
+ function isFileSync(path: string): boolean;
- /**
- * Returns true if the given path refers to a direcotry
- */
- function directory(path: string): Promise;
+ /**
+ * Returns true if the given path refers to a direcotry
+ */
+ function isDirectory(path: string): Promise;
- /**
- * Returns true if the given path refers to a direcotry
- */
- function directorySync(path: string): boolean;
+ /**
+ * Returns true if the given path refers to a direcotry
+ */
+ function isDirectorySync(path: string): boolean;
- /**
- * Returns true if the given path refers to an executable file
- */
- function executable(path: string): Promise;
+ /**
+ * Returns true if the given path refers to an executable file
+ */
+ function isExecutable(path: string): Promise;
- /**
- * Returns true if the given path refers to an executable file
- */
- function executableSync(path: string): boolean;
- }
+ /**
+ * Returns true if the given path refers to an executable file
+ */
+ function isExecutableSync(path: string): boolean;
namespace I.Which {
interface Options {
@@ -1920,5 +1918,19 @@ declare namespace adone {
* Creates a new TailWatcher instance with the given arguments
*/
function watchTail(filename: string, options?: I.TailWatcher.ConstructorOptions): TailWatcher;
+
+ namespace I {
+ interface WriteFileAtomicOptions {
+ chown?: {
+ gid?: number;
+ uid?: number;
+ };
+ encoding?: string | null;
+ fsync?: boolean;
+ mode?: number;
+ }
+ }
+
+ function writeFileAtomic(filename: string, data: Buffer | string | Uint8Array, options?: I.WriteFileAtomicOptions): Promise;
}
}
diff --git a/types/adone/glosses/is.d.ts b/types/adone/glosses/is.d.ts
index 20d898ca7b..d112d3f109 100644
--- a/types/adone/glosses/is.d.ts
+++ b/types/adone/glosses/is.d.ts
@@ -676,5 +676,9 @@ declare namespace adone {
export function emitter(obj: any): obj is event.Emitter;
export function asyncEmitter(obj: any): obj is event.AsyncEmitter;
+
+ export const openbsd: boolean;
+
+ export const aix: boolean;
}
}
diff --git a/types/adone/test/glosses/fs.ts b/types/adone/test/glosses/fs.ts
index e7c5333624..86236038a0 100644
--- a/types/adone/test/glosses/fs.ts
+++ b/types/adone/test/glosses/fs.ts
@@ -602,13 +602,12 @@ namespace fsTests {
}
namespace isTests {
- const { is } = fs;
- is.file("hello").then((x: boolean) => {});
- { const a: boolean = is.fileSync("hello"); }
- is.directory("hello").then((x: boolean) => {});
- { const a: boolean = is.directorySync("hello"); }
- is.executable("hello").then((x: boolean) => {});
- { const a: boolean = is.executableSync("hello"); }
+ fs.isFile("hello").then((x: boolean) => {});
+ { const a: boolean = fs.isFileSync("hello"); }
+ fs.isDirectory("hello").then((x: boolean) => {});
+ { const a: boolean = fs.isDirectorySync("hello"); }
+ fs.isExecutable("hello").then((x: boolean) => {});
+ { const a: boolean = fs.isExecutableSync("hello"); }
}
namespace whichTests {
@@ -944,4 +943,17 @@ namespace fsTests {
fs.watchTail("file", { separator: /\n/ });
fs.watchTail("file", { useWatchFile: true });
}
+
+ namespace writeFileAtomicTests {
+ fs.writeFileAtomic("a", "b").then(() => {});
+ fs.writeFileAtomic("a", Buffer.from("b")).then(() => {});
+ fs.writeFileAtomic("a", new Uint8Array(10)).then(() => {});
+ fs.writeFileAtomic("a", "a", {}).then(() => {});
+ fs.writeFileAtomic("a", "a", { chown: {} }).then(() => {});
+ fs.writeFileAtomic("a", "a", { chown: { gid: 0 } }).then(() => {});
+ fs.writeFileAtomic("a", "a", { chown: { uid: 0 } }).then(() => {});
+ fs.writeFileAtomic("a", "a", { encoding: "utf8" }).then(() => {});
+ fs.writeFileAtomic("a", "a", { fsync: false }).then(() => {});
+ fs.writeFileAtomic("a", "a", { mode: 0o666 }).then(() => {});
+ }
}
diff --git a/types/adone/test/glosses/is.ts b/types/adone/test/glosses/is.ts
index 045818f0ec..455dd745da 100644
--- a/types/adone/test/glosses/is.ts
+++ b/types/adone/test/glosses/is.ts
@@ -336,6 +336,8 @@ namespace isTests {
{ const a: boolean = is.freebsd; }
{ const a: boolean = is.darwin; }
{ const a: boolean = is.sunos; }
+ { const a: boolean = is.openbsd; }
+ { const a: boolean = is.aix; }
{ const a: boolean = is.uppercase("abc"); }
{ const a: boolean = is.lowercase("abc"); }
{ const a: boolean = is.digits("012"); }
diff --git a/types/adone/test/index.ts b/types/adone/test/index.ts
index ac012b9535..aec454539b 100644
--- a/types/adone/test/index.ts
+++ b/types/adone/test/index.ts
@@ -54,4 +54,15 @@ namespace AdoneRootTests {
obj = adone.package;
{ const a: typeof adone.assertion.assert = adone.assert; }
{ const a: typeof adone.assertion.expect = adone.expect; }
+
+ namespace lodashTests {
+ adone.lodash.get({}, "a");
+ adone.lodash.defaults({}, {});
+ adone.lodash.zip([]);
+ }
+
+ namespace benchmarkTests {
+ const b = new adone.benchmark.Benchmark.Suite();
+ b.add(() => {}).add("", () => {}).run();
+ }
}
diff --git a/types/adone/tsconfig.json b/types/adone/tsconfig.json
index 6e6b3fe1c3..6a1af264a3 100644
--- a/types/adone/tsconfig.json
+++ b/types/adone/tsconfig.json
@@ -22,6 +22,7 @@
"files": [
"adone-tests.ts",
"adone.d.ts",
+ "benchmark.d.ts",
"glosses/archives.d.ts",
"glosses/assertion.d.ts",
"glosses/collections/array_set.d.ts",
diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts
index 752d9cc944..dbb1df1de7 100644
--- a/types/archiver/archiver-tests.ts
+++ b/types/archiver/archiver-tests.ts
@@ -64,6 +64,6 @@ archiver.setModule(() => {});
archiver.pointer();
archiver.use(() => {});
-archiver.finalize().then();
+archiver.finalize();
archiver.symlink('./path', './target');
diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts
index df15f9ff65..d33e8ec6dd 100644
--- a/types/archiver/index.d.ts
+++ b/types/archiver/index.d.ts
@@ -35,7 +35,7 @@ declare namespace archiver {
directory(dirpath: string, destpath: false | string, data?: EntryData | EntryDataFunction): this;
file(filename: string, data: EntryData): this;
glob(pattern: string, options?: glob.IOptions, data?: EntryData): this;
- finalize(): Promise;
+ finalize(): void;
setFormat(format: string): this;
setModule(module: Function): this;
diff --git a/types/atmosphere.js/index.d.ts b/types/atmosphere.js/index.d.ts
index 0c0bfa3c3a..48314cfdea 100644
--- a/types/atmosphere.js/index.d.ts
+++ b/types/atmosphere.js/index.d.ts
@@ -2,6 +2,7 @@
// Project: https://github.com/Atmosphere/atmosphere-javascript
// Definitions by: Kai Toedter
// Fedor Kirpichev
+// Jorge Beltran
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Use this typings in future instead of deprecated 'atmosphere'.
@@ -65,6 +66,7 @@ declare namespace Atmosphere {
maxReconnectOnClose?: number;
enableProtocol?: boolean;
pollingInterval?: number;
+ webSocketUrl?: string;
onError?: (response?:Response) => void;
onClose?: (response?:Response) => void;
diff --git a/types/auth0-lock/index.d.ts b/types/auth0-lock/index.d.ts
index 7dd99af9e6..dd3e6aa7ee 100644
--- a/types/auth0-lock/index.d.ts
+++ b/types/auth0-lock/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for auth0-lock 10.16
+// Type definitions for auth0-lock 11.4
// Project: http://auth0.com
// Definitions by: Brian Caruso
// Dan Caddigan
@@ -143,6 +143,7 @@ interface Auth0LockConstructorOptions {
socialButtonStyle?: "big" | "small";
theme?: Auth0LockThemeOptions;
usernameStyle?: string;
+ _enableImpersonation?: boolean;
}
interface Auth0LockFlashMessageOptions {
diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts
index eccc96ba3e..5802913c37 100644
--- a/types/aws-lambda/index.d.ts
+++ b/types/aws-lambda/index.d.ts
@@ -90,7 +90,7 @@ export interface AttributeValue {
// Context
// http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html
export interface StreamRecord {
- ApproximateCreationTime?: number;
+ ApproximateCreationDateTime?: number;
Keys?: { [key: string]: AttributeValue };
NewImage?: { [key: string]: AttributeValue };
OldImage?: { [key: string]: AttributeValue };
diff --git a/types/azure-sb/azure-sb-tests.ts b/types/azure-sb/azure-sb-tests.ts
index 411862a3b2..14d2ba9054 100644
--- a/types/azure-sb/azure-sb-tests.ts
+++ b/types/azure-sb/azure-sb-tests.ts
@@ -14,14 +14,14 @@ function ResponseCallback(err: Error | null, response: Azure.ServiceBus.Response
const ServiceBus = AzureSB.createServiceBusService('connectionstring');
// Queues
-ServiceBus.listQueues('', createResultCallback());
+ServiceBus.listQueues(createResultCallback());
ServiceBus.createQueue('test', createResultCallback());
ServiceBus.createQueueIfNotExists('test', createResultCallback());
ServiceBus.getQueue('test', createResultCallback());
ServiceBus.deleteQueue('test', ResponseCallback);
// Topics
-ServiceBus.listTopics('', createResultCallback());
+ServiceBus.listTopics(createResultCallback());
ServiceBus.createTopic('test', createResultCallback());
ServiceBus.createTopicIfNotExists('test', createResultCallback());
ServiceBus.getTopic('test', createResultCallback());
diff --git a/types/azure-sb/index.d.ts b/types/azure-sb/index.d.ts
index ba92395c0f..9f9d07d3dc 100644
--- a/types/azure-sb/index.d.ts
+++ b/types/azure-sb/index.d.ts
@@ -214,15 +214,15 @@ export namespace Azure.ServiceBus {
// [x: string]: string | Dictionary;
// }
+ export const ActiveMessageCount = 'd2p1:ActiveMessageCount';
+ export const DeadLetterMessageCount = 'd2p1:DeadLetterMessageCount';
+ export const ScheduledMessageCount = 'd2p1:ScheduledMessageCount';
+ export const TransferMessageCount = 'd2p1:TransferMessageCount';
+ export const TransferDeadLetterMessageCount = 'd2p1:TransferDeadLetterMessageCount';
+
export interface Topic extends ExtendedBase {
AccessedAt: DateString;
- CountDetails: {
- 'd2p1:ActiveMessageCount': string;
- 'd2p1:DeadLetterMessageCount': string;
- 'd2p1:ScheduledMessageCount': string;
- 'd2p1:TransferMessageCount': string;
- 'd2p1:TransferDeadLetterMessageCount': string;
- };
+ CountDetails: { [key: string]: string };
EnableSubscriptionPartitioning: string;
FilteringMessagesBeforePublishing: string;
IsExpress: string;
@@ -242,13 +242,7 @@ export namespace Azure.ServiceBus {
}
export interface Subscription extends ExtendedBase {
- CountDetails: {
- 'd3p1:ActiveMessageCount': string;
- 'd3p1:DeadLetterMessageCount': string;
- 'd3p1:ScheduledMessageCount': string;
- 'd3p1:TransferMessageCount': string;
- 'd3p1:TransferDeadLetterMessageCount': string;
- };
+ CountDetails: { [key: string]: string };
DeadLetteringOnFilterEvaluationExceptions: string;
DeadLetteringOnMessageExpiration: string;
LockDuration: string;
@@ -315,6 +309,8 @@ export namespace Azure.ServiceBus {
export type CreateSubscriptionOptions = Partial;
export type ListSubscriptionsOptions = Partial;
export type ListRulesOptions = Partial;
+ export type ListTopicsOptions = Partial;
+ export type ListQueuesOptions = Partial;
export type CreateRuleOptions = Partial;
export type CreateNotificationHubOptions = Partial;
export type ListNotificationHubsOptions = Partial;
diff --git a/types/azure-sb/lib/servicebusservice.d.ts b/types/azure-sb/lib/servicebusservice.d.ts
index 44f2b2c522..45600a1661 100644
--- a/types/azure-sb/lib/servicebusservice.d.ts
+++ b/types/azure-sb/lib/servicebusservice.d.ts
@@ -11,6 +11,8 @@ import CreateTopicOptions = Azure.ServiceBus.CreateTopicOptions;
import ListNotificationHubsOptions = Azure.ServiceBus.ListNotificationHubsOptions;
import ListRulesOptions = Azure.ServiceBus.ListRulesOptions;
import ListSubscriptionsOptions = Azure.ServiceBus.ListSubscriptionsOptions;
+import ListTopicsOptions = Azure.ServiceBus.ListTopicsOptions;
+import ListQueuesOptions = Azure.ServiceBus.ListQueuesOptions;
import MessageOrName = Azure.ServiceBus.MessageOrName;
import Queue = Azure.ServiceBus.Results.Models.Queue;
import ReceiveQueueMessageOptions = Azure.ServiceBus.ReceiveQueueMessageOptions;
@@ -88,7 +90,8 @@ declare class ServiceBusService extends ServiceBusServiceBase {
public getQueue(queuePath: string,
callback: TypedResultAndResponseCallback): void;
- public listQueues(queuePath: string,
+ public listQueues(callback: TypedResultAndResponseCallback): void;
+ public listQueues(options: ListQueuesOptions,
callback: TypedResultAndResponseCallback): void;
/*
@@ -115,7 +118,8 @@ declare class ServiceBusService extends ServiceBusServiceBase {
public getTopic(topicPath: string,
callback: TypedResultAndResponseCallback): void;
- public listTopics(topicPath: string,
+ public listTopics(callback: TypedResultAndResponseCallback): void;
+ public listTopics(options: ListTopicsOptions,
callback: TypedResultAndResponseCallback): void;
/*
diff --git a/types/azure-sb/lib/servicebusserviceclient.d.ts b/types/azure-sb/lib/servicebusserviceclient.d.ts
index c97b1e3107..1730b642c3 100644
--- a/types/azure-sb/lib/servicebusserviceclient.d.ts
+++ b/types/azure-sb/lib/servicebusserviceclient.d.ts
@@ -1,14 +1,13 @@
-///
-import EventEmitter = NodeJS.EventEmitter;
+import ServiceClient = require('azure-sb/lib/serviceclient');
-declare class ServiceBusServiceClient extends EventEmitter {
+declare class ServiceBusServiceClient extends ServiceClient {
constructor(accessKey?: string,
issuer?: string,
sharedAccessKeyName?: string,
sharedAccessKeyValue?: string,
host?: string,
acsHost?: string,
- authenticationProvider?: object);
+ authenticationProvider?: object);
}
export = ServiceBusServiceClient;
diff --git a/types/azure-sb/lib/serviceclient.d.ts b/types/azure-sb/lib/serviceclient.d.ts
new file mode 100644
index 0000000000..3e39052235
--- /dev/null
+++ b/types/azure-sb/lib/serviceclient.d.ts
@@ -0,0 +1,8 @@
+///
+import EventEmitter = NodeJS.EventEmitter;
+declare class ServiceClient extends EventEmitter {
+ public host: string;
+ public port: number;
+ public protocol: string;
+}
+export = ServiceClient;
diff --git a/types/azure-sb/tsconfig.json b/types/azure-sb/tsconfig.json
index 6e015480dc..61e37ac754 100644
--- a/types/azure-sb/tsconfig.json
+++ b/types/azure-sb/tsconfig.json
@@ -30,6 +30,7 @@
"lib/models/subscriptionresult.d.ts",
"lib/models/notificationhubresult.d.ts",
"lib/models/resourceresult.d.ts",
+ "lib/serviceclient.d.ts",
"lib/servicebusserviceclient.d.ts",
"lib/gcmservice.d.ts",
"lib/wnsservice.d.ts",
@@ -38,4 +39,4 @@
"azure-sb-tests.ts",
"index.d.ts"
]
-}
\ No newline at end of file
+}
diff --git a/types/backbone.marionette/index.d.ts b/types/backbone.marionette/index.d.ts
index cd8ccd3821..7626d60d56 100644
--- a/types/backbone.marionette/index.d.ts
+++ b/types/backbone.marionette/index.d.ts
@@ -1,6 +1,9 @@
// Type definitions for Marionette 3.3
// Project: https://github.com/marionettejs/
-// Definitions by: Zeeshan Hamid , Natan Vivo , Sven Tschui
+// Definitions by: Zeeshan Hamid ,
+// Natan Vivo ,
+// Sven Tschui ,
+// Volker Nauruhn
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -1394,27 +1397,27 @@ export class CollectionView, childView: TView): void;
/**
* This callback function allows you to know when a child / child view
* instance has been added to the collection view. It provides access to
* the view instance for the child that was added.
*/
- onAddChild(childView: TView): void;
+ onAddChild(collectionView: CollectionView, childView: TView): void;
/**
* This callback function allows you to know when a childView instance is
* about to be removed from the collectionView. It provides access to the
* view instance for the child that was removed.
*/
- onBeforeRemoveChild(childView: TView): void;
+ onBeforeRemoveChild(collectionView: CollectionView, childView: TView): void;
/**
* This callback function allows you to know when a child / childView
* instance has been deleted or removed from the collection.
*/
- onRemoveChild(childView: TView): void;
+ onRemoveChild(collectionView: CollectionView, childView: TView): void;
/**
* Automatically destroys this Collection's children and cleans up
diff --git a/types/base64-url/base64-url-tests.ts b/types/base64-url/base64-url-tests.ts
new file mode 100644
index 0000000000..fd5c07cac0
--- /dev/null
+++ b/types/base64-url/base64-url-tests.ts
@@ -0,0 +1,9 @@
+import * as base64url from 'base64-url';
+
+base64url.encode('Node.js is awesome.'); // $ExpectType string
+base64url.decode('Tm9kZS5qcyBpcyBhd2Vzb21lLg'); // $ExpectType string
+base64url.escape('This+is/goingto+escape=='); // $ExpectType string
+base64url.unescape('This-is_goingto-escape'); // $ExpectType string
+
+base64url.encode('string to encode', 'ascii'); // $ExpectType string
+base64url.decode('string to decode', 'ascii'); // $ExpectType string
diff --git a/types/base64-url/index.d.ts b/types/base64-url/index.d.ts
new file mode 100644
index 0000000000..1065cb9115
--- /dev/null
+++ b/types/base64-url/index.d.ts
@@ -0,0 +1,9 @@
+// Type definitions for base64-url 2.2
+// Project: https://github.com/joaquimserafim/base64-url
+// Definitions by: Uri Shaked
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export function decode(value: string, encoding?: string): string;
+export function encode(value: string, encoding?: string): string;
+export function escape(value: string): string;
+export function unescape(value: string): string;
diff --git a/types/base64-url/tsconfig.json b/types/base64-url/tsconfig.json
new file mode 100644
index 0000000000..26ccd93511
--- /dev/null
+++ b/types/base64-url/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "base64-url-tests.ts"
+ ]
+}
diff --git a/types/colors/tslint.json b/types/base64-url/tslint.json
similarity index 100%
rename from types/colors/tslint.json
rename to types/base64-url/tslint.json
diff --git a/types/bigi/bigi-tests.ts b/types/bigi/bigi-tests.ts
index ef9d7421d3..0e4822aeb6 100644
--- a/types/bigi/bigi-tests.ts
+++ b/types/bigi/bigi-tests.ts
@@ -7,3 +7,10 @@ const b3 = b1.multiply(b2);
console.log(b3.toHex());
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
+
+const b4 = BigInteger.valueOf(42);
+const b5 = BigInteger.valueOf(10);
+const b6 = b4.multiply(b5);
+
+console.log(b6);
+// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 }
diff --git a/types/bigi/index.d.ts b/types/bigi/index.d.ts
index c991b13fac..7b44ff75e4 100644
--- a/types/bigi/index.d.ts
+++ b/types/bigi/index.d.ts
@@ -87,7 +87,7 @@ declare class bigi {
static fromDERInteger(byteArray?: any): number;
static fromHex(hex: string): bigi;
static isBigInteger(obj: any, check_ver: any): obj is bigi;
- static valueOf(i: any): number;
+ static valueOf(i: any): bigi;
}
declare namespace bigi {
interface Constants {
diff --git a/types/bintrees/bintrees-tests.ts b/types/bintrees/bintrees-tests.ts
index fb4a22a3d8..84b75c98be 100644
--- a/types/bintrees/bintrees-tests.ts
+++ b/types/bintrees/bintrees-tests.ts
@@ -1,8 +1,11 @@
-///
///
import assert = require('assert');
import { BinTree, RBTree } from 'bintrees';
+// Declaring shims removes mocha dependency. These tests are never executed, only typechecked, so this is fine.
+declare function describe(description: string, callback: () => void): void;
+declare function it(description: string, callback: () => void): void;
+
describe('bintrees', () => {
it('builds a simple tree', () => {
let treeA = new RBTree((a: number, b: number) => a - b);
diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts
index 11d311a276..920df43d6e 100644
--- a/types/bitcoinjs-lib/index.d.ts
+++ b/types/bitcoinjs-lib/index.d.ts
@@ -71,6 +71,10 @@ export class ECPair {
d: BigInteger;
+ readonly compressed: boolean;
+
+ readonly network: Network;
+
getAddress(): string;
getNetwork(): Network;
diff --git a/types/bytebuffer/index.d.ts b/types/bytebuffer/index.d.ts
index 0ed98f54c6..285948dc24 100644
--- a/types/bytebuffer/index.d.ts
+++ b/types/bytebuffer/index.d.ts
@@ -4,6 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions by: SINTEF-9012
+///
import Long = require("long");
declare namespace ByteBuffer {}
@@ -70,7 +71,7 @@ declare class ByteBuffer
/**
* Backing buffer.
*/
- buffer: ArrayBuffer;
+ buffer: Buffer;
/**
* Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
@@ -135,12 +136,12 @@ declare class ByteBuffer
/**
* Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
*/
- static calculateVariant32( value: number ): number;
+ static calculateVarint32( value: number ): number;
/**
* Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
*/
- static calculateVariant64( value: number | Long ): number;
+ static calculateVarint64( value: number | Long ): number;
/**
* Concatenates multiple ByteBuffers into one.
@@ -340,7 +341,7 @@ declare class ByteBuffer
/**
* Reads a length as uint32 prefixed UTF8 encoded string.
*/
- readIString( offset?: number ): string;
+ readIString( offset?: number ): string | { string: string; length: number };
/**
* Reads a 32bit signed integer.This is an alias of ByteBuffer#readInt32.
@@ -385,7 +386,7 @@ declare class ByteBuffer
/**
* Reads an UTF8 encoded string.
*/
- readUTF8String( chars: number, offset?: number ): string;
+ readUTF8String( chars: number, metrics?: number, offset?: number ): string | { string: string; length: number };
/**
* Reads a 16bit unsigned integer.
diff --git a/types/c3/index.d.ts b/types/c3/index.d.ts
index 28f301237c..a1dfaaf8f0 100644
--- a/types/c3/index.d.ts
+++ b/types/c3/index.d.ts
@@ -1,11 +1,11 @@
-// Type definitions for C3js 0.4
+// Type definitions for C3js 0.5
// Project: http://c3js.org/
// Definitions by: Marc Climent
// Gerin Jacob
// Bernd Hacker
// Dzmitry Shyndzin
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-// TypeScript Version: 2.1
+// TypeScript Version: 2.3
import * as d3 from "d3";
@@ -28,7 +28,7 @@ export interface ChartConfiguration {
* Note: When chart is not binded, c3 starts observing if chart.element is binded by MutationObserver. In this case, polyfill is required in IE9 and IE10 becuase they do not support
* MutationObserver. On the other hand, if chart always will be binded, polyfill will not be required because MutationObserver will never be called.
*/
- bindto?: string | HTMLElement | d3.Selection | null;
+ bindto?: string | HTMLElement | d3.Selection | null;
size?: {
/**
* The desired width of the chart element.
@@ -172,16 +172,18 @@ export interface ChartConfiguration {
/**
* Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
*/
- width?: number | {
- /**
- * Set the width of each bar by ratio
- */
- ratio: number,
- /**
- * Set max width of each bar
- */
- max?: number
- };
+ width?:
+ | number
+ | {
+ /**
+ * Set the width of each bar by ratio
+ */
+ ratio: number;
+ /**
+ * Set max width of each bar
+ */
+ max?: number;
+ };
/**
* Set if min or max value will be 0 on bar chart.
*/
@@ -205,7 +207,7 @@ export interface ChartConfiguration {
/**
* Set threshold to show/hide labels.
*/
- threshold?: number
+ threshold?: number;
};
/**
* Enable or disable expanding pie pieces.
@@ -226,7 +228,7 @@ export interface ChartConfiguration {
/**
* Set threshold to show/hide labels.
*/
- threshold?: number
+ threshold?: number;
};
/**
* Enable or disable expanding pie pieces.
@@ -280,7 +282,17 @@ export interface ChartConfiguration {
/**
* Set custom spline interpolation
*/
- type?: 'linear' | 'linear-closed' | 'basis' | 'basis-open' | 'basis-closed' | 'bundle' | 'cardinal' | 'cardinal-open' | 'cardinal-closed' | 'monotone';
+ type?:
+ | "linear"
+ | "linear-closed"
+ | "basis"
+ | "basis-open"
+ | "basis-closed"
+ | "bundle"
+ | "cardinal"
+ | "cardinal-open"
+ | "cardinal-closed"
+ | "monotone";
};
};
}
@@ -309,7 +321,7 @@ export interface Data {
/**
* Choose which JSON object keys correspond to desired data.
*/
- keys?: { x?: string; value: string[]; };
+ keys?: { x?: string; value: string[] };
/**
* Specify the key of x values in the data.
* We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data
@@ -365,9 +377,7 @@ export interface Data {
* - j is the sub index of the data point where the label is shown.
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (e.g. d3.format('$'))
*/
- labels?: boolean |
- { format: FormatFunction } |
- { format: { [key: string]: FormatFunction } };
+ labels?: boolean | { format: FormatFunction } | { format: { [key: string]: FormatFunction } };
/**
* Define the order of the data.
* This option changes the order of stacking the data and pieces of pie/donut. If null specified, it will be the order the data loaded. If function specified, it will be used to sort the data
@@ -387,11 +397,11 @@ export interface Data {
* This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that
* represents color (e.g. '#00ff00').
*/
- color?(color: string, d: any): string | d3.Rgb;
+ color?(color: string, d: any): string | d3.RGBColor;
/**
* Set color for each data.
*/
- colors?: { [key: string]: string | d3.Rgb | ((d: any) => string | d3.Rgb) };
+ colors?: { [key: string]: string | d3.RGBColor | ((d: any) => string | d3.RGBColor) };
/**
* Hide each data when the chart appears.
* If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden.
@@ -813,7 +823,7 @@ export interface PointOptions {
/**
* The radius size of each point on focus.
*/
- r?: number
+ r?: number;
};
};
@@ -877,7 +887,7 @@ export interface ChartAPI {
load(args: {
url?: string;
json?: {};
- keys?: { x?: string; value: string[]; }
+ keys?: { x?: string; value: string[] };
rows?: PrimitiveArray[];
columns?: PrimitiveArray[];
xs?: { [key: string]: string };
@@ -885,7 +895,7 @@ export interface ChartAPI {
classes?: { [key: string]: string };
categories?: string[];
axes?: { [key: string]: string };
- colors?: { [key: string]: string | d3.Rgb };
+ colors?: { [key: string]: string | d3.RGBColor };
type?: string;
types?: { [key: string]: string };
unload?: boolean | ArrayOrString;
@@ -911,7 +921,7 @@ export interface ChartAPI {
*/
flow(args: {
json?: {};
- keys?: { x?: string; value: string[]; }
+ keys?: { x?: string; value: string[] };
rows?: PrimitiveArray[];
columns?: PrimitiveArray[];
to?: any;
@@ -997,7 +1007,7 @@ export interface ChartAPI {
* Get and set colors of the data loaded in the chart.
* @param colors If this argument is given, the colors of data will be updated. If not given, the current colors will be returned. The format of this argument is the same as data.colors.
*/
- colors(colors?: { [key: string]: string | d3.Rgb }): { [key: string]: string };
+ colors(colors?: { [key: string]: string | d3.RGBColor }): { [key: string]: string };
/**
* Get and set axes of the data loaded in the chart.
* @param axes If this argument is given, the axes of data will be updated. If not given, the current axes will be returned. The format of this argument is the same as data.axes.
@@ -1040,22 +1050,25 @@ export interface ChartAPI {
* Get and set axis labels.
* @param labels If labels is given, specified axis' label will be updated.
*/
- labels(labels?: { [key: string]: string }): { [key: string]: string }
+ labels(labels?: { [key: string]: string }): { [key: string]: string };
/**
* Get and set axis min value.
* @param min If min is given, specified axis' min value will be updated. If no argument is given, the current min values for each axis will be returned.
*/
- min(min?: number | { [key: string]: number }): number | { [key: string]: number }
+ min(min?: number | { [key: string]: number }): number | { [key: string]: number };
/**
* Get and set axis max value.
* @param max If max is given, specified axis' max value will be updated. If no argument is given, the current max values for each axis will be returned.
*/
- max(max?: number | { [key: string]: number }): number | { [key: string]: number }
+ max(max?: number | { [key: string]: number }): number | { [key: string]: number };
/**
* Get and set axis min and max value.
* @param range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
*/
- range(range?: { min?: number | { [key: string]: number }; max?: number | { [key: string]: number } }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } }
+ range(range?: {
+ min?: number | { [key: string]: number };
+ max?: number | { [key: string]: number };
+ }): { min: number | { [key: string]: number }; max: number | { [key: string]: number } };
};
legend: {
diff --git a/types/c3/tsconfig.json b/types/c3/tsconfig.json
index fe3b00c503..aa923e91c0 100644
--- a/types/c3/tsconfig.json
+++ b/types/c3/tsconfig.json
@@ -1,29 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
- "lib": [
- "es6",
- "dom"
- ],
+ "lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"baseUrl": "../",
- "typeRoots": [
- "../"
- ],
+ "typeRoots": ["../"],
"types": [],
"paths": {
- "d3": [
- "d3/v3"
- ]
+ "d3-scale": ["d3-scale/v1"],
+ "d3": ["d3/v4"]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
- "files": [
- "index.d.ts",
- "c3-tests.ts"
- ]
-}
\ No newline at end of file
+ "files": ["index.d.ts", "c3-tests.ts"]
+}
diff --git a/types/chai-jest-snapshot/index.d.ts b/types/chai-jest-snapshot/index.d.ts
index 862da8cd16..470e4fa423 100644
--- a/types/chai-jest-snapshot/index.d.ts
+++ b/types/chai-jest-snapshot/index.d.ts
@@ -2,6 +2,7 @@
// Project: https://github.com/suchipi/chai-jest-snapshot#readme
// Definitions by: Matt Perry
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.1
///
///
diff --git a/types/chai-spies/chai-spies-tests.ts b/types/chai-spies/chai-spies-tests.ts
index 326b1e0137..1d99f0add2 100644
--- a/types/chai-spies/chai-spies-tests.ts
+++ b/types/chai-spies/chai-spies-tests.ts
@@ -1,6 +1,5 @@
import * as chai from 'chai';
import * as spies from 'chai-spies';
-import * as Mocha from 'mocha';
function original(): void {
// do something cool
diff --git a/types/chai-string/chai-string-tests.ts b/types/chai-string/chai-string-tests.ts
index dc798c102a..9cd9a2e024 100644
--- a/types/chai-string/chai-string-tests.ts
+++ b/types/chai-string/chai-string-tests.ts
@@ -1,6 +1,4 @@
-///
-
var should = chai.should();
var assert = chai.assert;
var expect = chai.expect;
@@ -8,6 +6,11 @@ var expect = chai.expect;
import chai_string = require("chai-string");
chai.use(chai_string);
+// Stub mocha functions
+const {describe, it, before, after, beforeEach, afterEach} = null as any as {
+ [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any};
+};
+
describe('chai-string', function() {
describe('#startsWith', function() {
diff --git a/types/chrome/chrome-app.d.ts b/types/chrome/chrome-app.d.ts
index 4ecf1d344a..65d80f3290 100644
--- a/types/chrome/chrome-app.d.ts
+++ b/types/chrome/chrome-app.d.ts
@@ -1189,7 +1189,7 @@ declare namespace chrome.system.display {
* @param {string} id The display's unique identifier.
* @param {(success) => void} callback Optional callback to inform the caller that the touch calibration has ended. The argument of the callback informs if the calibration was a success or not.
*/
- export function showNativeTouchCalibration(id: string, callback: (success) => void): void;
+ export function showNativeTouchCalibration(id: string, callback: (success: boolean) => void): void;
/**
* @description Starts custom touch calibration for a display. This should be called when using a custom UX for collecting calibration data. If another touch calibration is already in progress this will throw an error.
diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts
index d12bf94302..8c953aaca1 100644
--- a/types/chrome/index.d.ts
+++ b/types/chrome/index.d.ts
@@ -1678,6 +1678,17 @@ declare namespace chrome.devtools.inspectedWindow {
* Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression.
*/
export function eval(expression: string, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void;
+ /**
+ * Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the result parameter of the callback is undefined. In the case of a DevTools-side error, the isException parameter is non-null and has isError set to true and code set to an error code. In the case of a JavaScript error, isException is set to true and value is set to the string value of thrown object.
+ * @param expression An expression to evaluate.
+ * @param options The options parameter can contain one or more options.
+ * @param callback A function called when evaluation completes.
+ * If you specify the callback parameter, it should be a function that looks like this:
+ * function(object result, object exceptionInfo) {...};
+ * Parameter result: The result of evaluation.
+ * Parameter exceptionInfo: An object providing details if an exception occurred while evaluating the expression.
+ */
+ export function eval(expression: string, options: EvalOptions, callback?: (result: T, exceptionInfo: EvaluationExceptionInfo) => void): void;
/**
* Retrieves the list of resources from the inspected page.
* @param callback A function that receives the list of resources when the request completes.
@@ -1690,6 +1701,15 @@ declare namespace chrome.devtools.inspectedWindow {
export var onResourceAdded: ResourceAddedEvent;
/** Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools). */
export var onResourceContentCommitted: ResourceContentCommittedEvent;
+
+ export interface EvalOptions {
+ /** If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page. */
+ frameURL?: string;
+ /** Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the isError field set to true and the code field set to E_NOTFOUND. */
+ useContentScriptContext?: boolean;
+ /** Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext. */
+ contextSecurityOrigin?: string;
+ }
}
////////////////////
diff --git a/types/cleave.js/options/creditCard.d.ts b/types/cleave.js/options/creditCard.d.ts
new file mode 100644
index 0000000000..b7f55ff5b0
--- /dev/null
+++ b/types/cleave.js/options/creditCard.d.ts
@@ -0,0 +1,19 @@
+import Cleave = require("../");
+
+// Credit Card Options
+export type CreditCardType =
+ | "amex"
+ | "dankort"
+ | "diners"
+ | "discover"
+ | "instapayment"
+ | "jcb"
+ | "maestro"
+ | "mastercard"
+ | "uatp"
+ | "unknown"
+ | "unionPay"
+ | "mir"
+ | "visa";
+
+export type CreditCardTypeChangeHandler = (this: Cleave, type: CreditCardType) => void;
diff --git a/types/cleave.js/options.d.ts b/types/cleave.js/options/index.d.ts
similarity index 76%
rename from types/cleave.js/options.d.ts
rename to types/cleave.js/options/index.d.ts
index 81757fe097..60e2e99e40 100644
--- a/types/cleave.js/options.d.ts
+++ b/types/cleave.js/options/index.d.ts
@@ -1,19 +1,4 @@
-// Credit Card Options
-export type CreditCardType =
- | "amex"
- | "dankort"
- | "diners"
- | "discover"
- | "instapayment"
- | "jcb"
- | "maestro"
- | "mastercard"
- | "uatp"
- | "unknown"
- | "unionPay"
- | "mir"
- | "visa";
-export type CreditCardTypeChangeHandler = (owner: HTMLInputElement, type: CreditCardType) => void;
+import { CreditCardTypeChangeHandler } from "./creditCard";
export interface CleaveOptions {
creditCard?: boolean;
diff --git a/types/cleave.js/tsconfig.json b/types/cleave.js/tsconfig.json
index c2d5447360..ec4da5d047 100644
--- a/types/cleave.js/tsconfig.json
+++ b/types/cleave.js/tsconfig.json
@@ -21,7 +21,8 @@
"files": [
"cleave.js-tests.tsx",
"index.d.ts",
- "options.d.ts",
+ "options/creditCard.d.ts",
+ "options/index.d.ts",
"react/index.d.ts"
]
}
\ No newline at end of file
diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts
index ef075b9d45..06c3b39f96 100644
--- a/types/codemirror/index.d.ts
+++ b/types/codemirror/index.d.ts
@@ -669,7 +669,7 @@ declare namespace CodeMirror {
/** Returns a {from, to} object (both holding document positions), indicating the current position of the marked range,
or undefined if the marker is no longer in the document. */
- find(): CodeMirror.Range;
+ find(): {from: CodeMirror.Position, to: CodeMirror.Position};
/** Returns an object representing the options for the marker. If copyWidget is given true, it will clone the value of the replacedWith option, if any. */
getOptions(copyWidget: boolean): CodeMirror.TextMarkerOptions;
diff --git a/types/colors/colors-tests.ts b/types/colors/colors-tests.ts
deleted file mode 100644
index fcac0323f6..0000000000
--- a/types/colors/colors-tests.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import colors = require("colors");
-import { zalgo } from "colors/safe";
-
-let str: string;
-
-str = zalgo("");
-
-colors.enabled = true;
-
-str = colors.black.underline('test');
-str = colors.rainbow.black.blue.gray('test');
-str = colors.random.reset.bgWhite.dim('test');
-str = colors.random.reset.bgWhite.strip('test');
-str = 'test'.black.underline;
-str = 'test'.rainbow.black.blue.gray;
-str = 'test'.random.reset.bgWhite.dim;
-str = 'test'.random.reset.bgWhite.dim.stripColors;
-
-colors.enabled = false;
-
-str = colors.black.underline('test');
diff --git a/types/colors/index.d.ts b/types/colors/index.d.ts
deleted file mode 100644
index a5494aa945..0000000000
--- a/types/colors/index.d.ts
+++ /dev/null
@@ -1,133 +0,0 @@
-// Type definitions for Colors.js 1.1
-// Project: https://github.com/Marak/colors.js
-// Definitions by: Bart van der Schoor , Staffan Eketorp
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-export interface Color {
- (text: string): string;
-
- strip: Color;
- stripColors: Color;
-
- black: Color;
- red: Color;
- green: Color;
- yellow: Color;
- blue: Color;
- magenta: Color;
- cyan: Color;
- white: Color;
- gray: Color;
- grey: Color;
-
- bgBlack: Color;
- bgRed: Color;
- bgGreen: Color;
- bgYellow: Color;
- bgBlue: Color;
- bgMagenta: Color;
- bgCyan: Color;
- bgWhite: Color;
-
- reset: Color;
- bold: Color;
- dim: Color;
- italic: Color;
- underline: Color;
- inverse: Color;
- hidden: Color;
- strikethrough: Color;
-
- rainbow: Color;
- zebra: Color;
- america: Color;
- trap: Color;
- random: Color;
- zalgo: Color;
-}
-
-export function setTheme(theme: any): void;
-
-export let enabled: boolean;
-
-export const strip: Color;
-export const stripColors: Color;
-
-export const black: Color;
-export const red: Color;
-export const green: Color;
-export const yellow: Color;
-export const blue: Color;
-export const magenta: Color;
-export const cyan: Color;
-export const white: Color;
-export const gray: Color;
-export const grey: Color;
-
-export const bgBlack: Color;
-export const bgRed: Color;
-export const bgGreen: Color;
-export const bgYellow: Color;
-export const bgBlue: Color;
-export const bgMagenta: Color;
-export const bgCyan: Color;
-export const bgWhite: Color;
-
-export const reset: Color;
-export const bold: Color;
-export const dim: Color;
-export const italic: Color;
-export const underline: Color;
-export const inverse: Color;
-export const hidden: Color;
-export const strikethrough: Color;
-
-export const rainbow: Color;
-export const zebra: Color;
-export const america: Color;
-export const trap: Color;
-export const random: Color;
-export const zalgo: Color;
-
-declare global {
- interface String {
- strip: string;
- stripColors: string;
-
- black: string;
- red: string;
- green: string;
- yellow: string;
- blue: string;
- magenta: string;
- cyan: string;
- white: string;
- gray: string;
- grey: string;
-
- bgBlack: string;
- bgRed: string;
- bgGreen: string;
- bgYellow: string;
- bgBlue: string;
- bgMagenta: string;
- bgCyan: string;
- bgWhite: string;
-
- reset: string;
- bold: string;
- dim: string;
- italic: string;
- underline: string;
- inverse: string;
- hidden: string;
- strikethrough: string;
-
- rainbow: string;
- zebra: string;
- america: string;
- trap: string;
- random: string;
- zalgo: string;
- }
-}
diff --git a/types/colors/safe.d.ts b/types/colors/safe.d.ts
deleted file mode 100644
index 306b656b2b..0000000000
--- a/types/colors/safe.d.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-export const enabled: boolean;
-
-export function strip(str: string): string;
-export function stripColors(str: string): string;
-
-export function black(str: string): string;
-export function red(str: string): string;
-export function green(str: string): string;
-export function yellow(str: string): string;
-export function blue(str: string): string;
-export function magenta(str: string): string;
-export function cyan(str: string): string;
-export function white(str: string): string;
-export function gray(str: string): string;
-export function grey(str: string): string;
-
-export function bgBlack(str: string): string;
-export function bgRed(str: string): string;
-export function bgGreen(str: string): string;
-export function bgYellow(str: string): string;
-export function bgBlue(str: string): string;
-export function bgMagenta(str: string): string;
-export function bgCyan(str: string): string;
-export function bgWhite(str: string): string;
-
-export function reset(str: string): string;
-export function bold(str: string): string;
-export function dim(str: string): string;
-export function italic(str: string): string;
-export function underline(str: string): string;
-export function inverse(str: string): string;
-export function hidden(str: string): string;
-export function strikethrough(str: string): string;
-
-export function rainbow(str: string): string;
-export function zebra(str: string): string;
-export function america(str: string): string;
-export function trap(str: string): string;
-export function random(str: string): string;
-export function zalgo(str: string): string;
diff --git a/types/cosmiconfig/cosmiconfig-tests.ts b/types/cosmiconfig/cosmiconfig-tests.ts
new file mode 100644
index 0000000000..2676c58407
--- /dev/null
+++ b/types/cosmiconfig/cosmiconfig-tests.ts
@@ -0,0 +1,41 @@
+import cosmiconfig = require("cosmiconfig");
+
+const asyncExplorer = cosmiconfig("yourModuleName", {
+ packageProp: "yourModuleName",
+ rc: ".yourModuleNamerc",
+ js: "yourModuleName.config.js",
+ rcStrictJson: false,
+ rcExtensions: false,
+ stopDir: "someDir",
+ cache: true,
+ sync: false,
+ transform: ({ config, filePath }) => ({ config, filePath }),
+ format: "js"
+});
+
+Promise.all([
+ asyncExplorer.load(),
+ asyncExplorer.load("start/search/here"),
+ asyncExplorer.load(null, "load/this/file.json")
+]).then(result => result);
+
+asyncExplorer.load().then(({ config, filePath }) => ({ config, filePath }));
+
+asyncExplorer.clearFileCache();
+asyncExplorer.clearDirectoryCache();
+asyncExplorer.clearCaches();
+
+const syncExplorer = cosmiconfig("yourModuleName", {
+ packageProp: "yourModuleName",
+ rc: ".yourModuleNamerc",
+ js: "yourModuleName.config.js",
+ rcStrictJson: false,
+ rcExtensions: false,
+ stopDir: "someDir",
+ cache: true,
+ sync: true,
+ transform: ({ config, filePath }) => ({ config, filePath }),
+ format: "js"
+});
+
+const { config, filePath } = syncExplorer.load();
diff --git a/types/cosmiconfig/index.d.ts b/types/cosmiconfig/index.d.ts
new file mode 100644
index 0000000000..032f570d6f
--- /dev/null
+++ b/types/cosmiconfig/index.d.ts
@@ -0,0 +1,63 @@
+// Type definitions for cosmiconfig 4.0
+// Project: https://github.com/davidtheclark/cosmiconfig
+// Definitions by: ozum
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+
+interface Result {
+ config: object;
+ filePath: string;
+}
+
+interface Options {
+ packageProp?: string | false;
+ rc?: string | false;
+ js?: string | false;
+ rcStrictJson?: boolean;
+ rcExtensions?: boolean;
+ stopDir?: string;
+ cache?: boolean;
+ transform?: (result: Result) => Promise | Result;
+ configPath?: string;
+ format?: "json" | "yaml" | "js";
+}
+
+// Default is false and makes load() method async
+interface AsyncOptions extends Options {
+ sync?: false;
+}
+
+// Makes load() method sync
+interface SyncOptions extends Options {
+ sync: true;
+}
+
+interface Explorer {
+ clearFileCache(): void;
+ clearDirectoryCache(): void;
+ clearCaches(): void;
+}
+
+interface AsyncExplorer extends Explorer {
+ // You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added.
+ load(searchPath?: string): Promise;
+ load(searchPath: null | undefined, configPath?: string): Promise;
+}
+
+interface SyncExplorer extends Explorer {
+ // You should provide either searchPath or configPath for load method. To disallow both, overloaded definitions added.
+ load(searchPath?: string): Result;
+ load(searchPath: null | undefined, configPath?: string): Result;
+}
+
+declare function cosmiconfig(
+ moduleName: string,
+ options: SyncOptions
+): SyncExplorer;
+
+declare function cosmiconfig(
+ moduleName: string,
+ options?: AsyncOptions
+): AsyncExplorer;
+
+export = cosmiconfig;
diff --git a/types/cosmiconfig/tsconfig.json b/types/cosmiconfig/tsconfig.json
new file mode 100644
index 0000000000..6f0f0ac3a2
--- /dev/null
+++ b/types/cosmiconfig/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": ["es6"],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": ["../"],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": ["index.d.ts", "cosmiconfig-tests.ts"]
+}
diff --git a/types/cosmiconfig/tslint.json b/types/cosmiconfig/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/cosmiconfig/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/create-error/create-error-tests.ts b/types/create-error/create-error-tests.ts
index 7a635b8dc6..ed2d9533e3 100644
--- a/types/create-error/create-error-tests.ts
+++ b/types/create-error/create-error-tests.ts
@@ -1,8 +1,12 @@
-///
declare function equal(a: T, b: T): void;
declare function deepEqual(a: T, b: T): void;
+// Stub mocha functions
+const {describe, it, before, after, beforeEach, afterEach} = null as any as {
+ [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any};
+};
+
import * as createError from 'create-error';
// Example taken from https://github.com/tgriesser/create-error/blob/0.3.1/README.md#use
diff --git a/types/d3-geo/d3-geo-tests.ts b/types/d3-geo/d3-geo-tests.ts
index c4508351a0..5124694378 100644
--- a/types/d3-geo/d3-geo-tests.ts
+++ b/types/d3-geo/d3-geo-tests.ts
@@ -395,6 +395,9 @@ constructedProjection = constructedProjection.translate([480, 250]);
const center: [number, number] = constructedProjection.center();
constructedProjection = constructedProjection.center([0, 0]);
+const angle = constructedProjection.angle();
+constructedProjection = constructedProjection.angle(45);
+
const rotate: [number, number, number] = constructedProjection.rotate();
constructedProjection = constructedProjection.rotate([0, 0]);
constructedProjection = constructedProjection.rotate([0, 0, 0]);
diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts
index 7efbb72010..d9f0931269 100644
--- a/types/d3-geo/index.d.ts
+++ b/types/d3-geo/index.d.ts
@@ -1,10 +1,10 @@
-// Type definitions for D3JS d3-geo module 1.9
+// Type definitions for D3JS d3-geo module 1.10
// Project: https://github.com/d3/d3-geo/
// Definitions by: Hugues Stefanski , Tom Wanzek , Alex Ford , Boris Yankov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
-// Last module patch version validated against: 1.9.0
+// Last module patch version validated against: 1.10.0
import * as GeoJSON from 'geojson';
@@ -887,7 +887,15 @@ export interface GeoProjection extends GeoStreamWrapper {
* @param precision A numeric value in pixels to use as the threshold for the projection’s adaptive resampling.
*/
precision(precision: number): this;
-
+ /**
+ * Returns the projection’s current angle, which defaults to 0°.
+ */
+ angle(): number;
+ /**
+ * Sets the projection’s post-projection planar rotation angle to the specified angle in degrees and returns the projection.
+ * @param angle The new rotation angle of the projection.
+ */
+ angle(angle: number): this;
/**
* Returns the current rotation [lambda, phi, gamma] specifying the rotation angles in degrees about each spherical axis.
* (These correspond to yaw, pitch and roll.) which defaults [0, 0, 0].
diff --git a/types/d3kit/v1/d3kit-tests.ts b/types/d3kit/v1/d3kit-tests.ts
index 9ffb7ca2ba..18f1f144f9 100644
--- a/types/d3kit/v1/d3kit-tests.ts
+++ b/types/d3kit/v1/d3kit-tests.ts
@@ -1,6 +1,10 @@
-///
///
+// Stub mocha functions
+const {describe, it, before, after, beforeEach, afterEach} = null as any as {
+ [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any};
+};
+
var expect = chai.expect;
describe('Skeleton', function(){
var element: Element, $element: d3.Selection, $svg: d3.Selection, skeleton: d3kit.Skeleton;
diff --git a/types/decompress/index.d.ts b/types/decompress/index.d.ts
index c2211b3434..a493f81a0d 100644
--- a/types/decompress/index.d.ts
+++ b/types/decompress/index.d.ts
@@ -7,33 +7,35 @@
export = decompress;
-declare function decompress(input: string | Buffer, output: string, opts?: Options): Promise;
+declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise;
-interface File {
- data: Buffer;
- mode: number;
- mtime: string;
- path: string;
- type: string;
-}
+declare namespace decompress {
+ interface File {
+ data: Buffer;
+ mode: number;
+ mtime: string;
+ path: string;
+ type: string;
+ }
-interface Options {
- /**
- * Filter out files before extracting
- */
- filter?(file: File): boolean;
- /**
- * Map files before extracting
- */
- map?(file: File): File;
- /**
- * Array of plugins to use.
- * Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
- */
- plugins?: any[];
- /**
- * Remove leading directory components from extracted files.
- * Default: 0
- */
- strip?: number;
+ interface DecompressOptions {
+ /**
+ * Filter out files before extracting
+ */
+ filter?(file: File): boolean;
+ /**
+ * Map files before extracting
+ */
+ map?(file: File): File;
+ /**
+ * Array of plugins to use.
+ * Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
+ */
+ plugins?: any[];
+ /**
+ * Remove leading directory components from extracted files.
+ * Default: 0
+ */
+ strip?: number;
+ }
}
diff --git a/types/del/del-tests.ts b/types/del/del-tests.ts
index fc6c63b6fa..f9d01f644f 100644
--- a/types/del/del-tests.ts
+++ b/types/del/del-tests.ts
@@ -1,39 +1,47 @@
-import del = require("del");
+import del = require('del');
-let paths = ["build", "dist/**/*.js"];
+let paths = ['build', 'dist/**/*.js'];
-del(["tmp/*.js", "!tmp/unicorn.js"]);
-del(["tmp/*.js", "!tmp/unicorn.js"], {force: true});
-del(["tmp/*.js", "!tmp/unicorn.js"], {dryRun: true});
-del(["tmp/*.js", "!tmp/unicorn.js"], {concurrency: 20});
-del(["tmp/*.js", "!tmp/unicorn.js"], {cwd: ''});
+del(['tmp/*.js', '!tmp/unicorn.js']);
+del(['tmp/*.js', '!tmp/unicorn.js'], { force: true });
+del(['tmp/*.js', '!tmp/unicorn.js'], { dryRun: true });
+del(['tmp/*.js', '!tmp/unicorn.js'], { concurrency: 20 });
+del(['tmp/*.js', '!tmp/unicorn.js'], { cwd: '' });
-del(["tmp/*.js", "!tmp/unicorn.js"]).then((paths: string[]) => {
+del(['tmp/*.js', '!tmp/unicorn.js']).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
-del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}).then((paths: string[]) => {
+del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }).then(
+ (paths: string[]) => {
+ console.log('Deleted files/folders:\n', paths.join('\n'));
+ }
+);
+
+del('tmp/*.js');
+del('tmp/*.js', { force: true });
+del('tmp/*.js', { dryRun: true });
+del('tmp/*.js', { concurrency: 20 });
+del('tmp/*.js', { cwd: '' });
+del('tmp/*.js').then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
-del("tmp/*.js");
-del("tmp/*.js", {force: true});
-del("tmp/*.js", {dryRun: true});
-del("tmp/*.js", {concurrency: 20});
-del("tmp/*.js", {cwd: ''});
-del("tmp/*.js").then((paths: string[]) => {
+del('tmp/*.js', { force: true }).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
-del("tmp/*.js", {force: true}).then((paths: string[]) => {
- console.log('Deleted files/folders:\n', paths.join('\n'));
-});
+paths = del.sync(['tmp/*.js', '!tmp/unicorn.js']);
+paths = del.sync(['tmp/*.js', '!tmp/unicorn.js'], { force: true });
-paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"]);
-paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true});
+paths = del.sync('tmp/*.js');
+paths = del.sync('tmp/*.js', { force: true });
+paths = del.sync('tmp/*.js', { dryRun: true });
+paths = del.sync('tmp/*.js', { concurrency: 20 });
+paths = del.sync('tmp/*.js', { cwd: '' });
-paths = del.sync("tmp/*.js");
-paths = del.sync("tmp/*.js", {force: true});
-paths = del.sync("tmp/*.js", {dryRun: true});
-paths = del.sync("tmp/*.js", {concurrency: 20});
-paths = del.sync("tmp/*.js", {cwd: ''});
+const immutable: ReadonlyArray = ['tmp/*.js', '!tmp/unicorn.js'];
+const mutable = del(immutable);
+const mutablePaths = del.sync(immutable);
+mutable.then(paths => paths.push('test'));
+mutablePaths.push('test');
diff --git a/types/del/index.d.ts b/types/del/index.d.ts
index e3c250e69b..ec92f96c84 100644
--- a/types/del/index.d.ts
+++ b/types/del/index.d.ts
@@ -3,14 +3,21 @@
// Definitions by: Asana
// Aya Morisawa
// BendingBender
+// Jason Dreyzehner
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-import glob = require("glob");
+import glob = require('glob');
-declare function del(patterns: string | string[], options?: del.Options): Promise;
+declare function del(
+ patterns: string | ReadonlyArray,
+ options?: del.Options
+): Promise;
declare namespace del {
- function sync(patterns: string | string[], options?: Options): string[];
+ function sync(
+ patterns: string | ReadonlyArray,
+ options?: Options
+ ): string[];
interface Options extends glob.IOptions {
force?: boolean;
diff --git a/types/download/index.d.ts b/types/download/index.d.ts
index cffc282832..5d19321fb0 100644
--- a/types/download/index.d.ts
+++ b/types/download/index.d.ts
@@ -2,41 +2,31 @@
// Project: https://github.com/kevva/download
// Definitions by: Nico Jansen
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-// TypeScript Version: 2.2
+// TypeScript Version: 2.3
///
+import { DecompressOptions } from 'decompress';
+import { GotBodyOptions, TimeoutOptions } from 'got';
-interface TimeoutOptions {
- connect?: number;
- socket?: number;
- request?: number;
-}
-type RetryFunction = (retry: number, error: any) => number;
+declare namespace download {
+ type RetryFunction = (retry: number, error: any) => number;
-interface DownloadOptions {
- body?: string | Buffer | NodeJS.ReadableStream;
- encoding?: string | null;
- query?: string | object;
- timeout?: number | TimeoutOptions;
- retries?: number | RetryFunction;
- followRedirect?: boolean;
- decompress?: boolean;
- useElectronNet?: boolean;
- /**
- * If set to true, try extracting the file using decompress.
- */
- extract?: boolean;
- /**
- * Name of the saved file.
- */
- filename?: string;
- /**
- * Proxy endpoint
- */
- proxy?: string;
+ interface DownloadOptions extends DecompressOptions, GotBodyOptions {
+ /**
+ * If set to true, try extracting the file using decompress.
+ */
+ extract?: boolean;
+ /**
+ * Name of the saved file.
+ */
+ filename?: string;
+ /**
+ * Proxy endpoint
+ */
+ proxy?: string;
+ }
}
-declare namespace download {}
-declare function download(url: string, destination?: string, options?: DownloadOptions): Promise & NodeJS.WritableStream & NodeJS.ReadableStream;
+declare function download(url: string, destination?: string, options?: download.DownloadOptions): Promise & NodeJS.WritableStream & NodeJS.ReadableStream;
export = download;
diff --git a/types/draft-js/draft-js-tests.tsx b/types/draft-js/draft-js-tests.tsx
index 63821eda98..857671d13d 100644
--- a/types/draft-js/draft-js-tests.tsx
+++ b/types/draft-js/draft-js-tests.tsx
@@ -22,7 +22,8 @@ import {
DraftEntityMutability,
DraftEntityType,
convertFromHTML,
- convertToRaw
+ convertToRaw,
+ CompositeDecorator,
} from 'draft-js';
const SPLIT_HEADER_BLOCK = 'split-header-block';
@@ -38,6 +39,14 @@ export const KEYCODES: Record = {
type SyntheticKeyboardEvent = React.KeyboardEvent<{}>;
+const HANDLE_REGEX = /\@[\w]+/g;
+
+class HandleSpan extends React.Component {
+ render() {
+ return {this.props.children}
+ }
+}
+
class RichEditorExample extends React.Component<{}, { editorState: EditorState }> {
constructor() {
super({});
@@ -51,8 +60,22 @@ class RichEditorExample extends React.Component<{}, { editorState: EditorState }
blocksFromHTML.contentBlocks,
blocksFromHTML.entityMap,
);
-
- this.state = { editorState: EditorState.createWithContent(state) };
+ const decorator = new CompositeDecorator([{
+ strategy: (
+ block: ContentBlock,
+ callback: (start: number, end: number) => void,
+ contentState: ContentState
+ ) => {
+ const text = block.getText();
+ let matchArr, start;
+ while ((matchArr = HANDLE_REGEX.exec(text)) !== null) {
+ start = matchArr.index;
+ callback(start, start + matchArr[0].length);
+ }
+ },
+ component: HandleSpan,
+ }]);
+ this.state = { editorState: EditorState.createWithContent(state, decorator) };
}
onChange: (editorState: EditorState) => void = (editorState: EditorState) => this.setState({ editorState });
diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts
index e545fa347d..e83de2b303 100644
--- a/types/draft-js/index.d.ts
+++ b/types/draft-js/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Draft.js v0.10.4
+// Type definitions for Draft.js v0.10.5
// Project: https://facebook.github.io/draft-js/
// Definitions by: Dmitry Rogozhny
// Eelco Lempsink
@@ -7,6 +7,7 @@
// Michael Wu
// Willis Plummer
// Santiago Vilar
+// Ulf Schwekendiek
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -398,7 +399,7 @@ declare namespace Draft {
/**
* Given a `ContentBlock`, return an immutable List of decorator keys.
*/
- getDecorations(block: ContentBlock): Immutable.List;
+ getDecorations(block: ContentBlock, contentState: ContentState): Immutable.List;
/**
* Given a decorator key, return the component to use when rendering
@@ -456,7 +457,7 @@ declare namespace Draft {
class CompositeDraftDecorator {
constructor(decorators: Array);
- getDecorations(block: ContentBlock): Immutable.List;
+ getDecorations(block: ContentBlock, contentState: ContentState): Immutable.List;
getComponentForKey(key: string): Function;
getPropsForKey(key: string): Object;
}
@@ -957,6 +958,7 @@ import ContentBlock = Draft.Model.ImmutableData.ContentBlock;
import ContentState = Draft.Model.ImmutableData.ContentState;
import SelectionState = Draft.Model.ImmutableData.SelectionState;
import DraftInlineStyle = Draft.Model.ImmutableData.DraftInlineStyle;
+import BlockMap = Draft.Model.ImmutableData.BlockMap;
import AtomicBlockUtils = Draft.Model.Modifier.AtomicBlockUtils;
import KeyBindingUtil = Draft.Component.Utils.KeyBindingUtil;
@@ -1005,6 +1007,7 @@ export {
ContentState,
SelectionState,
DraftInlineStyle,
+ BlockMap,
AtomicBlockUtils,
KeyBindingUtil,
diff --git a/types/dwt/addon.pdf.d.ts b/types/dwt/addon.pdf.d.ts
index ef0980abfd..856291a647 100644
--- a/types/dwt/addon.pdf.d.ts
+++ b/types/dwt/addon.pdf.d.ts
@@ -1,5 +1,5 @@
/*!
-* Dynamsoft WebTwain PDF Addon
+* Based on Dynamsoft WebTwain JavaScript Intellisense
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
*
@@ -25,7 +25,7 @@ interface PDF {
* The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional.
* The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
Download(remoteFile: string,
optionalAsyncSuccessFunc?: () => void,
@@ -35,7 +35,7 @@ interface PDF {
* Input the password to decrypt PDF files using PDF Rasterizer add-on.
* @method Dynamsoft.WebTwain#SetPassword
* @param {string} password Specifies the PDF password.
- * @return {bool}
+ * @return {boolean}
*/
SetPassword(password: string): boolean;
@@ -43,7 +43,7 @@ interface PDF {
* Set the image convert mode for PDF Rasterizer in Dynamic Web TWAIN.
* @method Dynamsoft.WebTwain#SetConvertMode
* @param {EnumDWT_ConverMode} convertMode Specifies the image convert mode.
- * @return {bool}
+ * @return {boolean}
*/
SetConvertMode(convertMode: EnumDWT_ConverMode): boolean;
@@ -51,7 +51,7 @@ interface PDF {
* Set the output resolution for the PDF Rasterizer in Dynamic Web TWAIN.
* @method Dynamsoft.WebTwain#ReadRect
* @param {float} fResolution Specifies the resolution for convert image from PDF file.
- * @return {bool}
+ * @return {boolean}
*/
SetResolution(fResolution: number): boolean;
@@ -59,7 +59,7 @@ interface PDF {
* Judges whether the local PDF is text-based or not.
* @method Dynamsoft.WebTwain#ReadRect
* @param {string} localFile specifies the local path of the target PDF.
- * @return {bool}
+ * @return {boolean}
*/
IsTextBasedPDF(localFile: string): boolean;
}
@@ -69,5 +69,5 @@ interface WebTwainAddon {
}
interface WebTwain {
- Addon: WebTwainAddon;
+ Addon: WebTwainAddon;
}
diff --git a/types/dwt/index.d.ts b/types/dwt/index.d.ts
index b940c6ae4e..69bd65bb9f 100644
--- a/types/dwt/index.d.ts
+++ b/types/dwt/index.d.ts
@@ -3,11 +3,12 @@
// Definitions by: Xiao Ling
// Josh Hall
// Lincoln Hu
+// Tom Kent
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/*!
-* Dynamsoft WebTwain JavaScript Intellisense
+* Based on Dynamsoft WebTwain JavaScript Intellisense
* Product: Dynamsoft Web Twain
* Web Site: http://www.dynamsoft.com
*
@@ -20,51 +21,87 @@
* @namespace Dynamsoft
*/
declare namespace Dynamsoft {
+ namespace Lib {
+ /*ignored
+ Addon_Events Addon_Sendback_Events AttachAndShowImage BIO DOM DynamicLoadAddonFuns DynamicWebTwain EnumMouseButton
+ Errors Events IntToColorStr LS OnGetImageByURL OnGetImageFromServer Path ProgressBar UI Uri
+ addEventListener ajax all appendMessage appendRichMessage aryControlLoadImage attachAddon attachProperty
+ base64 bio cancelFrome clearMessage closeAll closeProgress colorStrToInt config css currentStyle
+ debug detect detectButton dialog dialogShowStatus dlgProgress dlgRef drawBoxBorder drawImageWithHermite
+ each empty endsWith
+ */
+
+ let env: {
+ WSSession: number, WSVersion: string,
+ bChrome: boolean, bEdge: boolean, bFileSystem: boolean, bFirefox: boolean,
+ bIE: boolean, bLinux: boolean, bMac: boolean, bSafari: boolean, bWin: boolean, bWin64: boolean,
+ basePath: string, iPluginLength: number, isX64: boolean, pathType: number,
+ strChromeVersion: number, strFirefoxVersion: string, strIEVersion: string
+ };
+
+ /*ignored
+ error escapeHtml escapeRegExp extend filter fireEvent fromUnicode get getColor getCss
+ getElDimensions getHex getHexColor getHttpUrl getLogger getOffset getRandom getRealPath getScript
+ getWS getWSUrl getWheelDelta globalEval guid hide html5 imageControlCount indexOf install
+ io isArray isBoolean isDef isFunction isLocalIP isNaN isNull isNumber isObject
+ isPlainObject isString isUndef isUndefined isWindow keys log main makeArray mix
+ needShowTwiceShowDialog nil noop now obj one page param parse parseHTML parser
+ product progressMessage ready removeEventListener replaceAll replaceControl show showProgress startWS
+ startWSByIP startsWith stopPropagation stringify style support switchEvent tmp toggle trim
+ type unEscapeHtml unparam upperCaseFirst urlDecode urlEncode utf8 win
+ ...other internal ones
+ */
+ }
namespace WebTwainEnv {
- function GetWebTwain (cid: string): WebTwain;
- function RegisterEvent(event: string, fn: (...args: any[]) => void): void;
+ let JSVersion: string;
+ let PluginVersion: string;
+ let ActiveXVersion: string;
+ let ServerVersionInfo: string;
+
+ let Trial: boolean;
+ let AutoLoad: boolean;
+ let ProductKey: string;
+ let ResourcesPath: string;
+
+ let IfUpdateService: boolean;
+ let IfUseActiveXForIE10Plus: boolean;
+ let UseDefaultInstallUI: string;
+ let ActiveXInstallWithCAB: boolean;
+ let Debug: boolean;
+
+ let ContainerMap: {};
+ let Containers: Container[];
+ let DynamicContainers: string[];
+ let DynamicDWTMap: {};
+
+ function CreateDWTObject(newObjID: string, successFn: (dwtObject: WebTwain) => void, failurefn: (...args: any[]) => void): void;
+ function GetWebTwain(cid: string): WebTwain;
+ function DeleteDWTObject(objID: string): void;
function Load(): void;
function Unload(): void;
- let AutoLoad: boolean;
- let Containers: Container[];
+ function RegisterEvent(event: string, fn: (...args: any[]) => void): void;
+
+ /*ignored
+ initQueue inited UseDefaultInstallUI
+ OnWebTwainInitMessage OnWebTwainNeedUpgrade OnWebTwainNeedUpgradeWebJavascript OnWebTwainNotFound OnWebTwainOldPluginNotAllowed OnWebTwainReady
+ */
+ function OnWebTwainPostExecute(): void;
+ function OnWebTwainPreExecute(): void;
+
+ function RemoveAllAuthorizations(): void;
+ function ShowDialog(_dialogWidth: number, _dialogHeight: number, _strDialogMessageWithHtmlFormat: string, _bChangeImage: boolean, bHideCloseButton: boolean): void;
+ function CloseDialog(): void;
}
}
-/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */
-declare enum EnumDWT_PixelType {
- TWPT_BW = 0,
- TWPT_GRAY = 1,
- TWPT_RGB = 2,
- TWPT_PALLETE = 3,
- TWPT_CMY = 4,
- TWPT_CMYK = 5,
- TWPT_YUV = 6,
- TWPT_YUVK = 7,
- TWPT_CIEXYZ = 8,
- TWPT_LAB = 9,
- TWPT_SRGB = 10,
- TWPT_SCRGB = 11,
- TWPT_INFRARED = 16
-}
-
+/** Border Styles */
declare enum EnumDWT_BorderStyle {
- /** No border. */
- TWBS_NONE = 0,
- /** Flat border. */
- TWBS_SINGLEFLAT = 1,
- /** 3D border. */
- TWBS_SINGLE3D = 2
-}
-
-/** For query the operation that are supported by the data source on a capability .
- * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT
- */
-declare enum EnumDWT_MessageType {
- TWQC_GET = 1,
- TWQC_SET = 2,
- TWQC_GETDEFAULT = 4,
- TWQC_GETCURRENT = 8,
- TWQC_RESET = 16
+ /** No border. */
+ TWBS_NONE = 0,
+ /** Flat border. */
+ TWBS_SINGLEFLAT = 1,
+ /** 3D border. */
+ TWBS_SINGLE3D = 2
}
/** Capabilities */
@@ -272,45 +309,45 @@ declare enum EnumDWT_Cap {
* any frames with a left offset of zero.
* TWFA_RIGHT: The alignment is to the right.
*/
- CAP_FEEDERALIGNMENT = 4141,
+ CAP_FEEDERALIGNMENT = 4141,
/** TWFO_FIRSTPAGEFIRST if the feeder starts with the top of the first page.
* TWFO_LASTPAGEFIRST is the feeder starts with the top of the last page.
*/
- CAP_FEEDERORDER = 4142,
+ CAP_FEEDERORDER = 4142,
/** Indicates whether the physical hardware (e.g. scanner, digital camera) is capable of acquiring
* multiple images of the same page without changes to the physical registration of that page.
*/
- CAP_REACQUIREALLOWED = 4144,
+ CAP_REACQUIREALLOWED = 4144,
/** The minutes of battery power remaining to the device. */
- CAP_BATTERYMINUTES = 4146,
+ CAP_BATTERYMINUTES = 4146,
/** When used with CapGet(), return the percentage of battery power level on camera. If -1 is returned, it indicates that the battery is not present. */
- CAP_BATTERYPERCENTAGE = 4147,
+ CAP_BATTERYPERCENTAGE = 4147,
/** Added 1.91 */
- CAP_CAMERASIDE = 4148,
+ CAP_CAMERASIDE = 4148,
/** Added 1.91 */
- CAP_SEGMENTED = 4149,
+ CAP_SEGMENTED = 4149,
/** Added 2.0 */
- CAP_CAMERAENABLED = 4150,
+ CAP_CAMERAENABLED = 4150,
/** Added 2.0 */
- CAP_CAMERAORDER = 4151,
+ CAP_CAMERAORDER = 4151,
/** Added 2.0 */
- CAP_MICRENABLED = 4152,
+ CAP_MICRENABLED = 4152,
/** Added 2.0 */
- CAP_FEEDERPREP = 4153,
+ CAP_FEEDERPREP = 4153,
/** Added 2.0 */
- CAP_FEEDERPOCKET = 4154,
+ CAP_FEEDERPOCKET = 4154,
/** Added 2.1 */
- CAP_AUTOMATICSENSEMEDIUM = 4155,
+ CAP_AUTOMATICSENSEMEDIUM = 4155,
/** Added 2.1 */
- CAP_CUSTOMINTERFACEGUID = 4156,
+ CAP_CUSTOMINTERFACEGUID = 4156,
/** TRUE enables and FALSE disables the Source's Auto-brightness function (if any). */
- ICAP_AUTOBRIGHT = 4352,
+ ICAP_AUTOBRIGHT = 4352,
/** The brightness values available within the Source. */
- ICAP_BRIGHTNESS = 4353,
+ ICAP_BRIGHTNESS = 4353,
/** The contrast values available within the Source. */
- ICAP_CONTRAST = 4355,
+ ICAP_CONTRAST = 4355,
/** Specifies the square-cell halftone (dithering) matrix the Source should use to halftone the image. */
- ICAP_CUSTHALFTONE = 4356,
+ ICAP_CUSTHALFTONE = 4356,
/** Specifies the exposure time used to capture the image, in seconds. */
ICAP_EXPOSURETIME = 4357,
/** Describes the color characteristic of the subtractive filter applied to the image data. Multiple
@@ -567,204 +604,85 @@ declare enum EnumDWT_Cap {
ICAP_SUPPORTEDEXTIMAGEINFO = 4446
}
-/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected.
- * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities =
- * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION.
- */
-declare enum EnumDWT_CapType {
- /** Nothing. */
- TWON_NONE = 0,
- /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and
- * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS
- * capability, would use this type of container.
+/** ICAP_BITORDER values. */
+declare enum EnumDWT_CapBitOrder {
+ TWBO_LSBFIRST = 0,
+ /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */
+ TWBO_MSBFIRST = 1
+}
+
+/** ICAP_BITDEPTHREDUCTION values. */
+declare enum EnumDWT_CapBitdepthReduction {
+ TWBR_THRESHOLD = 0,
+ TWBR_HALFTONE = 1,
+ TWBR_CUSTHALFTONE = 2,
+ TWBR_DIFFUSION = 3
+}
+
+/** CAP_FEEDERALIGNMENT values. */
+declare enum EnumDWT_CapFeederAlignment {
+ /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */
+ TWFA_NONE = 0,
+ /** The alignment is to the left. */
+ TWFA_LEFT = 1,
+ /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the
+ * device. If this is set, then the Application should calculate any frames with a left offset of zero.
*/
- TWON_ARRAY = 3,
- /** This is the most general type because it defines a list of values from which the Current Value can be chosen.
- * The values do not progress uniformly through a range and there is not a consistent step size between the values.
- * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600).
- */
- TWON_ENUMERATION = 4,
- /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value.
- * For example, a capability that indicates the presence of a document feeder could be of this type.
- */
- TWON_ONEVALUE = 5,
- /** Many capabilities allow users to select their current value from a range of regularly spaced values.
- * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values.
- * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600).
- */
- TWON_RANGE = 6
+ TWFA_CENTER = 2,
+ /** The alignment is to the right. */
+ TWFA_RIGHT = 3
}
-/** ICAP_XFERMECH values. */
-declare enum EnumDWT_TransferMode {
- /** Native transfers require the data to be transferred to a single large block of RAM. Therefore,
- * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully.
- */
- TWSX_NATIVE = 0,
- /** Disk File Mode Transfers. */
- TWSX_FILE = 1,
- /** Buffered Memory Mode Transfers. */
- TWSX_MEMORY = 2,
- /** added 1.91 */
- TWSX_MEMFILE = 4
+/** CAP_FEEDERORDER values. */
+declare enum EnumDWT_CapFeederOrder {
+ /** The feeder starts with the top of the first page. */
+ TWFO_FIRSTPAGEFIRST = 0,
+ /** The feeder starts with the top of the last page. */
+ TWFO_LASTPAGEFIRST = 1
}
-/** ICAP_IMAGEFILEFORMAT values. */
-declare enum EnumDWT_FileFormat {
- /** Used for document imaging. Tagged Image File Format */
- TWFF_TIFF = 0,
- /** Native Macintosh format. Macintosh PICT */
- TWFF_PICT = 1,
- /** Native Microsoft format. Windows Bitmap */
- TWFF_BMP = 2,
- /** Used for document imaging. X-Windows Bitmap */
- TWFF_XBM = 3,
- /** Wrapper for JPEG images. JPEG File Interchange Format */
- TWFF_JFIF = 4,
- /** FlashPix, used with digital cameras. Flash Pix */
- TWFF_FPX = 5,
- /** Multi-page TIFF files. Multi-page tiff file */
- TWFF_TIFFMULTI = 6,
- /** An image format standard intended for use on the web, replaces GIF. */
- TWFF_PNG = 7,
- /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */
- TWFF_SPIFF = 8,
- /** File format for use with digital cameras. */
- TWFF_EXIF = 9,
- /** A file format from Adobe. 1.91 NB: this is not PDF/A */
- TWFF_PDF = 10,
- /** A file format from the Joint Photographic Experts Group. 1.91 */
- TWFF_JP2 = 11,
- /** 1.91 */
- TWFF_JPN = 12,
- /** 1.91 */
- TWFF_JPX = 13,
- /** A file format from LizardTech. 1.91 */
- TWFF_DEJAVU = 14,
- /** A file format from Adobe. 2.0 */
- TWFF_PDFA = 15,
- /** 2.1 Adobe PDF/A, Version 2 */
- TWFF_PDFA2 = 16
+/** ICAP_FILTER values. */
+declare enum EnumDWT_CapFilterType {
+ TWFT_RED = 0,
+ TWFT_GREEN = 1,
+ TWFT_BLUE = 2,
+ TWFT_NONE = 3,
+ TWFT_WHITE = 4,
+ TWFT_CYAN = 5,
+ TWFT_MAGENTA = 6,
+ TWFT_YELLOW = 7,
+ TWFT_BLACK = 8
}
-/** TIFF file compression type. */
-declare enum EnumDWT_TIFFCompressionType {
- /** Auto mode. */
- TIFF_AUTO = 0,
- /** Dump mode. */
- TIFF_NONE = 1,
- /** CCITT modified Huffman RLE. */
- TIFF_RLE = 2,
- /** CCITT Group 3 fax encoding. */
- TIFF_FAX3 = 3,
- /** CCITT T.4 (TIFF 6 name). */
- TIFF_T4 = 3,
- /** CCITT Group 4 fax encoding */
- TIFF_FAX4 = 4,
- /** CCITT T.6 (TIFF 6 name). */
- TIFF_T6 = 4,
- /** Lempel Ziv and Welch */
- TIFF_LZW = 5,
- TIFF_JPEG = 7,
- TIFF_PACKBITS = 32773
+/** ICAP_FLASHUSED2 values. */
+declare enum EnumDWT_CapFlash {
+ TWFL_NONE = 0,
+ TWFL_OFF = 1,
+ TWFL_ON = 2,
+ TWFL_AUTO = 3,
+ TWFL_REDEYE = 4
}
-/** The method to do interpolation. */
-declare enum EnumDWT_InterpolationMethod {
- IM_NEARESTNEIGHBOUR = 1,
- IM_BILINEAR = 2,
- IM_BICUBIC = 3,
- IM_BESTQUALITY = 5
+/** ICAP_FLIPROTATION values. */
+declare enum EnumDWT_CapFlipRotation {
+ /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */
+ TWFR_BOOK = 0,
+ /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */
+ TWFR_FANFOLD = 1
}
-/** Image type */
-declare enum EnumDWT_ImageType {
- /** Native Microsoft format. */
- IT_BMP = 0,
- /** JPEG format. */
- IT_JPG = 1,
- /** Tagged Image File Format. */
- IT_TIF = 2,
- /** An image format standard intended for use on the web, replaces GIF. */
- IT_PNG = 3,
- /** A file format from Adobe. */
- IT_PDF = 4,
- IT_ALL = 5
-}
-
-/** PDF file compression type. */
-declare enum EnumDWT_PDFCompressionType {
- /** Auto mode. */
- PDF_AUTO = 0,
- /** CCITT Group 3 fax encoding. */
- PDF_FAX3 = 1,
- /** CCITT Group 4 fax encoding */
- PDF_FAX4 = 2,
- /** Lempel Ziv and Welch */
- PDF_LZW = 3,
- /** CCITT modified Huffman RLE. */
- PDF_RLE = 4,
- PDF_JPEG = 5
-}
-
-declare enum EnumDWT_ShowMode {
- /** Activates the window and displays it in its current size and position. */
- SW_ACTIVE = 0,
- /** Maximizes the window */
- SW_MAX = 1,
- /** Minimize the window */
- SW_MIN = 2,
- /** Close the latest opened editor window */
- SW_CLOSE = 3,
- /** Check whether a window exists */
- SW_IFLIVE = 4
-}
-
-/** The kind of data stored in the container. */
-declare enum EnumDWT_CapValueType {
- TWTY_INT8 = 0,
- /** Means Item is a TW_INT16 */
- TWTY_INT16 = 1,
- /** Means Item is a TW_INT32 */
- TWTY_INT32 = 2,
- /** Means Item is a TW_UINT8 */
- TWTY_UINT8 = 3,
- /** Means Item is a TW_UINT16 */
- TWTY_UINT16 = 4,
- /** Means Item is a TW_int */
- TWTY_int = 5,
- /** Means Item is a TW_BOOL */
- TWTY_BOOL = 6,
- /** Means Item is a TW_FIX32 */
- TWTY_FIX32 = 7,
- /** Means Item is a TW_FRAME */
- TWTY_FRAME = 8,
- /** Means Item is a TW_STR32 */
- TWTY_STR32 = 9,
- /** Means Item is a TW_STR64 */
- TWTY_STR64 = 10,
- /** Means Item is a TW_STR128 */
- TWTY_STR128 = 11,
- /** Means Item is a TW_STR255 */
- TWTY_STR255 = 12
-}
-
-/** ICAP_UNITS values. */
-declare enum EnumDWT_UnitType {
- TWUN_INCHES = 0,
- TWUN_CENTIMETERS = 1,
- TWUN_PICAS = 2,
- TWUN_POINTS = 3,
- TWUN_TWIPS = 4,
- TWUN_PIXELS = 5,
- TWUN_MILLIMETERS = 6
-}
-
-/** ICAP_DUPLEX values. */
-declare enum EnumDWT_DUPLEX {
- TWDX_NONE = 0,
- TWDX_1PASSDUPLEX = 1,
- TWDX_2PASSDUPLEX = 2
+/** ICAP_IMAGEFILTER values. */
+declare enum EnumDWT_CapImageFilter {
+ TWIF_NONE = 0,
+ TWIF_AUTO = 1,
+ /** Good for halftone images. */
+ TWIF_LOWPASS = 2,
+ /** Good for improving text. */
+ TWIF_BANDPASS = 3,
+ /** Good for improving fine lines. */
+ TWIF_HIGHPASS = 4,
+ TWIF_TEXT = 3,
+ TWIF_FINELINE = 4
}
/** CAP_LANGUAGE values. */
@@ -918,6 +836,92 @@ declare enum EnumDWT_CapLanguage {
TWLG_VIETNAMESE = 113
}
+/** ICAP_LIGHTPATH values. */
+declare enum EnumDWT_CapLightPath {
+ TWLP_REFLECTIVE = 0,
+ TWLP_TRANSMISSIVE = 1
+}
+
+/** ICAP_LIGHTSOURCE values. */
+declare enum EnumDWT_CapLightSource {
+ TWLS_RED = 0,
+ TWLS_GREEN = 1,
+ TWLS_BLUE = 2,
+ TWLS_NONE = 3,
+ TWLS_WHITE = 4,
+ TWLS_UV = 5,
+ TWLS_IR = 6
+}
+
+/** ICAP_NOISEFILTER values. */
+declare enum EnumDWT_CapNoiseFilter {
+ TWNF_NONE = 0,
+ TWNF_AUTO = 1,
+ TWNF_LONEPIXEL = 2,
+ TWNF_MAJORITYRULE = 3
+}
+
+/** ICAP_ORIENTATION values. */
+declare enum EnumDWT_CapORientation {
+ TWOR_ROT0 = 0,
+ TWOR_ROT90 = 1,
+ TWOR_ROT180 = 2,
+ TWOR_ROT270 = 3,
+ TWOR_PORTRAIT = 0,
+ TWOR_LANDSCAPE = 3,
+ /** 2.0 */
+ TWOR_AUTO = 4,
+ /** 2.0 */
+ TWOR_AUTOTEXT = 5,
+ /** 2.0 */
+ TWOR_AUTOPICTURE = 6
+}
+
+/** ICAP_OVERSCAN values. */
+declare enum EnumDWT_CapOverscan {
+ TWOV_NONE = 0,
+ TWOV_AUTO = 1,
+ TWOV_TOPBOTTOM = 2,
+ TWOV_LEFTRIGHT = 3,
+ TWOV_ALL = 4
+}
+
+/** ICAP_PIXELFLAVOR values. */
+declare enum EnumDWT_CapPixelFlavor {
+ /** Zero pixel represents darkest shade. zero pixel represents darkest shade */
+ TWPF_CHOCOLATE = 0,
+ /** Zero pixel represents lightest shade. zero pixel represents lightest shade */
+ TWPF_VANILLA = 1
+}
+
+/** ICAP_PLANARCHUNKY values. */
+declare enum EnumDWT_CapPlanarChunky {
+ TWPC_CHUNKY = 0,
+ TWPC_PLANAR = 1
+}
+
+/** CAP_PRINTER values. */
+declare enum EnumDWT_CapPrinter {
+ TWPR_IMPRINTERTOPBEFORE = 0,
+ TWPR_IMPRINTERTOPAFTER = 1,
+ TWPR_IMPRINTERBOTTOMBEFORE = 2,
+ TWPR_IMPRINTERBOTTOMAFTER = 3,
+ TWPR_ENDORSERTOPBEFORE = 4,
+ TWPR_ENDORSERTOPAFTER = 5,
+ TWPR_ENDORSERBOTTOMBEFORE = 6,
+ TWPR_ENDORSERBOTTOMAFTER = 7
+}
+
+/** CAP_PRINTERMODE values. */
+declare enum EnumDWT_CapPrinterMode {
+ /** Specifies that the printed text will consist of a single string. */
+ TWPM_SINGLESTRING = 0,
+ /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */
+ TWPM_MULTISTRING = 1,
+ /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */
+ TWPM_COMPOUNDSTRING = 2
+}
+
/** TWAIN Supported sizes. */
declare enum EnumDWT_CapSupportedSizes {
/** 0 */
@@ -1046,180 +1050,68 @@ declare enum EnumDWT_CapSupportedSizes {
TWSS_MAXSIZE = 54
}
-/** CAP_FEEDERALIGNMENT values. */
-declare enum EnumDWT_CapFeederAlignment {
- /** The alignment is free-floating. Applications should assume that the origin for frames is on the left. */
- TWFA_NONE = 0,
- /** The alignment is to the left. */
- TWFA_LEFT = 1,
- /** The alignment is centered. This means that the paper will be fed in the middle of the ICAP_PHYSICALWIDTH of the
- * device. If this is set, then the Application should calculate any frames with a left offset of zero.
+/** Capabilities exist in many varieties but all have a Default Value, Current Value, and may have other values available that can be supported if selected.
+ * To help categorize the supported values into clear structures, TWAIN defines four types of containers for capabilities =
+ * TW_ONEVALUE, TW_ARRAY, TW_RANGE and TW_ENUMERATION.
+ */
+declare enum EnumDWT_CapType {
+ /** Nothing. */
+ TWON_NONE = 0,
+ /** A rectangular array of values that describe a logical item. It is similar to the TW_ONEVALUE because the current and default values are the same and
+ * there are no other values to select from. For example, a list of the names, such as the supported capabilities list returned by the CAP_SUPPORTEDCAPS
+ * capability, would use this type of container.
*/
- TWFA_CENTER = 2,
- /** The alignment is to the right. */
- TWFA_RIGHT = 3
-}
-/** CAP_FEEDERORDER values. */
-declare enum EnumDWT_CapFeederOrder {
- /** The feeder starts with the top of the first page. */
- TWFO_FIRSTPAGEFIRST = 0,
- /** The feeder starts with the top of the last page. */
- TWFO_LASTPAGEFIRST = 1
+ TWON_ARRAY = 3,
+ /** This is the most general type because it defines a list of values from which the Current Value can be chosen.
+ * The values do not progress uniformly through a range and there is not a consistent step size between the values.
+ * For example, if a Source's resolution options do not occur in even step sizes then an enumeration would be used (for example, 150, 400, and 600).
+ */
+ TWON_ENUMERATION = 4,
+ /** A single value whose current and default values are coincident. The range of available values for this type of capability is simply this single value.
+ * For example, a capability that indicates the presence of a document feeder could be of this type.
+ */
+ TWON_ONEVALUE = 5,
+ /** Many capabilities allow users to select their current value from a range of regularly spaced values.
+ * The capability can specify the minimum and maximum acceptable values and the incremental step size between the values.
+ * For example, resolution might be supported from 100 to 600 in steps of 50 (100, 150, 200, ..., 550, 600).
+ */
+ TWON_RANGE = 6
}
-/** CAP_PRINTER values. */
-declare enum EnumDWT_CapPrinter {
- TWPR_IMPRINTERTOPBEFORE = 0,
- TWPR_IMPRINTERTOPAFTER = 1,
- TWPR_IMPRINTERBOTTOMBEFORE = 2,
- TWPR_IMPRINTERBOTTOMAFTER = 3,
- TWPR_ENDORSERTOPBEFORE = 4,
- TWPR_ENDORSERTOPAFTER = 5,
- TWPR_ENDORSERBOTTOMBEFORE = 6,
- TWPR_ENDORSERBOTTOMAFTER = 7
+/** The kind of data stored in the container. */
+declare enum EnumDWT_CapValueType {
+ TWTY_INT8 = 0,
+ /** Means Item is a TW_INT16 */
+ TWTY_INT16 = 1,
+ /** Means Item is a TW_INT32 */
+ TWTY_INT32 = 2,
+ /** Means Item is a TW_UINT8 */
+ TWTY_UINT8 = 3,
+ /** Means Item is a TW_UINT16 */
+ TWTY_UINT16 = 4,
+ /** Means Item is a TW_int */
+ TWTY_int = 5,
+ /** Means Item is a TW_BOOL */
+ TWTY_BOOL = 6,
+ /** Means Item is a TW_FIX32 */
+ TWTY_FIX32 = 7,
+ /** Means Item is a TW_FRAME */
+ TWTY_FRAME = 8,
+ /** Means Item is a TW_STR32 */
+ TWTY_STR32 = 9,
+ /** Means Item is a TW_STR64 */
+ TWTY_STR64 = 10,
+ /** Means Item is a TW_STR128 */
+ TWTY_STR128 = 11,
+ /** Means Item is a TW_STR255 */
+ TWTY_STR255 = 12
}
-/** CAP_PRINTERMODE values. */
-declare enum EnumDWT_CapPrinterMode {
- /** Specifies that the printed text will consist of a single string. */
- TWPM_SINGLESTRING = 0,
- /** Specifies that the printed text will consist of an enumerated list of strings to be printed in order. */
- TWPM_MULTISTRING = 1,
- /** Specifies that the printed string will consist of a compound of a String followed by a value followed by a suffix string. */
- TWPM_COMPOUNDSTRING = 2
-}
-
-/** ICAP_BITDEPTHREDUCTION values. */
-declare enum EnumDWT_CapBitdepthReduction {
- TWBR_THRESHOLD = 0,
- TWBR_HALFTONE = 1,
- TWBR_CUSTHALFTONE = 2,
- TWBR_DIFFUSION = 3
-}
-
-/** ICAP_BITORDER values. */
-declare enum EnumDWT_CapBitOrder {
- TWBO_LSBFIRST = 0,
- /** Indicates that the leftmost bit in the byte (usually bit 7) is the byte's Most Significant Bit. */
- TWBO_MSBFIRST = 1
-}
-
-/** ICAP_FILTER values. */
-declare enum EnumDWT_CapFilterType {
- TWFT_RED = 0,
- TWFT_GREEN = 1,
- TWFT_BLUE = 2,
- TWFT_NONE = 3,
- TWFT_WHITE = 4,
- TWFT_CYAN = 5,
- TWFT_MAGENTA = 6,
- TWFT_YELLOW = 7,
- TWFT_BLACK = 8
-}
-
-/** ICAP_FLASHUSED2 values. */
-declare enum EnumDWT_CapFlash {
- TWFL_NONE = 0,
- TWFL_OFF = 1,
- TWFL_ON = 2,
- TWFL_AUTO = 3,
- TWFL_REDEYE = 4
-}
-
-/** ICAP_FLIPROTATION values. */
-declare enum EnumDWT_CapFlipRotation {
- /** The images to be scanned are viewed in book form, flipping each page from left to right or right to left. */
- TWFR_BOOK = 0,
- /** The images to be scanned are viewed in fanfold paper style, flipping each page up or down. */
- TWFR_FANFOLD = 1
-}
-
-/** ICAP_IMAGEFILTER values. */
-declare enum EnumDWT_CapImageFilter {
- TWIF_NONE = 0,
- TWIF_AUTO = 1,
- /** Good for halftone images. */
- TWIF_LOWPASS = 2,
- /** Good for improving text. */
- TWIF_BANDPASS = 3,
- /** Good for improving fine lines. */
- TWIF_HIGHPASS = 4,
- TWIF_TEXT = 3,
- TWIF_FINELINE = 4
-}
-
-/** ICAP_LIGHTPATH values. */
-declare enum EnumDWT_CapLightPath {
- TWLP_REFLECTIVE = 0,
- TWLP_TRANSMISSIVE = 1
-}
-
-/** ICAP_LIGHTSOURCE values. */
-declare enum EnumDWT_CapLightSource {
- TWLS_RED = 0,
- TWLS_GREEN = 1,
- TWLS_BLUE = 2,
- TWLS_NONE = 3,
- TWLS_WHITE = 4,
- TWLS_UV = 5,
- TWLS_IR = 6
-}
-
-/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */
-declare enum EnumDWT_MagType {
- /** Added 2.0 */
- TWMD_MICR = 0,
- /** added 2.1 */
- TWMD_RAW = 1,
- /** added 2.1 */
- TWMD_INVALID = 2
-}
-
-/** ICAP_NOISEFILTER values. */
-declare enum EnumDWT_CapNoiseFilter {
- TWNF_NONE = 0,
- TWNF_AUTO = 1,
- TWNF_LONEPIXEL = 2,
- TWNF_MAJORITYRULE = 3
-}
-
-/** ICAP_ORIENTATION values. */
-declare enum EnumDWT_CapORientation {
- TWOR_ROT0 = 0,
- TWOR_ROT90 = 1,
- TWOR_ROT180 = 2,
- TWOR_ROT270 = 3,
- TWOR_PORTRAIT = 0,
- TWOR_LANDSCAPE = 3,
- /** 2.0 */
- TWOR_AUTO = 4,
- /** 2.0 */
- TWOR_AUTOTEXT = 5,
- /** 2.0 */
- TWOR_AUTOPICTURE = 6
-}
-
-/** ICAP_OVERSCAN values. */
-declare enum EnumDWT_CapOverscan {
- TWOV_NONE = 0,
- TWOV_AUTO = 1,
- TWOV_TOPBOTTOM = 2,
- TWOV_LEFTRIGHT = 3,
- TWOV_ALL = 4
-}
-
-/** ICAP_PIXELFLAVOR values. */
-declare enum EnumDWT_CapPixelFlavor {
- /** Zero pixel represents darkest shade. zero pixel represents darkest shade */
- TWPF_CHOCOLATE = 0,
- /** Zero pixel represents lightest shade. zero pixel represents lightest shade */
- TWPF_VANILLA = 1
-}
-
-/** ICAP_PLANARCHUNKY values. */
-declare enum EnumDWT_CapPlanarChunky {
- TWPC_CHUNKY = 0,
- TWPC_PLANAR = 1
+/** ICAP_DUPLEX values. */
+declare enum EnumDWT_DUPLEX {
+ TWDX_NONE = 0,
+ TWDX_1PASSDUPLEX = 1,
+ TWDX_2PASSDUPLEX = 2
}
/** Data source status. */
@@ -1234,6 +1126,48 @@ declare enum EnumDWT_DataSourceStatus {
TWDSS_ACQUIRING = 3
}
+declare enum EnumDWT_Error {
+ ModuleNotExists = -2371
+}
+
+/** ICAP_IMAGEFILEFORMAT values. */
+declare enum EnumDWT_FileFormat {
+ /** Used for document imaging. Tagged Image File Format */
+ TWFF_TIFF = 0,
+ /** Native Macintosh format. Macintosh PICT */
+ TWFF_PICT = 1,
+ /** Native Microsoft format. Windows Bitmap */
+ TWFF_BMP = 2,
+ /** Used for document imaging. X-Windows Bitmap */
+ TWFF_XBM = 3,
+ /** Wrapper for JPEG images. JPEG File Interchange Format */
+ TWFF_JFIF = 4,
+ /** FlashPix, used with digital cameras. Flash Pix */
+ TWFF_FPX = 5,
+ /** Multi-page TIFF files. Multi-page tiff file */
+ TWFF_TIFFMULTI = 6,
+ /** An image format standard intended for use on the web, replaces GIF. */
+ TWFF_PNG = 7,
+ /** A standard from JPEG, intended to replace JFIF, also supports JBIG. */
+ TWFF_SPIFF = 8,
+ /** File format for use with digital cameras. */
+ TWFF_EXIF = 9,
+ /** A file format from Adobe. 1.91 NB: this is not PDF/A */
+ TWFF_PDF = 10,
+ /** A file format from the Joint Photographic Experts Group. 1.91 */
+ TWFF_JP2 = 11,
+ /** 1.91 */
+ TWFF_JPN = 12,
+ /** 1.91 */
+ TWFF_JPX = 13,
+ /** A file format from LizardTech. 1.91 */
+ TWFF_DEJAVU = 14,
+ /** A file format from Adobe. 2.0 */
+ TWFF_PDFA = 15,
+ /** 2.1 Adobe PDF/A, Version 2 */
+ TWFF_PDFA2 = 16
+}
+
/** Fit window type */
declare enum EnumDWT_FitWindowType {
/** Fit the image to the width and height of the window */
@@ -1244,18 +1178,186 @@ declare enum EnumDWT_FitWindowType {
enumFitWindowWidth = 2
}
-declare enum EnumDWT_UploadDataFormat {
- Binary = 0,
- Base64 = 1
+/** Image type */
+declare enum EnumDWT_ImageType {
+ /** Native Microsoft format. */
+ IT_BMP = 0,
+ /** JPEG format. */
+ IT_JPG = 1,
+ /** Tagged Image File Format. */
+ IT_TIF = 2,
+ /** An image format standard intended for use on the web, replaces GIF. */
+ IT_PNG = 3,
+ /** A file format from Adobe. */
+ IT_PDF = 4,
+ /** All supported formats which are bmp, jpg, tif, png and pdf */
+ IT_ALL = 5
+}
+
+declare enum EnumDWT_InitMsg {
+ Info = 1,
+ Error = 2,
+ NotInstalledError = 3,
+ DownloadError = 4,
+ DownloadNotRestartError = 5
+}
+
+/** The method to do interpolation. */
+declare enum EnumDWT_InterpolationMethod {
+ IM_NEARESTNEIGHBOUR = 1,
+ IM_BILINEAR = 2,
+ IM_BICUBIC = 3,
+ IM_BESTQUALITY = 5
+}
+
+declare enum EnumDWT_Language {
+ English = 0,
+ French = 1,
+ Arabic = 2,
+ Spanish = 3,
+ Portuguese = 4,
+ German = 5,
+ Italian = 6,
+ Russian = 7,
+ Chinese = 8
+}
+
+/** TWEI_MAGTYPE values. (MD_ means Mag Type) Added 2.0 */
+declare enum EnumDWT_MagType {
+ /** Added 2.0 */
+ TWMD_MICR = 0,
+ /** added 2.1 */
+ TWMD_RAW = 1,
+ /** added 2.1 */
+ TWMD_INVALID = 2
+}
+
+/** For query the operation that are supported by the data source on a capability .
+ * Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT
+ */
+declare enum EnumDWT_MessageType {
+ TWQC_GET = 1,
+ TWQC_SET = 2,
+ TWQC_GETDEFAULT = 4,
+ TWQC_GETCURRENT = 8,
+ TWQC_RESET = 16
}
declare enum EnumDWT_MouseShape {
- Default = 0,
- Hand = 1,
- Crosshair = 2,
- Zoom = 3
+ Default = 0,
+ Hand = 1,
+ Crosshair = 2,
+ Zoom = 3
}
+/** PDF file compression type. */
+declare enum EnumDWT_PDFCompressionType {
+ /** Auto mode. */
+ PDF_AUTO = 0,
+ /** CCITT Group 3 fax encoding. */
+ PDF_FAX3 = 1,
+ /** CCITT Group 4 fax encoding */
+ PDF_FAX4 = 2,
+ /** Lempel Ziv and Welch */
+ PDF_LZW = 3,
+ /** CCITT modified Huffman RLE. */
+ PDF_RLE = 4,
+ /** JPEG compression. */
+ PDF_JPEG = 5
+}
+
+/** ICAP_PIXELTYPE values (PT_ means Pixel Type) */
+declare enum EnumDWT_PixelType {
+ TWPT_BW = 0,
+ TWPT_GRAY = 1,
+ TWPT_RGB = 2,
+ TWPT_PALLETE = 3,
+ TWPT_CMY = 4,
+ TWPT_CMYK = 5,
+ TWPT_YUV = 6,
+ TWPT_YUVK = 7,
+ TWPT_CIEXYZ = 8,
+ TWPT_LAB = 9,
+ TWPT_SRGB = 10,
+ TWPT_SCRGB = 11,
+ TWPT_INFRARED = 16
+}
+
+declare enum EnumDWT_PlatformType {
+ /// Fit the image to the width and height of the window
+ enumWindow = 0,
+ /// Fit the image to the height of the window
+ enumMac = 1,
+ /// Fit the image to the width of the window
+ enumLinux = 2
+}
+
+declare enum EnumDWT_ShowMode {
+ /** Activates the window and displays it in its current size and position. */
+ SW_ACTIVE = 0,
+ /** Maximizes the window */
+ SW_MAX = 1,
+ /** Minimize the window */
+ SW_MIN = 2,
+ /** Close the latest opened editor window */
+ SW_CLOSE = 3,
+ /** Check whether a window exists */
+ SW_IFLIVE = 4
+}
+
+/** TIFF file compression type. */
+declare enum EnumDWT_TIFFCompressionType {
+ /** Auto mode. */
+ TIFF_AUTO = 0,
+ /** Dump mode. */
+ TIFF_NONE = 1,
+ /** CCITT modified Huffman RLE. */
+ TIFF_RLE = 2,
+ /** CCITT Group 3 fax encoding. */
+ TIFF_FAX3 = 3,
+ /** CCITT T.4 (TIFF 6 name). */
+ TIFF_T4 = 3,
+ /** CCITT Group 4 fax encoding */
+ TIFF_FAX4 = 4,
+ /** CCITT T.6 (TIFF 6 name). */
+ TIFF_T6 = 4,
+ /** Lempel Ziv and Welch */
+ TIFF_LZW = 5,
+ TIFF_JPEG = 7,
+ TIFF_PACKBITS = 32773
+}
+
+/** ICAP_XFERMECH values. */
+declare enum EnumDWT_TransferMode {
+ /** Native transfers require the data to be transferred to a single large block of RAM. Therefore,
+ * they always face the risk of having an inadequate amount of RAM available to perform the transfer successfully.
+ */
+ TWSX_NATIVE = 0,
+ /** Disk File Mode Transfers. */
+ TWSX_FILE = 1,
+ /** Buffered Memory Mode Transfers. */
+ TWSX_MEMORY = 2/*,*/
+ /** added 1.91 , not supported in DWT yet*/
+ /** TWSX_MEMFILE = 4*/
+}
+
+/** ICAP_UNITS values. */
+declare enum EnumDWT_UnitType {
+ TWUN_INCHES = 0,
+ TWUN_CENTIMETERS = 1,
+ TWUN_PICAS = 2,
+ TWUN_POINTS = 3,
+ TWUN_TWIPS = 4,
+ TWUN_PIXELS = 5,
+ TWUN_MILLIMETERS = 6
+}
+
+declare enum EnumDWT_UploadDataFormat {
+ Binary = 0,
+ Base64 = 1
+}
+
+/** interface for a DWT container which basically defines a DIV on the page */
interface Container {
ContainerId: string;
Width: string | number;
@@ -1268,62 +1370,85 @@ interface Container {
// properties (get/set) / sync functions
interface WebTwain {
/**
- * Returns or sets whether multi-page selection is supported.
- * @type {bool}
+ * Returns whether the instance of a DWT is initialized
+ * @type {boolean}
*/
+ bReady: boolean;
+
+ /**
+ * Returns the runtime id of the dwt object
+ * @type {string}
+ */
+ readonly clientId: string;
+
+ /**
+ * Returns the runtime class for the dwt container DIV
+ * @type {string}
+ */
+ containerClass: string;
+
+ /*ignored
+ httpUrl
+ objectName
+
+ ...other internal ones
+ */
+
+ /*
+ * Properties
+ */
+
+ /**
+ * Returns or sets whether multi-page selection is supported.
+ * @type {boolean}
+ */
AllowMultiSelect: boolean;
/**
* [Deprecated.] Returns or sets whether allowing the plugin to send authentication request. The default value of this property is TRUE.
- * @type {bool}
+ * @type {boolean}
*/
AllowPluginAuthentication: boolean;
/**
* [Deprecated.] Returns or sets whether the async mode is activated. With this mode, Dynamic Web TWAIN is able to upload/download files via HTTP/FTP asynchronously. The default value is false.
- * @type {bool}
+ * @type {boolean}
*/
AsyncMode: boolean;
/**
* Returns or sets the background color of the main control. It is a value specifying the 24-bit RGB value.
- * @type {int}
+ * @type {number}
*/
BackgroundColor: number;
/**
* Returns or sets the fill color of the selected area of an image when it is cut, erased or rotated. It is a value specifying the 24-bit RGB value.
- * @type {int}
+ * @type {number}
*/
BackgroundFillColor: number;
- /**
- * [Deprecated.] Returns the number of barcode detected in an image.
- * @type {int}
- */
- BarcodeCount: number;
-
/**
* Returns or sets the pixel bit depths for the current value of PixelType property. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
BitDepth: number;
/**
* Returns the current deviation of the pixels in the image.
- * @type {float}
+ * @type {number}
*/
BlankImageCurrentStdDev: number;
/**
* Returns or sets the standard deviation of the pixels in the image.
- * @type {float}
+ * @type {number}
*/
BlankImageMaxStdDev: number;
/**
* Returns or sets the dividing line between black and white. The default value is 128.
- * @type {int}
+ * @type {number}
*/
BlankImageThreshold: number;
@@ -1335,79 +1460,73 @@ interface WebTwain {
/**
* Returns or sets the brightness values available within the Source. This is a runtime property.
- * @type {float}
+ * @type {number}
*/
Brightness: number;
/**
* [Deprecated.] Sets or returns whether brokerprocess is enabled for scanning.
- * @type {int}
+ * @type {number}
*/
BrokerProcessType: number;
/**
* Sets or returns how much physical memory is allowed for storing images currently loaded in Dynamic Web TWAIN. Once the limit is reached, images will be cached on the hard disk.
- * @type {int}
+ * @type {number}
*/
BufferMemoryLimit: number;
- /**
- * Specifies the capabiltiy to be negotiated. This is a runtime property.
- * @type {EnumDWT_Cap}
- */
- Capability: EnumDWT_Cap;
-
/**
* Sets or returns the index (0-based) of a list to indicate the Current Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
CapCurrentIndex: number;
/**
* Sets or returns the current value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapCurrentValue: number;
/**
* Returns the index (0-based) of a list to indicate the Default Value when the value of the CapType property is TWON_ENUMERATION. If the data type of the capability is String, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
CapDefaultIndex: number;
/**
* Returns the default value in a range when the value of the CapType property is TWON_RANGE. This is a runtime, read-only property.
- * @type {double}
+ * @type {number}
*/
CapDefaultValue: number;
+ /**
+ * Retruns the description for a capability
+ * @type {string}
+ */
+ CapDescription: string;
+
/**
* Sets or returns the maximum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapMaxValue: number;
/**
* Sets or returns the minimum value in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapMinValue: number;
/**
* [Deprecated.] Sets or returns how many items are in the list when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION. For String data type, the list is in CapItemsString property. For other data types, the list is in CapItems property. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
CapNumItems: number;
- /**
- * [Deprecated.] Replaced by GetCapItemsString method and SetCapItemsString method.
- * @type {string}
- */
- CapItemsString: string;
-
/**
* Sets or returns the step size in a range when the value of the CapType property is TWON_RANGE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapStepSize: number;
@@ -1419,7 +1538,7 @@ interface WebTwain {
/**
* Returns or sets the value of the capability specified by Capability property when the value of the CapType property is TWON_ONEVALUE. This is a runtime property.
- * @type {double}
+ * @type {number}
*/
CapValue: number;
@@ -1431,25 +1550,25 @@ interface WebTwain {
/**
* Sets or returns the value type for reading the value of a capability. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
CapValueType: number;
+ /**
+ * Specifies the capabiltiy to be negotiated. This is a runtime property.
+ * @type {EnumDWT_Cap}
+ */
+ Capability: EnumDWT_Cap;
+
/**
* Returns or sets the contrast values available within the Source. This is a runtime property.
- * @type {float}
+ * @type {number}
*/
Contrast: number;
- /**
- * Sets or returns the product name string for the application identity.
- * @type {string}
- */
- ProductName: string;
-
/**
* Returns or sets current index of image in buffer. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
CurrentImageIndexInBuffer: number;
@@ -1461,7 +1580,7 @@ interface WebTwain {
/**
* Returns the value indicating the data source status. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
DataSourceStatus: number;
@@ -1473,19 +1592,19 @@ interface WebTwain {
/**
* Returns whether the source supports duplex. If so, it further returns the level of duplex the Source supports (one pass or two pass duplex). This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
Duplex: number;
/**
* [Deprecated.] Returns or sets whether the user can zoom image using hot key.
- * @type {bool}
+ * @type {boolean}
*/
EnableInteractiveZoom: boolean;
/**
* Returns the error code. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ErrorCode: number;
@@ -1495,12 +1614,6 @@ interface WebTwain {
*/
ErrorString: string;
- /**
- * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode.
- * @type {EnumDWT_FitWindowType}
- */
- FitWindowType: EnumDWT_FitWindowType;
-
/**
* Returns or sets the password used to log into the FTP server.
* @type {string}
@@ -1509,7 +1622,7 @@ interface WebTwain {
/**
* Returns or sets the port number of the FTP server.
- * @type {int}
+ * @type {number}
*/
FTPPort: number;
@@ -1519,12 +1632,42 @@ interface WebTwain {
*/
FTPUserName: string;
+ /**
+ * Returns or sets whether to resize the image to fit the image to the width or height of the window. To use the property, the view mode should be set to -1 by -1. You can use SetViewMode method to set the view mode.
+ * @type {EnumDWT_FitWindowType}
+ */
+ FitWindowType: EnumDWT_FitWindowType;
+
+ /**
+ * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property.
+ * @type {string}
+ */
+ HTTPPostResponseString: string;
+
+ /**
+ * Returns whether a HTTP request has credentials
+ * @type {boolean}
+ */
+ HTTPRequestswithCredentials: boolean;
+
+ /**
+ * Returns or sets the height of the dwt viewer object
+ * @type {string|number}
+ */
+ Height: string | number;
+
/**
* Returns how many images are in buffer. This is a runtime, read-only property.
- * @type {short}
+ * @type {number}
*/
HowManyImagesInBuffer: number;
+ /**
+ * Specifies the content type of a http upload.
+ * @type {string}
+ */
+ HttpContentTypeFieldValue: string;
+
/**
* Specifies the field name of uploaded image through POST.
* @type {string}
@@ -1539,15 +1682,9 @@ interface WebTwain {
/**
* Returns or sets the port number of the HTTP server.
- * @type {int}
+ * @type {number|string}
*/
- HTTPPort: number;
-
- /**
- * Returns the response string from the HTTP server if an error occurs for HTTPUploadThroughPost() method. This is a runtime, read-only property.
- * @type {string}
- */
- HTTPPostResponseString: string;
+ HTTPPort: number | string;
/**
* [Deprecated.] Returns or sets the user name used to log into the HTTP server.
@@ -1557,205 +1694,211 @@ interface WebTwain {
/**
* Returns or sets whether the feature of disk caching is enabled.
- * @type {bool}
+ * @type {boolean}
*/
IfAllowLocalCache: boolean;
/**
* Returns or sets whether insert or append new scanned images.
- * @type {bool}
+ * @type {boolean}
*/
IfAppendImage: boolean;
/**
* Returns or sets whether the Source's Auto-brightness function is enabled. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfAutoBright: boolean;
/**
* Returns or sets whether the data source (scanner) will discard blank images during scanning. The property works only if the device and its driver support discarding blank pages. You can find whether your device supports this capbility from its user manual. Or, you can use the built-in methods of Dynamic Web TWAIN to detect blank images: IsBlankImage, IsBlankImageEx.
- * @type {bool}
+ * @type {boolean}
*/
IfAutoDiscardBlankpages: boolean;
/**
* Returns or sets whether the Source enable automatic document feeding process. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfAutoFeed: boolean;
+ /**
+ * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property.
+ * @type {boolean}
+ */
+ IfAutoScan: boolean;
+
+ /**
+ * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images
+ * @type {boolean}
+ */
+ IfAutoScroll: boolean;
+
/**
* Turns automatic border detection on and off. The property works only if the device and its driver support detecting the border automatically. You can find whether your device supports this capbility from its user manual.
- * @type {bool}
+ * @type {boolean}
*/
IfAutomaticBorderDetection: boolean;
/**
* Turns automatic skew correction on and off.
- * @type {bool}
+ * @type {boolean}
*/
IfAutomaticDeskew: boolean;
- /**
- * Returns or sets whether the Source enables the automatic document scanning process. This is a runtime property.
- * @type {bool}
- */
- IfAutoScan: boolean;
-
/**
* Returns or sets whether close the Data Source User Interface after acquire all images. Default value of this property is FALSE.
- * @type {bool}
+ * @type {boolean}
*/
IfDisableSourceAfterAcquire: boolean;
/**
* Returns or sets whether the Source supports duplex. If TRUE, the scanner scans both sides of a paper; otherwise, the scanner will scan only one side of the image. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfDuplexEnabled: boolean;
/**
* Returns or sets whether the Automatic Document Feeder (ADF) is enabled. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfFeederEnabled: boolean;
/**
* Returns whether or not there are documents loaded in the Source's feeder when IfFeederEnabled and IfPaperDetectable are TRUE. This is a runtime, read-only property.
- * @type {bool}
+ * @type {boolean}
*/
IfFeederLoaded: boolean;
/**
* Returns or sets whether to resize the image to fit the size of window when the view mode is set to -1 by -1. You can use SetViewMode method to set the view mode.
- * @type {bool}
+ * @type {boolean}
*/
IfFitWindow: boolean;
/**
* [Deprecated.] Returns or sets whether the UI (User Interface) of Source runs in modal state. Default value of this property is TRUE.
- * @type {bool}
+ * @type {boolean}
*/
IfModalUI: boolean;
/**
* Sets or returns whether Dynamic Web TWAIN uses Graphics Device Interface (GDI) when decoding images.
- * @type {bool}
+ * @type {boolean}
*/
IfOpenImageWithGDIPlus: boolean;
- /**
- * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property.
- * @type {bool}
- */
- IfPaperDetectable: boolean;
-
/**
* Returns or sets whether FTP passive mode is enabled.
- * @type {bool}
+ * @type {boolean}
*/
IfPASVMode: boolean;
+ /**
+ * Returns the value whether the Source has a paper sensor that can detect documents on the ADF or Flatbed. This is a runtime, read-only property.
+ * @type {boolean}
+ */
+ IfPaperDetectable: boolean;
+
+ /**
+ * Returns or sets whether SSL is used when uploading or downloading images.
+ * @type {boolean}
+ */
+ IfSSL: boolean;
+
/**
* [Deprecated.] Returns or sets whether communicate with device in a separate thread. Default value of this property is FALSE.
- * @type {bool}
+ * @type {boolean}
*/
IfScanInNewThread: boolean;
/**
* Sets or returns whether to show the cancel dialog when uploading images to server.
- * @type {bool}
+ * @type {boolean}
*/
IfShowCancelDialogWhenImageTransfer: boolean;
/**
* Returns or sets whether to show the file dialog box when saving scanned images or loading images from local folder.
- * @type {bool}
+ * @type {boolean}
*/
IfShowFileDialog: boolean;
/**
* Returns or sets whether the Source displays a progress indicator during acquisition and transfer, regardless of whether the Source's user interface is active. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfShowIndicator: boolean;
/**
* [Deprecated.] Returns or sets whether the driver of the printer displays the User Interface.
- * @type {bool}
+ * @type {boolean}
*/
IfShowPrintUI: boolean;
/**
* Returns or sets whether the progress bar will be displayed during the transaction. This is a runtime property.
- * @type {bool}
+ * @type {boolean}
*/
IfShowProgressBar: boolean;
/**
* Returns or sets whether the Source displays the User Interface.
- * @type {bool}
+ * @type {boolean}
*/
IfShowUI: boolean;
/**
- * Returns or sets whether SSL is used when uploading or downloading images.
- * @type {bool}
+ * Returns or sets whether to throw exceptions
+ * @type {boolean}
*/
- IfSSL: boolean;
+ IfThrowException: boolean;
/**
* Return or sets whether the Source allows to save many images in one TIFF file. The default value is FALSE.
- * @type {bool}
+ * @type {boolean}
*/
IfTiffMultiPage: boolean;
/**
* Returns whether the Source supports acquisition with the UI (User Interface) disabled. If FALSE, indicates that this Source can only support acquisition with the UI enabled. This is a runtime, read-only property.
- * @type {bool}
+ * @type {boolean}
*/
IfUIControllable: boolean;
/**
* Sets or returns whether Dynamic Web TWAIN uses the new TWAIN Data Source Manager (TWAINDSM.dll) when acquiring images from TWAIN devices.
- * @type {bool}
+ * @type {boolean}
*/
IfUseTwainDSM: boolean;
- /**
- * Specifies whether or not to automatically scroll to the last image or stay on the current image when loading or acquiring images
- * @type {bool}
- */
- IfAutoScroll: boolean;
-
/**
* [Deprecated.] The number of bits in each image pixel (or bit depth). This is a runtime, read-only property.
- * @type {short}
+ * @type {number}
*/
ImageBitsPerPixel: number;
/**
* Returns or sets whether a TWAIN driver or Native Scan of Mac OS X is used for document scanning. This property works for Mac edition only.
- * @type {int}
+ * @type {number}
*/
ImageCaptureDriverType: number;
/**
* [Deprecated.] Returns or sets whether the image enumerator is enabled in Image Editor.
- * @type {bool}
+ * @type {boolean}
*/
ImageEditorIfEnableEnumerator: boolean;
/**
* [Deprecated.] Returns or sets whether the Image Editor is a modal window.
- * @type {bool}
+ * @type {boolean}
*/
ImageEditorIfModal: boolean;
/**
* [Deprecated.] Returns or sets whether the Image Editor is read-only.
- * @type {bool}
+ * @type {boolean}
*/
ImageEditorIfReadonly: boolean;
@@ -1767,37 +1910,37 @@ interface WebTwain {
/**
* Returns the document number of the current image. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageLayoutDocumentNumber: number;
/**
* Returns the value of the bottom-most edge of the current image frame (in Unit). This is a read-only runtime property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameBottom: number;
/**
* Returns the value of the left-most edge of the current image frame (in Unit). This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameLeft: number;
/**
* Returns the frame number of the current image. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageLayoutFrameNumber: number;
/**
* Returns the value of the right-most edge of the current image frame (in Unit). This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameRight: number;
/**
* Returns the value of the top-most edge of the current image frame (in Unit). This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageLayoutFrameTop: number;
@@ -1809,13 +1952,13 @@ interface WebTwain {
/**
* [Deprecated.] Returns how tall/long, in pixels, the image is. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageLength: number;
/**
* Returns or sets the margin between images when multiple images are displayed in Dynamic Web TWAIN.
- * @type {short}
+ * @type {number}
*/
ImageMargin: number;
@@ -1827,31 +1970,31 @@ interface WebTwain {
/**
* [Deprecated.] Returns how width, in pixels, the image is. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
ImageWidth: number;
/**
* [Deprecated.] Returns the X resolution of the current image. X resolution is the number of pixels per Unit in the horizontal direction. This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageXResolution: number;
/**
* [Deprecated.] Returns the Y resolution of the current image. Y resolution is the number of pixels per Unit in the vertical direction. This is a runtime, read-only property.
- * @type {float}
+ * @type {number}
*/
ImageYResolution: number;
/**
* Returns or sets the quality of JPEG files and PDF files using JPEG compression.
- * @type {short}
+ * @type {number}
*/
JPEGQuality: number;
/**
* Returns or sets the log level for debugging.
- * @type {short}
+ * @type {number}
*/
LogLevel: number;
@@ -1863,7 +2006,7 @@ interface WebTwain {
/**
* Return the magnetic type if the scanner support magnetic data recognition.
- * @type {short}
+ * @type {number}
*/
MagType: number;
@@ -1875,46 +2018,40 @@ interface WebTwain {
/**
* Returns or sets the maximum number of images can be held in buffer.
- * @type {short}
+ * @type {number}
*/
MaxImagesInBuffer: number;
/**
* [Deprecated.] Returns or sets how many threads can be used when you upload files through POST.
- * @type {int}
+ * @type {number}
*/
MaxInternetTransferThreads: number;
/**
* Sets or returns the maximum allowed size when Dynamic Web TWAIN uploads a document.
- * @type {int}
+ * @type {number}
*/
MaxUploadImageSize: number;
/**
* Returns or sets the shape of the mouse.
- * @type {bool}
+ * @type {boolean}
*/
MouseShape: boolean;
/**
* Returns the X co-ordinate of the mouse. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
MouseX: number;
/**
* Returns the Y co-ordinate of the mouse. This is a runtime property.
- * @type {int}
+ * @type {number}
*/
MouseY: number;
- /**
- * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property.
- * @type {short}
- */
- PageSize: number;
-
/**
* Returns or sets the name of the person who creates the PDF document.
* @type {string}
@@ -1975,15 +2112,21 @@ interface WebTwain {
*/
PDFVersion: string;
+ /**
+ * Returns or sets the page size(s) the Source can/should use to acquire image data. This is a runtime property.
+ * @type {number}
+ */
+ PageSize: number;
+
/**
* Returns the number of transfers the Source is ready to supply, upon demand. This is a runtime, read-only property.
- * @type {short}
+ * @type {number}
*/
PendingXfers: number;
/**
* Returns or sets the pixel flavor for acquired images. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
PixelFlavor: number;
@@ -2005,6 +2148,12 @@ interface WebTwain {
*/
ProductKey: string;
+ /**
+ * Sets or returns the product name string for the application identity.
+ * @type {string}
+ */
+ ProductName: string;
+
/**
* [Deprecated.] Returns or sets the name of the proxy server.
* @type {string}
@@ -2013,46 +2162,40 @@ interface WebTwain {
/**
* Returns or sets the current resolution for acquired images. This is a runtime property.
- * @type {float}
+ * @type {number}
*/
Resolution: number;
/**
* Returns or sets how many scanned images are selected.
- * @type {short}
+ * @type {number}
*/
SelectedImagesCount: number;
/**
* Returns or sets the border color of the selected image. It is a value specifying the 24-bit RGB value.
- * @type {int}
+ * @type {number}
*/
SelectionImageBorderColor: number;
/**
* Specifies a fixed aspect ratio to be used for selecting an area.
- * @type {float}
+ * @type {number}
*/
SelectionRectAspectRatio: number;
+ /**
+ * Specifies whether to show the page number
+ * @type {boolean}
+ */
+ ShowPageNumber: boolean;
+
/**
* Returns how many sources are installed in the system. This is a runtime, read-only property.
- * @type {int}
+ * @type {number}
*/
SourceCount: number;
- /**
- * [Deprecated.] Replaced by GetSourceNameItems method.
- * @type {string}
- */
- SourceNameItems: string;
-
- /**
- * [Deprecated.]
- * @type {string}
- */
- GetSourceNames: string;
-
/**
* Returns or sets the compression type of TIFF files. This is a runtime property.
* @type {EnumDWT_TIFFCompressionType}
@@ -2067,160 +2210,194 @@ interface WebTwain {
/**
* Returns or sets the unit of measure. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
Unit: number;
+ /**
+ * Specifies whether to show the vertical scroll bar
+ * @type {boolean}
+ */
+ VScrollBar: boolean;
+
/**
* Sets or returns the version info string for the application identity.
* @type {string}
*/
VersionInfo: string;
+ /**
+ * Returns or sets the width of the dwt object viewer
+ * @type {string|number}
+ */
+ Width: string | number;
+
/**
* Returns and sets the number of images you are willing to transfer per session. This is a runtime property.
- * @type {short}
+ * @type {number}
*/
XferCount: number;
/**
* Returns or sets zoom factor for the image, only valid When the view mode is set to -1 by -1.
- * @type {float}
+ * @type {number}
*/
Zoom: number;
+ /** ignored
+ style
+ _AutoCropMethod
+ */
/**
- * Binds a specified function to an event, so that the function gets called whenever the event fires.
- * @method WebTwain#RegisterEvent
- * @param {string} name the name of the event that the function is bound to.
- * @param {object} evt specifies the function to call when event fires.
- * @return {bool}
+ * Displays the source's built-in interface to acquire image.
+ * @method WebTwain#AcquireImage
+ * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
*/
- RegisterEvent(name: string, evt: object): boolean;
+ AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
- // --- SCAN start --
+ /**
+ * Add text on an image.
+ * @method WebTwain#AddText
+ * @param {number} sImageIndex the index of the image that you want to add text to.
+ * @param {number} x the x coordinate for the text.
+ * @param {number} y the y coordinate for the text.
+ * @param {string} text the content of the text that you want to add.
+ * @param {number} txtColor the color for the text.
+ * @param {number} backgroundColor the background color.
+ * @param {number} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter.
+ * @param {number} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1
+ * @return {boolean}
+ */
+ AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean;
/**
* Cancels all pending transfers.
* @method WebTwain#CancelAllPendingTransfers
- * @return {bool}
+ * @return {boolean}
*/
CancelAllPendingTransfers(): boolean;
/**
- * Closes Data Source.
- * @method WebTwain#CloseSource
- * @return {bool}
+ * Gets information of the capability specified by the Capability property.
+ * @method WebTwain#CapGet
+ * @return {boolean}
*/
- CloseSource(): boolean;
+ CapGet(): boolean;
/**
- * Closes and unloads Data Source Manager.
- * @method WebTwain#CloseSourceManager
- * @return {bool}
+ * Returns the Source's current Value for the specified capability.
+ * @method WebTwain#CapGetCurrent
+ * @return {boolean}
*/
- CloseSourceManager(): boolean;
+ CapGetCurrent(): boolean;
/**
- * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed.
- * @method WebTwain#DisableSource
- * @return {bool}
+ * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value.
+ * @method WebTwain#CapGetDefault
+ * @return {boolean}
*/
- DisableSource(): boolean;
+ CapGetDefault(): boolean;
/**
- * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE.
- * @method WebTwain#FeedPage
- * @return {bool}
+ * Returns the value of the bottom-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameBottom
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- FeedPage(): boolean;
+ CapGetFrameBottom(index: number): number;
/**
- * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc.
- * @method WebTwain#GetDeviceType
- * @return {int}
+ * Returns the value (in Unit) of the left-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameLeft
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- GetDeviceType(): number;
+ CapGetFrameLeft(index: number): number;
/**
- * Get the source name according to the source index.
- * @method WebTwain#GetSourceNameItems
- * @param {short} index int index. Index is 0-based and can not be greater than SourceCount property.
- * @return {string}
+ * Returns the value (in Unit) of the left-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameRight
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- GetSourceNameItems(index: number): string;
+ CapGetFrameRight(index: number): number;
/**
- * Loads the specified Source into main memory and causes its initialization,
- * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is
- * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source.
- * @method WebTwain#OpenSource
- * @return {bool}
+ * Returns the value (in Unit) of the top-most edge of the specified frame.
+ * @method WebTwain#CapGetFrameTop
+ * @param {number} index specifies the value of which frame to get. The index is 0-based.
+ * @return {number}
*/
- OpenSource(): boolean;
+ CapGetFrameTop(index: number): number;
+
+ /* ignored
+ * CapGetHelp
+ * CapGetLabel
+ * CapGetLabels
+ */
/**
- * Loads and opens Data Source Manager.
- * @method WebTwain#OpenSourceManager
- * @return {bool}
+ * Queries whether the Source supports a particular operation on the capability.
+ * @method WebTwain#CapIfSupported
+ * @param {EnumDWT_MessageType} messageType specifies the type of capability operation.
+ * @return {boolean}
*/
- OpenSourceManager(): boolean;
+ CapIfSupported(messageType: EnumDWT_MessageType): boolean;
/**
- * Reverts the current image layout to the Data Source's default.
- * @method WebTwain#ResetImageLayout
- * @return {bool}
+ * Changes the Current Value of the capability specified by Capability property back to its power-on value.
+ * @method WebTwain#CapReset
+ * @return {boolean}
*/
- ResetImageLayout(): boolean;
+ CapReset(): boolean;
/**
- * Sets the Source to return the current page to the input side of the document feeder and
- * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE.
- * @method WebTwain#RewindPage
- * @return {bool}
+ * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property.
+ * @method WebTwain#CapSet
+ * @return {boolean}
*/
- RewindPage(): boolean;
+ CapSet(): boolean;
/**
- * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI)
- * so that user can choose which Data Source to be the current Source.
- * @method WebTwain#SelectSource
- * @return {bool}
+ * Sets the values of the specified frame.
+ * @method WebTwain#CapSetFrame
+ * @param {number} index specifies the values of which frame to set. The index is 0-based.
+ * @param {number} left the value (in Unit) of the left-most edge of the specified frame.
+ * @param {number} top the value (in Unit) of the top-most edge of the specified frame.
+ * @param {number} right the value (in Unit) of the right-most edge of the specified frame.
+ * @param {number} bottom the value (in Unit) of the bottom-most edge of the specified frame.
+ * @return {boolean}
*/
- SelectSource(): boolean;
+ CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean;
/**
- * Selects the index-the source in SourceNameItems property as the current source.
- * @method WebTwain#SelectSourceByIndex
- * @param {short} index It is the index of SourceNameItems property.
- * @return {bool}
+ * Changes the bitdepth of a specified image.
+ * @method WebTwain#ChangeBitDepth
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sBitDepth specifies the target bit depth.
+ * @param {boolean} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time.
+ * @return {boolean}
*/
- SelectSourceByIndex(index: number): boolean;
+ ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean;
/**
- * Sets file name and file format information used in File Transfer Mode.
- * @method WebTwain#SetFileXferInfo
- * @param {string} fileName the name of the file to be used in transfer.
- * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image.
- * @return {bool}
+ * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately.
+ * @method WebTwain#ChangeImageSize
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} iNewWidth specifies the pixel width of the new image.
+ * @param {number} iNewHeight specifies the pixel height of the new image.
+ * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
+ * @return {boolean}
*/
- SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean;
-
- /**
- * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source.
- * @method WebTwain#SetImageLayout
- * @param {float} left specifies the floating point number for the left side of the image layout rectangle.
- * @param {float} top specifies the floating point number for the top side of the image layout rectangle.
- * @param {float} right specifies the floating point number for the right side of the image layout rectangle.
- * @param {float} bottom specifies the floating point number for the bottom side of the image layout rectangle.
- * @return {bool}
- */
- SetImageLayout(left: number, top: number, right: number, bottom: number): boolean;
+ ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean;
/**
* Clears all the web forms which are used for image uploading.
* @method WebTwain#ClearAllHTTPFormField
- * @return {bool}
+ * @return {boolean}
*/
ClearAllHTTPFormField(): boolean;
@@ -2232,12 +2409,154 @@ interface WebTwain {
ClearTiffCustomTag(): void;
/**
- * Check whether a certain file exists on the local disk.
- * @method WebTwain#FileExists
- * @param {string} localFile specifies the absolute path of the local file.
- * @return {bool}
+ * Closes Data Source.
+ * @method WebTwain#CloseSource
+ * @return {boolean}
*/
- FileExists(localFile: string): boolean;
+ CloseSource(): boolean;
+
+ /**
+ * Closes and unloads Data Source Manager.
+ * @method WebTwain#CloseSourceManager
+ * @return {boolean}
+ */
+ CloseSourceManager(): boolean;
+
+ /**
+ * Closes the current process used to scan
+ * @method WebTwain#CloseWorkingProcess
+ * @return {boolean}
+ */
+ CloseWorkingProcess(): boolean;
+
+ /**
+ * Converts the images specified by the indices to base64.
+ * @method WebTwain#ConvertToBase64
+ * @param {Array} indices indices specifies which images are to be converted to base64.
+ * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Converts the images specified by the indices to base64.
+ * @method WebTwain#ConvertToBase64
+ * @param {Array} indices indices specifies which images are to be converted to base64.
+ * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ ConvertToBlob(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: (result: any) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Changes a specified image to gray scale.
+ * @method WebTwain#ConvertToGrayScale
+ * @param {number} sIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ ConvertToGrayScale(sIndex: number): boolean;
+
+ /**
+ * Copies the image of a specified index in buffer to clipboard in DIB format.
+ * @method WebTwain#CopyToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ CopyToClipboard(sImageIndex: number): boolean;
+
+ /**
+ * Create the font for adding text using the method AddText.
+ * @method WebTwain#CreateTextFont
+ * @param {number} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size.
+ * @param {number} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference.
+ * @param {number} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis.
+ * @param {number} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up.
+ * @param {number} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used.
+ * @param {number} italic Specifies an italic font if set to TRUE.
+ * @param {number} underline Specifies an underlined font if set to TRUE.
+ * @param {number} strikeOut A strikeout font if set to TRUE.
+ * @param {number} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font.
+ * @param {number} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch.
+ * @param {number} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region.
+ * @param {number} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font.
+ * @param {number} pitchAndFamily The pitch and family of the font.
+ * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character.
+ * @return {boolean}
+ */
+ CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean;
+
+ /**
+ * Crops the image of a specified index in buffer.
+ * @method WebTwain#Crop
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Crops the image of a specified index in buffer to clipboard in DIB format.
+ * @method WebTwain#CropToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Cuts the image data in the specified area to the system clipboard in DIB format.
+ * @method WebTwain#CutFrameToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Cuts the image of a specified index in buffer to clipboard in DIB format.
+ * @method WebTwain#CutToClipboard
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ CutToClipboard(sImageIndex: number): boolean;
+
+ /**
+ * Disable the source. If the source's user interface is displayed when the source is enabled, it will be closed.
+ * @method WebTwain#DisableSource
+ * @return {boolean}
+ */
+ DisableSource(): boolean;
+
+ /**
+ * Enables the source to accept image.
+ * @method WebTwain#EnableSource
+ * @return {boolean}
+ */
+ EnableSource(): boolean;
+
+ /**
+ * Clears the specified area of a specified image, and fill the area with the fill color.
+ * @method WebTwain#Erase
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {boolean}
+ */
+ Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
/**
* Downloads an image from the FTP server.
@@ -2246,7 +2565,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the file to be downloaded. It should be the relative path of the file on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPDownload(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2258,7 +2577,7 @@ interface WebTwain {
* @param {string} localFile specify a full path to store the file.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPDownloadDirectly(FTPServer: string, FTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2270,7 +2589,7 @@ interface WebTwain {
* @param {EnumDWT_ImageType} lImageType simage format of the file to be downloaded.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPDownloadEx(FTPServer: string, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2278,11 +2597,11 @@ interface WebTwain {
* Uploads the image of a specified index in the buffer to the FTP server.
* @method WebTwain#FTPUpload
* @param {string} FTPServer the name of the FTP server.
- * @param {short} sImageIndex specifies the index of the image in the buffer. The index is 0-based.
+ * @param {number} sImageIndex specifies the index of the image in the buffer. The index is 0-based.
* @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUpload(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2294,7 +2613,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadDirectly(FTPServer: string, localFile: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2302,12 +2621,12 @@ interface WebTwain {
* Uploads the image of a specified index in the buffer to the FTP server as a specified image format.
* @method WebTwain#FTPUploadEx
* @param {string} FTPServer the name of the FTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
* @param {string} FTPRemoteFile the name of the file to be created on the FTP server. It should be a relative path on the FTP server.
* @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadEx(FTPServer: string, sImageIndex: number, FTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2318,7 +2637,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAllAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2329,7 +2648,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAllAsPDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2340,7 +2659,7 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAsMultiPagePDF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
@@ -2351,994 +2670,49 @@ interface WebTwain {
* @param {string} FTPRemoteFile the name of the image to be uploaded. It should be a relative path on the FTP server.
* @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
* @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * @return {boolean}
*/
FTPUploadAsMultiPageTIFF(FTPServer: string, FTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
/**
- * Downloads an image from the HTTP server.
- * @method WebTwain#HTTPDownload
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * Sets the Source to eject the current page and advance the next page in the document feeder into the feeder acquire area when IfFeederEnabled is TRUE.
+ * @method WebTwain#FeedPage
+ * @return {boolean}
*/
- HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+ FeedPage(): boolean;
/**
- * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN.
- * @method WebTwain#HTTPDownloadDirectly
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server.
- * @param {string} localFile specify the location to store the downloaded file.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * Check whether a certain file exists on the local disk.
+ * @method WebTwain#FileExists
+ * @param {string} localFile specifies the absolute path of the local file.
+ * @return {boolean}
*/
- HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+ FileExists(localFile: string): boolean;
/**
- * Downloads an image from the HTTP server.
- * @method WebTwain#HTTPDownloadEx
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
+ * Flips the image of a specified index in buffer.
+ * @method WebTwain#Flip
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
*/
- HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Download an image from the server using a HTTP Post call.
- * @method WebTwain#HTTPDownloadThroughPost
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method.
- * @method WebTwain#HTTPUploadThroughPost
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN.
- * @method WebTwain#HTTPUploadThroughPostDirectly
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} localFile specifies the path of a local file .
- * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the file to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method.
- * @method WebTwain#HTTPUploadThroughPostEx
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadAllThroughPostAsPDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
- * @param {string} fileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
- * @return {bool}
- */
- HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN.
- * @method WebTwain#HTTPUploadThroughPutDirectly
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} localFile specifies the path of a local file.
- * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method.
- * @method WebTwain#HTTPUploadThroughPut
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method.
- * @method WebTwain#HTTPUploadThroughPutEx
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
- * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadAllThroughPutAsPDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
- * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF
- * @param {string} HTTPServer the name of the HTTP server.
- * @param {string} RemoteFileName the name of the image to be uploaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Configures how segmented upload is done.
- * @method WebTwain#SetUploadSegment
- * @param {int} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked.
- * @param {int} moduleSize specifies the size of each segment (in KB).
- * @return {bool}
- */
- SetUploadSegment (segmentUploadThreshold: number, moduleSize: number): boolean;
-
- /**
- * Uploads the images specified by the indices to the HTTP server.
- * @method WebTwain#HTTPUpload
- * @param {string} url the url where the images are sent in a POST request.
- * @param {Array} indices indices specifies which images are to be uploaded.
- * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded.
- * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string.
- * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- HTTPUpload (url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN.
- * @method WebTwain#LoadDibFromClipboard
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads an image into the Dynamic Web TWAIN.
- * @method WebTwain#LoadImage
- * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads an image into the Dynamic Web TWAIN.
- * @method WebTwain#LoadImageEx
- * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
- * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Loads image from a base64 byte array with the specified file format.
- * @method WebTwain#LoadImageFromBase64Binary
- * @param {string} bry specifies the base64 string data.
- * @param {EnumDWT_ImageType} lImageType specifies the file format.
- * @return {bool}
- */
- LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType): boolean;
-
- /**
- * [Deprecated.] Loads image from a byte array with the specified file format.
- * @method WebTwain#LoadImageFromBytes
- * @param {int} lBufferSize Specifies the buffer size.
- * @param {Array} buffer A byte array of the image data.
- * @param {EnumDWT_ImageType} lImageType Specifies the file format.
- * @return {bool}
- */
- LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean;
-
- /**
- * Saves all images in buffer as a MultiPage TIFF file.
- * @method WebTwain#SaveAllAsMultiPageTIFF
- * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves all images in buffer as a Multi-Page PDF file.
- * @method WebTwain#SaveAllAsPDF
- * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a BMP file.
- * @method WebTwain#SaveAsBMP
- * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsBMP(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a JPEG file.
- * @method WebTwain#SaveAsJPEG
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsJPEG(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a PDF file.
- * @method WebTwain#SaveAsPDF
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsPDF(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a PNG file.
- * @method WebTwain#SaveAsPNG
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsPNG(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the image of a specified index in buffer as a TIFF file.
- * @method WebTwain#SaveAsTIFF
- * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SaveAsTIFF(localFile: string, sImageIndex: number): boolean;
-
- /**
- * Saves the selected images in buffer as a Multipage PDF file.
- * @method WebTwain#SaveSelectedImagesAsMultiPagePDF
- * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves the selected images in buffer as a Multipage TIFF file.
- * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF
- * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
- * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- /**
- * Saves the selected images in buffer to base64 string.
- * @method WebTwain#SaveSelectedImagesToBase64Binary
- * @return {string}
- */
- SaveSelectedImagesToBase64Binary(): string;
-
- /**
- * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format.
- * @method WebTwain#SaveSelectedImagesToBytes
- * @param {int} bufferSize specified the buffer size.
- * @param {Array} buffer A byte array of the image data.
- * @return {int}
- */
- SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number;
-
- /**
- * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST.
- * @method WebTwain#SetCookie
- * @param {string} cookie the cookie on current page.
- * @return {void}
- */
- SetCookie(cookie: string): void;
-
- /**
- * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images.
- * @method WebTwain#SetHTTPFormField
- * @param {string} FieldName specifies the name of a text field in web form.
- * @param {string} FieldValue specifies the value of a text field in web form.
- * @return {bool}
- */
- SetHTTPFormField(FieldName: string, FieldValue: string): boolean;
-
- /**
- * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64.
- * @method WebTwain#SetTiffCustomTag
- * @param {int} tag specifies the tag identifier. The value should be between 600 and 700.
- * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it.
- * @param {bool} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text.
- * @return {bool}
- */
- SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean;
-
- /**
- * Show save file dialog or show open file dialog.
- * @method WebTwain#ShowFileDialog
- * @param {bool} SaveDialog True -- show save file dialog, False -- show open file dialog.
- * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically.
- * @param {int} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based.
- * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended.
- * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms.
- * @param {bool} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file.
- * @param {bool} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file.
- * @param {int} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless.
- * @return {bool}
- */
- ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean;
-
- /**
- * Gets information of the capability specified by the Capability property.
- * @method WebTwain#CapGet
- * @return {bool}
- */
- CapGet(): boolean;
-
- /**
- * Returns the Source's current Value for the specified capability.
- * @method WebTwain#CapGetCurrent
- * @return {bool}
- */
- CapGetCurrent(): boolean;
-
- /**
- * Returns the Source's Default Value for the specified capability. This is the Source's preferred default value.
- * @method WebTwain#CapGetDefault
- * @return {bool}
- */
- CapGetDefault(): boolean;
-
- /**
- * Returns the value of the bottom-most edge of the specified frame.
- * @method WebTwain#CapGetFrameBottom
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameBottom(index: number): number;
-
- /**
- * Returns the value (in Unit) of the left-most edge of the specified frame.
- * @method WebTwain#CapGetFrameLeft
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameLeft(index: number): number;
-
- /**
- * Returns the value (in Unit) of the left-most edge of the specified frame.
- * @method WebTwain#CapGetFrameRight
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameRight(index: number): number;
-
- /**
- * Returns the value (in Unit) of the top-most edge of the specified frame.
- * @method WebTwain#CapGetFrameTop
- * @param {short} index specifies the value of which frame to get. The index is 0-based.
- * @return {float}
- */
- CapGetFrameTop(index: number): number;
-
- /**
- * Queries whether the Source supports a particular operation on the capability.
- * @method WebTwain#CapIfSupported
- * @param {EnumDWT_MessageType} messageType specifies the type of capability operation.
- * @return {bool}
- */
- CapIfSupported(messageType: EnumDWT_MessageType): boolean;
-
- /**
- * Changes the Current Value of the capability specified by Capability property back to its power-on value.
- * @method WebTwain#CapReset
- * @return {bool}
- */
- CapReset(): boolean;
-
- /**
- * Sets the current capability using the container type specified by CapType property. The current capability is specified by Capability property.
- * @method WebTwain#CapSet
- * @return {bool}
- */
- CapSet(): boolean;
-
- /**
- * Sets the values of the specified frame.
- * @method WebTwain#CapSetFrame
- * @param {short} index specifies the values of which frame to set. The index is 0-based.
- * @param {float} left the value (in Unit) of the left-most edge of the specified frame.
- * @param {float} top the value (in Unit) of the top-most edge of the specified frame.
- * @param {float} right the value (in Unit) of the right-most edge of the specified frame.
- * @param {float} bottom the value (in Unit) of the bottom-most edge of the specified frame.
- * @return {bool}
- */
- CapSetFrame(index: number, left: number, top: number, right: number, bottom: number): boolean;
+ Flip(sImageIndex: number): boolean;
/**
* Get the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
* @method WebTwain#GetCapItems
- * @param {int} index Index is 0-based. It is the index of the cap item.
- * @return {double}
+ * @param {number} index Index is 0-based. It is the index of the cap item.
+ * @return {number}
*/
GetCapItems(index: number): number;
/**
* Returns the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
* @method WebTwain#GetCapItemsString
- * @param {int} index Index is 0-based. It is the index of the cap item.
+ * @param {number} index Index is 0-based. It is the index of the cap item.
* @return {string}
*/
GetCapItemsString(index: number): string;
- /**
- * Set the value of the specified cap item.
- * @method WebTwain#SetCapItems
- * @param {int} index Index is 0-based. It is the index of the cap item.
- * @param {double} newVal The Double type of CapItems property is used to present Double, Single(float), Long, int and even boolean types. For string type, please use CapItemsstring property.
- * @return {void}
- */
- SetCapItems(index: number, newVal: number): void;
-
- /**
- * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
- * @method WebTwain#SetCapItemsString
- * @param {int} index Index is 0-based. It is the index of the cap item.
- * @param {string} newVal The new value to be set.
- * @return {void}
- */
- SetCapItemsString(index: number, newVal: string): void;
- // --- SCAN end --
-
- // --- View & Edit start --
-
- /**
- * Add text on an image.
- * @method WebTwain#AddText
- * @param {short} sImageIndex the index of the image that you want to add text to.
- * @param {int} x the x coordinate for the text.
- * @param {int} y the y coordinate for the text.
- * @param {string} text the content of the text that you want to add.
- * @param {int} txtColor the color for the text.
- * @param {int} backgroundColor the background color.
- * @param {float} backgroundRoundRadius ranging from 0 to 0.5. Please NOTE that MAC version does not support this parameter.
- * @param {float} backgroundOpacity specifies the opacity of the background of the added text, it ranges from 0 to 1.0. Please NOTE that Mac version only supports value 0 and 1
- * @return {bool}
- */
- AddText(sImageIndex: number, x: number, y: number, text: string, txtColor: number, backgroundColor: number, backgroundRoundRadius: number, backgroundOpacity: number): boolean;
-
- /**
- * Create the font for adding text using the method AddText.
- * @method WebTwain#CreateTextFont
- * @param {int} height Specifies the desired height (in logical units) of the font.The absolute value of nHeight must not exceed 16,384 device units after it is converted.For all height comparisons, the font mapper looks for the largest font that does not exceed the requested size or the smallest font if all the fonts exceed the requested size.
- * @param {int} width Specifies the average width (in logical units) of characters in the font. If Width is 0, the aspect ratio of the device will be matched against the digitization aspect ratio of the available fonts to find the closest match, which is determined by the absolute value of the difference.
- * @param {int} escapement Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis.
- * @param {int} orientation Specifies the angle (in 0.1-degree units) between the baseline of a character and the x-axis.The angle is measured counterclockwise from the x-axis for coordinate systems in which the y-direction is down and clockwise from the x-axis for coordinate systems in which the y-direction is up.
- * @param {int} weight Specifies the font weight (in inked pixels per 1000). The described valuesare approximate; the actual appearance depends on the typeface. Some fonts haveonly FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used.
- * @param {short} italic Specifies an italic font if set to TRUE.
- * @param {short} underline Specifies an underlined font if set to TRUE.
- * @param {short} strikeOut A strikeout font if set to TRUE.
- * @param {short} charSet Specifies the font's character set. The OEM character set is system-dependent. Fonts with other character sets may exist in the system. An application that uses a font with an unknown character set must not attempt to translate or interpret strings that are to be rendered with that font.
- * @param {short} outputPrecision Specifies the desired output precision. The output precision defines how closely the output must match the requested font's height, width, character orientation, escapement, and pitch.
- * @param {short} clipPrecision Specifies the desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region.
- * @param {short} quality Specifies the font's output quality, which defines how carefully the GDI must attempt to match the logical-font attributes to those of an actual physical font.
- * @param {short} pitchAndFamily The pitch and family of the font.
- * @param {string} faceName the typeface name, the length of this string must not exceed 32 characters, including the terminating null character.
- * @return {bool}
- */
- CreateTextFont(height: number, width: number, escapement: number, orientation: number, weight: number, italic: number, underline: number, strikeOut: number, charSet: number, outputPrecision: number, clipPrecision: number, quality: number, pitchAndFamily: number, faceName: string): boolean;
-
- /**
- * Copies the image of a specified index in buffer to clipboard in DIB format.
- * @method WebTwain#CopyToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- CopyToClipboard(sImageIndex: number): boolean;
-
- /**
- * Clears the specified area of a specified image, and fill the area with the fill color.
- * @method WebTwain#Erase
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- Erase(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Returns the pixel bit depth of the selected image.
- * @method WebTwain#GetImageBitDepth
- * @param {short} sImageIndex specifies the index of image. The index is 0-based.
- * @return {short}
- */
- GetImageBitDepth(sImageIndex: number): number;
-
- /**
- * Returns the width (pixels) of the selected image. This is a read-only property.
- * @method WebTwain#GetImageWidth
- * @param {short} sImageIndex specifies the index of image. The index is 0-based.
- * @return {int}
- */
- GetImageWidth(sImageIndex: number): number;
-
- /**
- * Returns the height (pixels) of the selected image. This is a read-only property.
- * @method WebTwain#GetImageHeight
- * @param {short} sImageIndex specifies the index of image. The index is 0-based.
- * @return {int}
- */
- GetImageHeight(sImageIndex: number): number;
-
- /**
- * Returns the file size of the new image resized from the image of a specified index in buffer.
- * @method WebTwain#GetImageSize
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} iWidth specifies the pixel width of the new image.
- * @param {int} iHeight specifies the pixel height of the new image.
- * @return {double}
- */
- GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number;
-
- /**
- * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer.
- * @method WebTwain#GetImageSizeWithSpecifiedType
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {short} sImageType specifies the type of an image file..
- * @return {int}
- */
- GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number;
-
- /**
- * Return the horizontal resolution of the specified image.
- * @method WebTwain#GetImageXResolution
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {int}
- */
- GetImageXResolution(sImageIndex: number): number;
-
- /**
- * Return the vertical resolution of the specified image.
- * @method WebTwain#GetImageYResolution
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {int}
- */
- GetImageYResolution(sImageIndex: number): number;
-
- /**
- * Returns the index of the selected image.
- * @method WebTwain#GetSelectedImageIndex
- * @param {short} sSelectedIndex specifies the index of the selected image.
- * @return {short}
- */
- GetSelectedImageIndex(sSelectedIndex: number): number;
-
- /**
- * You can use the method to select images programatically which is ususally done by mouse clicking.
- * @method WebTwain#SetSelectedImageIndex
- * @param {short} sSelectedIndex this is the index of an array that holds the indices of selected images.
- * @param {short} newVal specifies the index of an image that you want to select.
- * @return {void}
- */
- SetSelectedImageIndex(selectedIndex: number, newVal: number): void;
-
- /**
- * Pre-calculate the file size of the local image file that is saved from the selected images in buffer.
- * @method WebTwain#GetSelectedImagesSize
- * @param {int} iImageType specifies the type of an image file.
- * @return {int}
- */
- GetSelectedImagesSize(iImageType: number): number;
-
- /**
- * Check the skew angle of an image by its index in buffer.
- * @method WebTwain#GetSkewAngle
- * @param {short} sImageIndex the index of the image in the buffer.
- * @return {double}
- */
- GetSkewAngle(sImageIndex: number): number;
-
- /**
- * Check the skew angle of a rectangular part of an image by its index in buffer.
- * @method WebTwain#GetSkewAngleEx
- * @param {short} sImageIndex the index of the image in the buffer.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {double}
- */
- GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number;
-
- /**
- * [Deprecated.] Detects whether a certain area on an image is blank.
- * @method WebTwain#IsBlankImageEx
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @param {bool} bFuzzyMatch specifies whether use fuzzy matching when detecting.
- * @return {bool}
- */
- IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean;
-
- /**
- * Mirrors the image of a specified index in buffer.
- * @method WebTwain#Mirror
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- Mirror(sImageIndex: number): boolean;
-
- /**
- * Decorates image of a specified index in buffer with rectangles of transparent color.
- * @method WebTwain#OverlayRectangle
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @param {int} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red.
- * @param {float} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent.
- * @return {bool}
- */
- OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean;
-
- /**
- * Removes all images in buffer.
- * @method WebTwain#RemoveAllImages
- * @return {void}
- */
- RemoveAllImages(): void;
-
- /**
- * Removes selected images in buffer.
- * @method WebTwain#RemoveAllSelectedImages
- * @return {bool}
- */
- RemoveAllSelectedImages(): boolean;
-
- /**
- * Removes the image of a specified index in buffer.
- * @method WebTwain#RemoveImage
- * @param {short} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based.
- * @return {bool}
- */
- RemoveImage(sImageIndexToBeDeleted: number): boolean;
-
- // Image Operate
- /**
- * Rotates the image of a specified index in buffer by specified angle.
- * @method WebTwain#Rotate
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {float} fAngle Specifies the rotation angle.
- * @param {bool} bKeepSize Keep size or not.
- * @return {bool}
- */
- Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean;
-
- /**
- * Rotates the image of a specified index in buffer by specified angle.
- * @method WebTwain#RotateEx
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {float} fAngle Specifies the rotation angle.
- * @param {bool} bKeepSize Keep size or not.
- * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
- * @return {bool}
- */
- RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
-
- /**
- * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise.
- * @method WebTwain#RotateLeft
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- RotateLeft(sImageIndex: number): boolean;
-
- /**
- * Rotates the image of a specified index in buffer by 90 degrees clockwise.
- * @method WebTwain#RotateRight
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- RotateRight(sImageIndex: number): boolean;
-
- /**
- * Changes width and height of the image of a specified index in the buffer. Please note the file size of the image will be changed proportionately.
- * @method WebTwain#ChangeImageSize
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} iNewWidth specifies the pixel width of the new image.
- * @param {int} iNewHeight specifies the pixel height of the new image.
- * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
- * @return {bool}
- */
- ChangeImageSize(sImageIndex: number, iNewWidth: number, iNewHeight: number, newVal: EnumDWT_InterpolationMethod): boolean;
-
- /**
- * Flips the image of a specified index in buffer.
- * @method WebTwain#Flip
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- Flip(sImageIndex: number): boolean;
-
- /**
- * Crops the image of a specified index in buffer.
- * @method WebTwain#Crop
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- Crop(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Crops the image of a specified index in buffer to clipboard in DIB format.
- * @method WebTwain#CropToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- CropToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Cuts the image data in the specified area to the system clipboard in DIB format.
- * @method WebTwain#CutFrameToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left specifies the x-coordinate of the upper-left corner of the rectangle.
- * @param {int} top specifies the y-coordinate of the upper-left corner of the rectangle.
- * @param {int} right specifies the x-coordinate of the lower-right corner of the rectangle.
- * @param {int} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
- * @return {bool}
- */
- CutFrameToClipboard(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Cuts the image of a specified index in buffer to clipboard in DIB format.
- * @method WebTwain#CutToClipboard
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- CutToClipboard(sImageIndex: number): boolean;
-
- /**
- * Change the DPI (dots per inch) for the specified image.
- * @method WebTwain#SetDPI
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} xResolution The horizontal resolution.
- * @param {int} yResolution The vertical resolution.
- * @param {bool} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true).
- * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
- * @return {bool}
- */
- SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
-
- /**
- * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN.
- * @method WebTwain#SetViewMode
- * @param {short} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN.
- * @param {short} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN..
- * @return {void}
- */
- SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void;
-
- /**
- * Moves a specified image.
- * @method WebTwain#MoveImage
- * @param {short} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based.
- * @param {short} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean;
-
- /**
- * Switchs two images of specified indices in buffer.
- * @method WebTwain#SwitchImage
- * @param {short} sImageIndex1 specifies the index of image in buffer. The index is 0-based.
- * @param {short} sImageIndex2 specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
- */
- SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean;
-
- /**
- * Shows the GUI of Image Printer.
- * @method WebTwain#Print
- * @return {bool}
- */
- Print(): boolean;
- // --- View & Edit end --
-
- // --- Upload & Save end --
-
- // --- Others ---
- /**
- * Shows the GUI of Image Editor.
- * @method WebTwain#ShowImageEditor
- * @return {bool}
- */
- ShowImageEditor(): boolean;
-
- /**
- * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires.
- * @method WebTwain#UnregisterEvent
- * @param {string} name the name of the event.
- * @param {object} evt specified the function to be unbound.
- * @return {bool}
- */
- UnregisterEvent(name: string, evt: object): boolean;
- // --- Others end ---
-
- /**
- * Enables the source to accept image.
- * @method WebTwain#EnableSource
- * @return {bool}
- */
- EnableSource(): boolean;
-
- /**
- * Displays the source's built-in interface to acquire image.
- * @method WebTwain#AcquireImage
- * @param {object} optionalDeviceConfig a JS object used to set up the device for image acquisition.
- * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- AcquireImage(optionalDeviceConfig?: object, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
-
- // start from 10.0
- /**
- * Change the width of an image in buffer.
- * @method WebTwain#SetImageWidth
- * @param {short} sImageIndex specifies which image you'd like to change.
- * @param {int} iNewWidth specifies how wide you'd like to change the image.
- * @return {bool}
- */
- SetImageWidth(sImageIndex: number, iNewWidth: number): boolean;
-
- // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64
- /**
- * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile.
- * @method WebTwain#SetCustomDSDataEx
- * @param {string} value the input string which is encoded with base64.
- * @return {bool}
- */
- SetCustomDSDataEx(value: string): boolean;
-
- // Set custom DS data, load data from the specified file
- /**
- * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile.
- * @method WebTwain#SetCustomDSData
- * @param {string} fileName the absolute path of the file where the custom data source data is stored.
- * @return {bool}
- */
- SetCustomDSData(fileName: string): boolean;
-
// Get custom DS data, and returned string is encoded with base64
/**
* Gets custom DS data, the returned string is base64 encoded.
@@ -3352,120 +2726,962 @@ interface WebTwain {
* Gets custom DS data and save the data in a specified file.
* @method WebTwain#GetCustomDSData
* @param {string} fileName the path of the file used for storing custom DS data.
- * @return {bool}
+ * @return {boolean}
*/
GetCustomDSData(fileName: string): boolean;
/**
- * Changes the bitdepth of a specified image.
- * @method WebTwain#ChangeBitDepth
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {short} sBitDepth specifies the target bit depth.
- * @param {bool} bHighQuality specifies whether or not to keep high quality while changing the bit depth. When it's true, it takes more time.
- * @return {bool}
+ * Retrieve the device type of the currently selected data source, it might be a scanner, a web camera, etc.
+ * @method WebTwain#GetDeviceType
+ * @return {number}
*/
- ChangeBitDepth(sImageIndex: number, sBitDepth: number, bHighQuality: boolean): boolean;
+ GetDeviceType(): number;
/**
- * Changes a specified image to gray scale.
- * @method WebTwain#ConvertToGrayScale
- * @param {short} sIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
+ * Returns the pixel bit depth of the selected image.
+ * @method WebTwain#GetImageBitDepth
+ * @param {number} sImageIndex specifies the index of image. The index is 0-based.
+ * @return {number}
*/
- ConvertToGrayScale(sIndex: number): boolean;
+ GetImageBitDepth(sImageIndex: number): number;
/**
- * [Deprecated.] Shows the GUI of Image Editor with custom settings.
- * @method WebTwain#ShowImageEditorEx
- * @param {int} x specifies the new position of the left top corner of the window.
- * @param {int} y specifies the new position of the left top corner of the window.
- * @param {int} cx specifies the width of the window.
- * @param {int} cy specifies the height of the window.
- * @param {int} nCmdShow specifices how the window should be shown.
- * @return {bool}
+ * Returns the height (pixels) of the selected image. This is a read-only property.
+ * @method WebTwain#GetImageHeight
+ * @param {number} sImageIndex specifies the index of image. The index is 0-based.
+ * @return {number}
*/
- ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean;
+ GetImageHeight(sImageIndex: number): number;
+
+ /*work on
+ GetImagePartURL
+ */
/**
- * [Deprecated.] Detects whether an image is blank.
- * @method WebTwain#IsBlankImage
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
+ * Returns the file size of the new image resized from the image of a specified index in buffer.
+ * @method WebTwain#GetImageSize
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} iWidth specifies the pixel width of the new image.
+ * @param {number} iHeight specifies the pixel height of the new image.
+ * @return {number}
*/
- IsBlankImage(sImageIndex: number): boolean;
+ GetImageSize(sImageIndex: number, iWidth: number, iHeight: number): number;
/**
- * Detects whether a specific image is blank.
- * @method WebTwain#IsBlankImageExpress
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @return {bool}
+ * Pre-calculate the file size of the local image file that is saved from an image of a specified index in buffer.
+ * @method WebTwain#GetImageSizeWithSpecifiedType
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sImageType specifies the type of an image file..
+ * @return {number}
*/
- IsBlankImageExpress(sImageIndex: number): boolean;
-
- /**
- * [Deprecated.] Detects whether a specific image is blank.
- * @method WebTwain#GetBarcodeInfo
- * @param {int} barcodeInfoType Defined in TWAIN Specification.
- * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based.
- * @return {object}
- */
- GetBarcodeInfo(barcodeInfoType: number, barcodeIndex: number): object;
-
- /**
- * [Deprecated.] Gets the content from a specified barcode.
- * @method WebTwain#GetBarcodeText
- * @param {int} barcodeIndex Specifies which barcode to check. The index is 0-based.
- * @return {bool}
- */
- GetBarcodeText(barcodeIndex: number): boolean;
-
- /**
- * Sets the default source to use. It's only valid when IfUseTWAINDSM is set to true.
- * @method WebTwain#SetDefaultSource
- * @param {short} sImageIndex specifies the index of the default source. The index is 0-based.
- * @return {bool}
- */
- SetDefaultSource(sImageIndex: number): boolean;
-
- /**
- * Draws a rectangle on the viewer which represents the selected area.
- * @method WebTwain#SetSelectedImageArea
- * @param {short} sImageIndex specifies the index of image in buffer. The index is 0-based.
- * @param {int} left The X axis of the left border.
- * @param {int} top The Y axis of the top border.
- * @param {int} right The X axis of the right border.
- * @param {int} bottom The Y axis of the bottom border.
- * @return {bool}
- */
- SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
-
- /**
- * Converts the images specified by the indices to base64.
- * @method WebTwain#ConvertToBase64
- * @param {Array} indices indices specifies which images are to be converted to base64.
- * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be converted to base64.
- * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
- * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
- * @return {bool}
- */
- ConvertToBase64(indices: number[], enumImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+ GetImageSizeWithSpecifiedType(sImageIndex: number, sImageType: number): number;
/**
* Returns the direct URL of an image specified by index, if iWidth or iHeight is set to -1, you get the original image, otherwise you get the image with specified iWidth or iHeight while keeping the same aspect ratio.
* @method WebTwain#GetImageURL
- * @param {short} index the index of the image.
- * @param {int} iWidth the width of the image.
- * @param {int} iHeight the height of the image.
+ * @param {number} index the index of the image.
+ * @param {number} iWidth the width of the image.
+ * @param {number} iHeight the height of the image.
* @return {string}
*/
GetImageURL(index: number, iWidth: number, iHeight: number): string;
+ /**
+ * Returns the width (pixels) of the selected image. This is a read-only property.
+ * @method WebTwain#GetImageWidth
+ * @param {number} sImageIndex specifies the index of image. The index is 0-based.
+ * @return {number}
+ */
+ GetImageWidth(sImageIndex: number): number;
+
+ /**
+ * Return the horizontal resolution of the specified image.
+ * @method WebTwain#GetImageXResolution
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {number}
+ */
+ GetImageXResolution(sImageIndex: number): number;
+
+ /**
+ * Return the vertical resolution of the specified image.
+ * @method WebTwain#GetImageYResolution
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {number}
+ */
+ GetImageYResolution(sImageIndex: number): number;
+
+ /**
+ * Return the runtime license info.
+ * @method WebTwain#GetLicenseInfo
+ */
+ GetLicenseInfo(): { Domain: string, Detail: any[] };
+
+ /**
+ * Returns the index of the selected image.
+ * @method WebTwain#GetSelectedImageIndex
+ * @param {number} sSelectedIndex specifies the index of the selected image.
+ * @return {number}
+ */
+ GetSelectedImageIndex(sSelectedIndex: number): number;
+
+ /**
+ * Pre-calculate the file size of the local image file that is saved from the selected images in buffer.
+ * @method WebTwain#GetSelectedImagesSize
+ * @param {number} iImageType specifies the type of an image file.
+ * @return {number}
+ */
+ GetSelectedImagesSize(iImageType: number): number;
+
+ /**
+ * Check the skew angle of an image by its index in buffer.
+ * @method WebTwain#GetSkewAngle
+ * @param {number} sImageIndex the index of the image in the buffer.
+ * @return {number}
+ */
+ GetSkewAngle(sImageIndex: number): number;
+
+ /**
+ * Check the skew angle of a rectangular part of an image by its index in buffer.
+ * @method WebTwain#GetSkewAngleEx
+ * @param {number} sImageIndex the index of the image in the buffer.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @return {number}
+ */
+ GetSkewAngleEx(sImageIndex: number, left: number, top: number, right: number, bottom: number): number;
+
+ /**
+ * Get the source name according to the source index.
+ * @method WebTwain#GetSourceNameItems
+ * @param {number} index number index. Index is 0-based and can not be greater than SourceCount property.
+ * @return {string}
+ */
+ GetSourceNameItems(index: number): string;
+
+ /*ignored
+ GetSourceNames
+ GetSourceType
+ GetVersionInfoAsync
+ */
+
+ /**
+ * Downloads an image from the HTTP server.
+ * @method WebTwain#HTTPDownload
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile the name of the image to be downloaded. It should be the relative path of the file on the HTTP server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownload(HTTPServer: string, HTTPRemoteFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Directly downloads a file from the HTTP server to a local disk without loading it into Dynamic Web TWAIN.
+ * @method WebTwain#HTTPDownloadDirectly
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile The relative path of the file on the HTTP server.
+ * @param {string} localFile specify the location to store the downloaded file.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownloadDirectly(HTTPServer: string, HTTPRemoteFile: string, localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Downloads an image from the HTTP server.
+ * @method WebTwain#HTTPDownloadEx
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownloadEx(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /*ignored
+ HTTPDownloadStreamThroughPost
+ HTTPDownloadThroughGet
+ */
+
+ /**
+ * Download an image from the server using a HTTP Post call.
+ * @method WebTwain#HTTPDownloadThroughPost
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} HTTPRemoteFile the relative path of the file on the HTTP server, or path to an action page (with necessary parameters) which gets and sends back the image stream to the client (please check the sample for more info)
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be downloaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the download succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the download fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPDownloadThroughPost(HTTPServer: string, HTTPRemoteFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the images specified by the indices to the HTTP server.
+ * @method WebTwain#HTTPUpload
+ * @param {string} url the url where the images are sent in a POST request.
+ * @param {Array} indices indices specifies which images are to be uploaded.
+ * @param {EnumDWT_ImageType} enumImageType the image format in which the images are to be uploaded.
+ * @param {EnumDWT_UploadDataFormat} dataFormat whether to upload the images as binary or a base64-based string.
+ * @param {function} asyncSuccessFunc the function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} asyncFailureFunc the function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUpload(url: string, indices: number[], enumImageType: EnumDWT_ImageType, dataFormat: EnumDWT_UploadDataFormat, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads all images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadAllThroughPostAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads all images in the buffer to the HTTP server through HTTP Post method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadAllThroughPostAsPDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPostAsPDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadAllThroughPutAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads all images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadAllThroughPutAsPDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadAllThroughPutAsPDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /*ignored
+ HTTPUploadStreamThroughPost
+ */
+
+ /**
+ * Uploads the image of a specified index in the buffer to the HTTP server through the HTTP POST method.
+ * @method WebTwain#HTTPUploadThroughPost
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPost(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadThroughPostAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostAsMultiPageTIFF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the selected images in the buffer to the HTTP server through the HTTP Post method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadThroughPostAsMultiPagePDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostAsMultiPagePDF(HTTPServer: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Directly upload a specific local file to the HTTP server through the HTTP POST method without loading it into Dynamic Web TWAIN.
+ * @method WebTwain#HTTPUploadThroughPostDirectly
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} localFile specifies the path of a local file .
+ * @param {string} ActionPage the specified page for posting files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the file to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostDirectly(HTTPServer: string, localFile: string, ActionPage: string, fileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP POST method.
+ * @method WebTwain#HTTPUploadThroughPostEx
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} ActionPage the specified page for posting image files. This is the relative path of the page, not the absolute path. For example: "upload.asp", not "http://www.webserver.com/upload.asp".
+ * @param {string} fileName the name of the image to be uploaded.
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.s
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnHttpUploadFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPostEx(HTTPServer: string, sImageIndex: number, ActionPage: string, fileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server through the HTTP PUT method.
+ * @method WebTwain#HTTPUploadThroughPut
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} RemoteFileName the name of the image to be created on the HTTP server. It should a relative path on the web server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPut(HTTPServer: string, sImageIndex: number, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page TIFF.
+ * @method WebTwain#HTTPUploadThroughPutAsMultiPageTIFF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutAsMultiPageTIFF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the selected images in the buffer to the HTTP server through the HTTP Put method as a Multi-Page PDF.
+ * @method WebTwain#HTTPUploadThroughPutAsMultiPagePDF
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} RemoteFileName the name of the image to be uploaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutAsMultiPagePDF(HTTPServer: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Directly uploads a specific local file to the HTTP server through the HTTP PUT method without loading it into Dynamic Web TWAIN.
+ * @method WebTwain#HTTPUploadThroughPutDirectly
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {string} localFile specifies the path of a local file.
+ * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutDirectly(HTTPServer: string, localFile: string, RemoteFileName: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Uploads the image of a specified index in the buffer to the HTTP server as a specified image format through the HTTP PUT method.
+ * @method WebTwain#HTTPUploadThroughPutEx
+ * @param {string} HTTPServer the name of the HTTP server.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {string} RemoteFileName the name of the file to be created on the HTTP server. It should a relative path on the web server.
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be created on the HTTP server.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the upload succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the upload fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ HTTPUploadThroughPutEx(HTTPServer: string, sImageIndex: number, RemoteFileName: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Detects whether an image is blank.
+ * @method WebTwain#IsBlankImage
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ IsBlankImage(sImageIndex: number): boolean;
+
+ /**
+ * [Deprecated.] Detects whether a certain area on an image is blank.
+ * @method WebTwain#IsBlankImageEx
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @param {boolean} bFuzzyMatch specifies whether use fuzzy matching when detecting.
+ * @return {boolean}
+ */
+ IsBlankImageEx(sImageIndex: number, left: number, top: number, right: number, bottom: number, bFuzzyMatch: boolean): boolean;
+
+ /**
+ * Detects whether a specific image is blank.
+ * @method WebTwain#IsBlankImageExpress
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ IsBlankImageExpress(sImageIndex: number): boolean;
+
+ /**
+ * Loads a DIB format image from Clipboard into the Dynamic Web TWAIN.
+ * @method WebTwain#LoadDibFromClipboard
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ LoadDibFromClipboard(optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Loads an image into the Dynamic Web TWAIN.
+ * @method WebTwain#LoadImage
+ * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ LoadImage(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Loads an image into the Dynamic Web TWAIN.
+ * @method WebTwain#LoadImageEx
+ * @param {string} localFile the name of the image to be loaded. It should be the absolute path of the image file on the local disk.
+ * @param {EnumDWT_ImageType} lImageType the image format of the file to be loaded.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the loading succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the loading fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ LoadImageEx(localFile: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Loads image from a base64 byte array with the specified file format.
+ * @method WebTwain#LoadImageFromBase64Binary
+ * @param {string} bry specifies the base64 string data.
+ * @param {EnumDWT_ImageType} lImageType specifies the file format.
+ * @return {boolean}
+ */
+ LoadImageFromBase64Binary(bry: string, lImageType: EnumDWT_ImageType, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * [Deprecated.] Loads image from a byte array with the specified file format.
+ * @method WebTwain#LoadImageFromBytes
+ * @param {number} lBufferSize Specifies the buffer size.
+ * @param {Array} buffer A byte array of the image data.
+ * @param {EnumDWT_ImageType} lImageType Specifies the file format.
+ * @return {boolean}
+ */
+ LoadImageFromBytes(lBufferSize: number, buffer: number[], lImageType: EnumDWT_ImageType): boolean;
+
+ /**
+ * Mirrors the image of a specified index in buffer.
+ * @method WebTwain#Mirror
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ Mirror(sImageIndex: number): boolean;
+
+ /**
+ * Moves a specified image.
+ * @method WebTwain#MoveImage
+ * @param {number} sSourceImageIndex Specifies the source index of image in buffer. The index is 0-based.
+ * @param {number} sTargetImageIndex Specifies the target index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ MoveImage(sSourceImageIndex: number, sTargetImageIndex: number): boolean;
+
+ /*ignored
+ OnRefreshUI
+ */
+
+ /**
+ * Loads the specified Source into main memory and causes its initialization,
+ * placing Dynamic Web TWAIN into Capability Negotiation state. If no source is
+ * specified (no SelectSource() or SelectSourceByIndex() is called), opens the default source.
+ * @method WebTwain#OpenSource
+ * @return {boolean}
+ */
+ OpenSource(): boolean;
+
+ /**
+ * Loads and opens Data Source Manager.
+ * @method WebTwain#OpenSourceManager
+ * @return {boolean}
+ */
+ OpenSourceManager(): boolean;
+
+ /**
+ * Decorates image of a specified index in buffer with rectangles of transparent color.
+ * @method WebTwain#OverlayRectangle
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left specifies the x-coordinate of the upper-left corner of the rectangle.
+ * @param {number} top specifies the y-coordinate of the upper-left corner of the rectangle.
+ * @param {number} right specifies the x-coordinate of the lower-right corner of the rectangle.
+ * @param {number} bottom specifies the y-coordinate of the lower-right corner of the rectangle.
+ * @param {number} color Specifies the fill color of the rectangle. The byte-ordering of the RGB value is 0xBBGGRR. BB represents blue, GG represents green, RR represents red.
+ * @param {number} fOpacity Specifies the opacity of the rectangle. The value represents opacity. 1.0 is 100% opaque and 0.0 is totally transparent.
+ * @return {boolean}
+ */
+ OverlayRectangle(sImageIndex: number, left: number, top: number, right: number, bottom: number, color: number, fOpacity: number): boolean;
+
+ /**
+ * Shows the GUI of Image Printer.
+ * @method WebTwain#Print
+ * @return {boolean}
+ */
+ Print(): boolean;
+
+ /**
+ * Binds a specified function to an event, so that the function gets called whenever the event fires.
+ * @method WebTwain#RegisterEvent
+ * @param {string} name the name of the event that the function is bound to.
+ * @param {object} evt specifies the function to call when event fires.
+ * @return {boolean}
+ */
+ RegisterEvent(name: string, evt: object): boolean;
+
+ /**
+ * Removes all images in buffer.
+ * @method WebTwain#RemoveAllImages
+ * @return {void}
+ */
+ RemoveAllImages(): void;
+
+ /**
+ * Removes selected images in buffer.
+ * @method WebTwain#RemoveAllSelectedImages
+ * @return {boolean}
+ */
+ RemoveAllSelectedImages(): boolean;
+
+ /**
+ * Removes the image of a specified index in buffer.
+ * @method WebTwain#RemoveImage
+ * @param {number} sImageIndexToBeDeleted specifies the index of the image to be deleted in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ RemoveImage(sImageIndexToBeDeleted: number): boolean;
+
+ /**
+ * Reverts the current image layout to the Data Source's default.
+ * @method WebTwain#ResetImageLayout
+ * @return {boolean}
+ */
+ ResetImageLayout(): boolean;
+
+ /**
+ * Sets the Source to return the current page to the input side of the document feeder and
+ * feed the last page from the outside of the feeder back into the acquisition area if IfFeederEnabled is TRUE.
+ * @method WebTwain#RewindPage
+ * @return {boolean}
+ */
+ RewindPage(): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by specified angle.
+ * @method WebTwain#Rotate
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} fAngle Specifies the rotation angle.
+ * @param {boolean} bKeepSize Keep size or not.
+ * @return {boolean}
+ */
+ Rotate(sImageIndex: number, fAngle: number, bKeepSize: boolean): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by specified angle.
+ * @method WebTwain#RotateEx
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} fAngle Specifies the rotation angle.
+ * @param {boolean} bKeepSize Keep size or not.
+ * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
+ * @return {boolean}
+ */
+ RotateEx(sImageIndex: number, fAngle: number, bKeepSize: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by 90 degrees counter-clockwise.
+ * @method WebTwain#RotateLeft
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ RotateLeft(sImageIndex: number): boolean;
+
+ /**
+ * Rotates the image of a specified index in buffer by 90 degrees clockwise.
+ * @method WebTwain#RotateRight
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ RotateRight(sImageIndex: number): boolean;
+
+ /**
+ * Saves all images in buffer as a MultiPage TIFF file.
+ * @method WebTwain#SaveAllAsMultiPageTIFF
+ * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveAllAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves all images in buffer as a Multi-Page PDF file.
+ * @method WebTwain#SaveAllAsPDF
+ * @param {string} localFile the name of the Multi-Page PDF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveAllAsPDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a BMP file.
+ * @method WebTwain#SaveAsBMP
+ * @param {string} localFile the name of the BMP file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsBMP(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /*ignored
+ SaveAsGIF
+ */
+
+ /**
+ * Saves the image of a specified index in buffer as a JPEG file.
+ * @method WebTwain#SaveAsJPEG
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsJPEG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a PDF file.
+ * @method WebTwain#SaveAsPDF
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsPDF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a PNG file.
+ * @method WebTwain#SaveAsPNG
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsPNG(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the image of a specified index in buffer as a TIFF file.
+ * @method WebTwain#SaveAsTIFF
+ * @param {string} localFile the name of the JPEG file to be saved. It should be an absolute path on the local disk.
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SaveAsTIFF(localFile: string, sImageIndex: number, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the selected images in buffer as a Multipage PDF file.
+ * @method WebTwain#SaveSelectedImagesAsMultiPagePDF
+ * @param {string} localFile the name of the MultiPage PDF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveSelectedImagesAsMultiPagePDF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the selected images in buffer as a Multipage TIFF file.
+ * @method WebTwain#SaveSelectedImagesAsMultiPageTIFF
+ * @param {string} localFile the name of the MultiPage TIFF file to be saved. It should be an absolute path on the local disk.
+ * @param {function} optionalAsyncSuccessFunc optional. The function to call when the saving succeeds. Please refer to the function prototype OnSuccess.
+ * @param {function} optionalAsyncFailureFunc optional. The function to call when the saving fails. Please refer to the function prototype OnFailure.
+ * @return {boolean}
+ */
+ SaveSelectedImagesAsMultiPageTIFF(localFile: string, optionalAsyncSuccessFunc?: () => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): boolean;
+
+ /**
+ * Saves the selected images in buffer to base64 string.
+ * @method WebTwain#SaveSelectedImagesToBase64Binary
+ * @return {string|bool}
+ */
+ SaveSelectedImagesToBase64Binary(optionalAsyncSuccessFunc?: (result: string[]) => void, optionalAsyncFailureFunc?: (errorCode: number, errorString: string) => void): string | boolean;
+
+ /**
+ * [Deprecated.] Saves the selected images in buffer to a byte array in the specified file format.
+ * @method WebTwain#SaveSelectedImagesToBytes
+ * @param {number} bufferSize specified the buffer size.
+ * @param {Array} buffer A byte array of the image data.
+ * @return {number}
+ */
+ SaveSelectedImagesToBytes(bufferSize: number, buffer: number[]): number;
+
+ /**
+ * Brings up the TWAIN Data Source Manager's Source Selection User Interface (UI)
+ * so that user can choose which Data Source to be the current Source.
+ * @method WebTwain#SelectSource
+ * @return {boolean}
+ */
+ SelectSource(): boolean;
+
+ /**
+ * Selects the index-the source in SourceNameItems property as the current source.
+ * @method WebTwain#SelectSourceByIndex
+ * @param {number} index It is the index of SourceNameItems property.
+ * @return {boolean}
+ */
+ SelectSourceByIndex(index: number): boolean;
+
+ /*ignored
+ SetCancel
+ */
+
+ /**
+ * Set the value of the specified cap item.
+ * @method WebTwain#SetCapItems
+ * @param {number} index Index is 0-based. It is the index of the cap item.
+ * @param {number} newVal For string type, please use CapItemsstring property.
+ * @return {void}
+ */
+ SetCapItems(index: number, newVal: number): void;
+
+ /**
+ * Set the cap item value of the capability specified by Capability property, when the value of the CapType property is TWON_ARRAY or TWON_ENUMERATION.
+ * @method WebTwain#SetCapItemsString
+ * @param {number} index Index is 0-based. It is the index of the cap item.
+ * @param {string} newVal The new value to be set.
+ * @return {void}
+ */
+ SetCapItemsString(index: number, newVal: string): void;
+
+ /**
+ * [Deprecated.] Sets current cookie into the Http Header to be used when uploading scanned images through POST.
+ * @method WebTwain#SetCookie
+ * @param {string} cookie the cookie on current page.
+ * @return {void}
+ */
+ SetCookie(cookie: string): void;
+
+ // Set custom DS data (DAT_CUSTOMDSDATA), the input string is encoded with base64
+ /**
+ * Sets custom DS data to be used for scanning, the input string is encoded with base64. Custom DS data means a specific scanning profile.
+ * @method WebTwain#SetCustomDSDataEx
+ * @param {string} value the input string which is encoded with base64.
+ * @return {boolean}
+ */
+ SetCustomDSDataEx(value: string): boolean;
+
+ // Set custom DS data, load data from the specified file
+ /**
+ * Sets custom DS data to be used for scanning, the data is stored in a file. Custom DS data means a specific scanning profile.
+ * @method WebTwain#SetCustomDSData
+ * @param {string} fileName the absolute path of the file where the custom data source data is stored.
+ * @return {boolean}
+ */
+ SetCustomDSData(fileName: string): boolean;
+
+ /**
+ * Change the DPI (dots per inch) for the specified image.
+ * @method WebTwain#SetDPI
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} xResolution The horizontal resolution.
+ * @param {number} yResolution The vertical resolution.
+ * @param {boolean} bResampleImage Whether to resample the image. (The image size will be changed if this is set to true).
+ * @param {EnumDWT_InterpolationMethod} newVal specifies the method to do interpolation.
+ * @return {boolean}
+ */
+ SetDPI(sImageIndex: number, xResolution: number, yResolution: number, bResampleImage: boolean, newVal: EnumDWT_InterpolationMethod): boolean;
+
+ /**
+ * Sets file name and file format information used in File Transfer Mode.
+ * @method WebTwain#SetFileXferInfo
+ * @param {string} fileName the name of the file to be used in transfer.
+ * @param {EnumDWT_FileFormat} fileFormat an enumerated value indicates the format of the image.
+ * @return {boolean}
+ */
+ SetFileXferInfo(fileName: string, fileFormat: EnumDWT_FileFormat): boolean;
+
+ /**
+ * Sets a text parameter as a filed in a web form. This form is maintained by the component itself (meaning it's not on the page). All fields in this form will be passed to the server when uploading images.
+ * @method WebTwain#SetHTTPFormField
+ * @param {string} FieldName specifies the name of a text field in web form.
+ * @param {string} FieldValue specifies the value of a text field in web form.
+ * @return {boolean}
+ */
+ SetHTTPFormField(FieldName: string, FieldValue: string): boolean;
+
/**
* Sets a header for the current HTTP Post request.
* @method WebTwain#SetHTTPHeader
* @param {string} key the key of the header.
* @param {string} value the value of the header.
- * @return {bool}
+ * @return {boolean}
*/
SetHTTPHeader(key: string, value: string): boolean;
+
+ /**
+ * Sets the left, top, right, and bottom sides of the image layout rectangle for the current Data Source.
+ * @method WebTwain#SetImageLayout
+ * @param {number} left specifies the floating point number for the left side of the image layout rectangle.
+ * @param {number} top specifies the floating point number for the top side of the image layout rectangle.
+ * @param {number} right specifies the floating point number for the right side of the image layout rectangle.
+ * @param {number} bottom specifies the floating point number for the bottom side of the image layout rectangle.
+ * @return {boolean}
+ */
+ SetImageLayout(left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * Change the width of an image in buffer.
+ * @method WebTwain#SetImageWidth
+ * @param {number} sImageIndex specifies which image you'd like to change.
+ * @param {number} iNewWidth specifies how wide you'd like to change the image.
+ * @return {boolean}
+ */
+ SetImageWidth(sImageIndex: number, iNewWidth: number): boolean;
+
+ /**
+ * Set the language for the authorization dialogs.
+ * @method WebTwain#SetLanguage
+ * @param {EnumDWT_Language} language specify the language
+ * @return {boolean}
+ */
+ SetLanguage(language: EnumDWT_Language): boolean;
+
+ /**
+ * Sets the time-out used to open a specified Data Source.
+ * @method WebTwain#SetOpenSourceTimeout
+ * @param {number} iMilliseconds specifies the number of milliseconds.
+ * @return {boolean}
+ */
+ SetOpenSourceTimeout(iMilliseconds: number): boolean;
+
+ /**
+ * Draws a rectangle on the viewer which represents the selected area.
+ * @method WebTwain#SetSelectedImageArea
+ * @param {number} sImageIndex specifies the index of image in buffer. The index is 0-based.
+ * @param {number} left The X axis of the left border.
+ * @param {number} top The Y axis of the top border.
+ * @param {number} right The X axis of the right border.
+ * @param {number} bottom The Y axis of the bottom border.
+ * @return {boolean}
+ */
+ SetSelectedImageArea(sImageIndex: number, left: number, top: number, right: number, bottom: number): boolean;
+
+ /**
+ * You can use the method to select images programatically which is ususally done by mouse clicking.
+ * @method WebTwain#SetSelectedImageIndex
+ * @param {number} sSelectedIndex this is the index of an array that holds the indices of selected images.
+ * @param {number} newVal specifies the index of an image that you want to select.
+ * @return {void}
+ */
+ SetSelectedImageIndex(selectedIndex: number, newVal: number): void;
+
+ /**
+ * Sets a custom tiff tag. Currently you can set up to 32 tags. The string to be set in a tag can be encoded with base64.
+ * @method WebTwain#SetTiffCustomTag
+ * @param {number} tag specifies the tag identifier. The value should be between 600 and 700.
+ * @param {string} content the string to be set for this tag. The string will be written to the .tiff file when you save/upload it. If the string is base64 encoded, we'll decode it before writing it.
+ * @param {boolean} base64Str if you'd like to encode the string with base64, set this to true. Otherwise, the string will be plin text.
+ * @return {boolean}
+ */
+ SetTiffCustomTag(tag: number, content: string, base64Str: boolean): boolean;
+
+ /**
+ * Configures how segmented upload is done.
+ * @method WebTwain#SetUploadSegment
+ * @param {number} segmentUploadThreshold specifies the threshold (in MB) over which segmented upload will be invoked.
+ * @param {number} moduleSize specifies the size of each segment (in KB).
+ * @return {boolean}
+ */
+ SetUploadSegment(segmentUploadThreshold: number, moduleSize: number): boolean;
+
+ /**
+ * Sets the view mode that images are displayed in Dynamic Web TWAIN. You can use this method to display multiple images in Dynamic Web TWAIN.
+ * @method WebTwain#SetViewMode
+ * @param {number} sHorizontalImageCount specifies how many columns can be displayed in Dynamic Web TWAIN.
+ * @param {number} sVerticalImageCount specifies how many rows can be displayed in Dynamic Web TWAIN..
+ * @return {void}
+ */
+ SetViewMode(sHorizontalImageCount: number, sVerticalImageCount: number): void;
+
+ /**
+ * Show save file dialog or show open file dialog.
+ * @method WebTwain#ShowFileDialog
+ * @param {boolean} SaveDialog True -- show save file dialog, False -- show open file dialog.
+ * @param {string} Filter The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically.
+ * @param {number} FilterIndex The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based.
+ * @param {string} DefExtension Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended.
+ * @param {string} InitialDir The initial directory. The algorithm for selecting the initial directory varies on different platforms.
+ * @param {boolean} AllowMultiSelect True -- allows users to select more than one file, False -- only allows to select one file.
+ * @param {boolean} OverwritePrompt True -- If a file already exists with the same name, the old file will be simply overwritten, False -- not allows to save and overwrite a same name file.
+ * @param {number} Flags If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless.
+ * @return {boolean}
+ */
+ ShowFileDialog(SaveDialog: boolean, Filter: string, FilterIndex: number, DefExtension: string, InitialDir: string, AllowMultiSelect: boolean, OverwritePrompt: boolean, Flags: number): boolean;
+
+ /**
+ * Shows the GUI of Image Editor.
+ * @method WebTwain#ShowImageEditor
+ * @return {boolean}
+ */
+ ShowImageEditor(): boolean;
+
+ /**
+ * [Deprecated.] Shows the GUI of Image Editor with custom settings.
+ * @method WebTwain#ShowImageEditorEx
+ * @param {number} x specifies the new position of the left top corner of the window.
+ * @param {number} y specifies the new position of the left top corner of the window.
+ * @param {number} cx specifies the width of the window.
+ * @param {number} cy specifies the height of the window.
+ * @param {number} nCmdShow specifices how the window should be shown.
+ * @return {boolean}
+ */
+ ShowImageEditorEx(x: number, y: number, cx: number, cy: number, nCmdShow: number): boolean;
+
+ /*ingored
+ SourceNameItems
+ */
+
+ /**
+ * Switchs two images of specified indices in buffer.
+ * @method WebTwain#SwitchImage
+ * @param {number} sImageIndex1 specifies the index of image in buffer. The index is 0-based.
+ * @param {number} sImageIndex2 specifies the index of image in buffer. The index is 0-based.
+ * @return {boolean}
+ */
+ SwitchImage(sImageIndex1: number, sImageIndex2: number): boolean;
+
+ /**
+ * Unbinds an event from the specified function, so that the function stops receiving notifications when the event fires.
+ * @method WebTwain#UnregisterEvent
+ * @param {string} name the name of the event.
+ * @param {object} evt specified the function to be unbound.
+ * @return {boolean}
+ */
+ UnregisterEvent(name: string, evt: object): boolean;
+
+ /*ignored
+ checkErrorString
+ first
+ getInstance
+ last
+ next
+ on
+ onEvent
+ previous
+
+ ...other internal ones
+ */
}
diff --git a/types/dynogels/dynogels-tests.ts b/types/dynogels/dynogels-tests.ts
index ca16707256..a7634548e7 100644
--- a/types/dynogels/dynogels-tests.ts
+++ b/types/dynogels/dynogels-tests.ts
@@ -148,12 +148,14 @@ dynogels.dynamoDriver(dynamodb);
// Saving Models To DynamoDB
Account.create({ email: 'foo@example.com', name: 'Foo Bar', age: 21 }, (err, acc) => {
- acc.get('email');
+ const email = acc.get('email') as string;
+ console.log(`Created account ${email}`);
});
const acc = new Account({ email: 'test@example.com', name: 'Test Example' });
acc.save((err) => {
- acc.get('email');
+ const email = acc.get('email') as string;
+ console.log(`Created account ${email}`);
});
BlogPost.create({
diff --git a/types/dynogels/index.d.ts b/types/dynogels/index.d.ts
index 4742af5a04..dd6aedf907 100644
--- a/types/dynogels/index.d.ts
+++ b/types/dynogels/index.d.ts
@@ -1,7 +1,8 @@
-// Type definitions for dynogels 8.0
+// Type definitions for dynogels 9.0
// Project: https://github.com/clarkie/dynogels#readme
// Definitions by: Spartan Labs
// Ramon de Klein
+// Stephen Tuso
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -153,7 +154,8 @@ export interface ModelConfig {
// Dynogels Item
export interface Item {
- get(key?: string): { [key: string]: any };
+ get(): { [key: string]: any };
+ get(key: string): any;
set(params: {}): Item;
save(callback?: DynogelsItemCallback): void;
update(options: UpdateItemOptions, callback?: DynogelsItemCallback): void;
diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts
index 9eec5ed467..ea3de94436 100644
--- a/types/ember-data/index.d.ts
+++ b/types/ember-data/index.d.ts
@@ -71,7 +71,7 @@ declare module 'ember-data' {
inverse?: string | null;
polymorphic?: boolean;
}
- ): Ember.ComputedProperty>;
+ ): Ember.ComputedProperty, ModelRegistry[K]>;
/**
* `DS.hasMany` is used to define One-To-Many and Many-To-Many
* relationships on a [DS.Model](/api/data/classes/DS.Model.html).
@@ -91,7 +91,7 @@ declare module 'ember-data' {
inverse?: string | null;
polymorphic?: boolean;
}
- ): Ember.ComputedProperty>;
+ ): Ember.ComputedProperty, Ember.Array>;
/**
* This method normalizes a modelName into the format Ember Data uses
* internally.
diff --git a/types/ember-data/test/belongs-to.ts b/types/ember-data/test/belongs-to.ts
index bd1037a65e..31977c148c 100644
--- a/types/ember-data/test/belongs-to.ts
+++ b/types/ember-data/test/belongs-to.ts
@@ -1,6 +1,8 @@
import DS from 'ember-data';
import { assertType } from './lib/assert';
+declare const store: DS.Store;
+
class Folder extends DS.Model {
name = DS.attr('string');
children = DS.hasMany('folder', { inverse: 'parent' });
@@ -19,4 +21,9 @@ assertType(folder.get('parent').get('name'));
folder.get('parent').then(parent => {
assertType(parent);
assertType(parent.get('name'));
+ folder.set('parent', parent);
});
+
+folder.set('parent', folder);
+folder.set('parent', folder.get('parent'));
+folder.set('parent', store.findRecord('folder', 3));
diff --git a/types/ember-data/test/has-many.ts b/types/ember-data/test/has-many.ts
index e24fb1b814..480a6bd56d 100644
--- a/types/ember-data/test/has-many.ts
+++ b/types/ember-data/test/has-many.ts
@@ -1,3 +1,4 @@
+import Ember from 'ember';
import DS from 'ember-data';
import { assertType } from './lib/assert';
@@ -44,6 +45,10 @@ blogPost.get('commentsAsync').then(comments => {
assertType(comments.get('firstObject')!.get('text'));
});
+blogPost.set('commentsAsync', blogPost.get('commentsAsync'));
+blogPost.set('commentsAsync', Ember.A());
+blogPost.set('commentsAsync', Ember.A([ comment! ]));
+
class PaymentMethod extends DS.Model {}
declare module 'ember-data' {
interface ModelRegistry {
diff --git a/types/ember-mocha/index.d.ts b/types/ember-mocha/index.d.ts
index f43982fda8..1d24564e31 100644
--- a/types/ember-mocha/index.d.ts
+++ b/types/ember-mocha/index.d.ts
@@ -62,17 +62,4 @@ declare module 'mocha' {
// augment test callback context
interface ITestCallbackContext extends TestContext {}
interface IHookCallbackContext extends TestContext {}
-
- // re-export mocha globals as named exports
- export const describe: Mocha.IContextDefinition;
- export const context: Mocha.IContextDefinition;
- export const it: Mocha.ITestDefinition;
- export const setup: mochaSetup;
- export const teardown: mochaTeardown;
- export const suiteSetup: mochaSuiteSetup;
- export const suiteTeardown: mochaSuiteTeardown;
- export const before: mochaBefore;
- export const after: mochaAfter;
- export const beforeEach: mochaBeforeEach;
- export const afterEach: mochaAfterEach;
}
diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts
index dd3ed1ec64..6d8adebae2 100755
--- a/types/ember/index.d.ts
+++ b/types/ember/index.d.ts
@@ -28,7 +28,8 @@ declare module 'ember' {
/**
* Deconstructs computed properties into the types which would be returned by `.get()`.
*/
- type ComputedProperties = { [K in keyof T]: Ember.ComputedProperty | ModuleComputed | T[K] };
+ type ComputedPropertyGetters = { [K in keyof T]: Ember.ComputedProperty | ModuleComputed | T[K] };
+ type ComputedPropertySetters = { [K in keyof T]: Ember.ComputedProperty | ModuleComputed | T[K] };
/**
* Check that any arguments to `create()` match the type's properties.
@@ -683,7 +684,7 @@ declare module 'ember' {
will be cached. You can specify various properties that your computed property is dependent on.
This will force the cached result to be recomputed if the dependencies are modified.
**/
- class ComputedProperty {
+ class ComputedProperty {
/**
* Call on a computed property to set it into non-cached mode. When in this
* mode the computed property will not automatically cache the return value.
@@ -812,7 +813,7 @@ declare module 'ember' {
static create(this: EmberClassConstructor): Fix;
static create>(
- this: EmberClassConstructor>,
+ this: EmberClassConstructor>,
arg1: T1 & ThisType>
): Fix;
@@ -822,7 +823,7 @@ declare module 'ember' {
T1 extends EmberInstanceArguments,
T2 extends EmberInstanceArguments
>(
- this: EmberClassConstructor>,
+ this: EmberClassConstructor>,
arg1: T1 & ThisType>,
arg2: T2 & ThisType>
): Fix;
@@ -834,7 +835,7 @@ declare module 'ember' {
T2 extends EmberInstanceArguments,
T3 extends EmberInstanceArguments
>(
- this: EmberClassConstructor>,
+ this: EmberClassConstructor>,
arg1: T1 & ThisType>,
arg2: T2 & ThisType>,
arg3: T3 & ThisType>
@@ -1641,27 +1642,27 @@ declare module 'ember' {
/**
* Retrieves the value of a property from the object.
*/
- get(this: ComputedProperties, key: K): T[K];
+ get(this: ComputedPropertyGetters, key: K): T[K];
/**
* To get the values of multiple properties at once, call `getProperties`
* with a list of strings or an array:
*/
- getProperties(this: ComputedProperties, list: K[]): Pick;
+ getProperties(this: ComputedPropertyGetters, list: K[]): Pick;
getProperties(
- this: ComputedProperties,
+ this: ComputedPropertyGetters,
...list: K[]
): Pick;
/**
* Sets the provided key or path to the value.
*/
- set(this: ComputedProperties, key: K, value: T[K]): T[K];
+ set(this: ComputedPropertySetters, key: K, value: T[K]): T[K];
/**
* Sets a list of properties at once. These properties are set inside
* a single `beginPropertyChanges` and `endPropertyChanges` batch, so
* observers will be buffered.
*/
setProperties(
- this: ComputedProperties,
+ this: ComputedPropertySetters,
hash: Pick
): Pick;
/**
@@ -1692,7 +1693,7 @@ declare module 'ember' {
* property returns `undefined`.
*/
getWithDefault(
- this: ComputedProperties,
+ this: ComputedPropertyGetters,
key: K,
defaultValue: T[K]
): T[K];
@@ -1715,7 +1716,7 @@ declare module 'ember' {
* without accidentally invoking it if it is intended to be
* generated lazily.
*/
- cacheFor(this: ComputedProperties, key: K): T[K] | undefined;
+ cacheFor(this: ComputedPropertyGetters, key: K): T[K] | undefined;
}
const Observable: Mixin;
/**
@@ -2989,7 +2990,7 @@ declare module 'ember' {
* it to be created.
*/
function cacheFor(
- obj: ComputedProperties,
+ obj: ComputedPropertyGetters,
key: K
): T[K] | undefined;
/**
@@ -3028,12 +3029,12 @@ declare module 'ember' {
* with an object followed by a list of strings or an array:
*/
function getProperties(
- obj: ComputedProperties,
+ obj: ComputedPropertyGetters,
list: K[]
): Pick;
function getProperties(obj: T, list: K[]): Pick; // for dynamic K
function getProperties(
- obj: ComputedProperties,
+ obj: ComputedPropertyGetters,
...list: K[]
): Pick;
function getProperties(obj: T, ...list: K[]): Pick; // for dynamic K
@@ -3120,14 +3121,14 @@ declare module 'ember' {
* the function will be invoked. If the property is not defined but the
* object implements the `unknownProperty` method then that will be invoked.
*/
- function get(obj: ComputedProperties, key: K): T[K];
+ function get(obj: ComputedPropertyGetters, key: K): T[K];
function get(obj: T, key: K): T[K]; // for dynamic K
/**
* Retrieves the value of a property from an Object, or a default value in the
* case that the property returns `undefined`.
*/
function getWithDefault(
- obj: ComputedProperties,
+ obj: ComputedPropertyGetters,
key: K,
defaultValue: T[K]
): T[K];
@@ -3139,7 +3140,7 @@ declare module 'ember' {
* method then that will be invoked as well.
*/
function set(
- obj: ComputedProperties,
+ obj: ComputedPropertySetters,
key: K,
value: V
): V;
@@ -3155,7 +3156,7 @@ declare module 'ember' {
* observers will be buffered.
*/
function setProperties(
- obj: ComputedProperties,
+ obj: ComputedPropertySetters,
hash: Pick
): Pick;
function setProperties(obj: T, hash: Pick): Pick; // for dynamic K
@@ -3499,6 +3500,12 @@ declare module '@ember/enumerable' {
export default Enumerable;
}
+declare module '@ember/error' {
+ import Ember from 'ember';
+ const Error: typeof Ember.Error;
+ export default Error;
+}
+
declare module '@ember/instrumentation' {
import Ember from 'ember';
export const instrument: typeof Ember.instrument;
@@ -3534,7 +3541,7 @@ declare module '@ember/object' {
declare module '@ember/object/computed' {
import Ember from 'ember';
- export default class ComputedProperty extends Ember.ComputedProperty { }
+ export default class ComputedProperty extends Ember.ComputedProperty { }
export const alias: typeof Ember.computed.alias;
export const and: typeof Ember.computed.and;
export const bool: typeof Ember.computed.bool;
diff --git a/types/ember/test/error.ts b/types/ember/test/error.ts
new file mode 100644
index 0000000000..ad3c2ee8c3
--- /dev/null
+++ b/types/ember/test/error.ts
@@ -0,0 +1,6 @@
+import { assertType } from "./lib/assert";
+
+import Ember from "ember";
+import EmberError from "@ember/error";
+
+assertType(EmberError);
diff --git a/types/ember/tsconfig.json b/types/ember/tsconfig.json
index 19c8cf4b50..cbdb6b6afc 100755
--- a/types/ember/tsconfig.json
+++ b/types/ember/tsconfig.json
@@ -23,6 +23,7 @@
"test/lib/assert.ts",
"test/application.ts",
"test/ember-tests.ts",
+ "test/error.ts",
"test/event.ts",
"test/extend.ts",
"test/create.ts",
@@ -49,4 +50,4 @@
"test/route.ts",
"test/view-utils.ts"
]
-}
\ No newline at end of file
+}
diff --git a/types/ethereumjs-util/ethereumjs-util-tests.ts b/types/ethereumjs-util/ethereumjs-util-tests.ts
new file mode 100644
index 0000000000..5159dcf758
--- /dev/null
+++ b/types/ethereumjs-util/ethereumjs-util-tests.ts
@@ -0,0 +1,4 @@
+import * as assert from "assert";
+import * as etherUtil from "ethereumjs-util";
+
+assert.ok(etherUtil.isValidAddress("0x0bfe6d9a4d4a73857db6fac276669ba45ee69b48"));
diff --git a/types/ethereumjs-util/index.d.ts b/types/ethereumjs-util/index.d.ts
new file mode 100644
index 0000000000..7a29b38ff5
--- /dev/null
+++ b/types/ethereumjs-util/index.d.ts
@@ -0,0 +1,83 @@
+// Type definitions for ethereumjs-util 5.1
+// Project: https://github.com/ethereumjs/ethereumjs-util#readme
+// Definitions by: Juan J. Jimenez-Anca
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+// TODO: import types for [`BN`](https://github.com/indutny/bn.js)
+// TODO: MAX_INTEGER as type of BN
+// TODO: import types for [`rlp`](https://github.com/ethereumjs/rlp)
+// TODO: import types for [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
+
+export const SHA3_NULL_S: string;
+
+export const SHA3_RLP_ARRAY_S: string;
+
+export const SHA3_RLP_S: string;
+
+export function addHexPrefix(str: string): string;
+
+export function arrayContainsArray(superset: any, subset: any, some: any): any;
+
+export function baToJSON(ba: Buffer | string[]): Buffer | string[];
+
+export function bufferToHex(buf: Buffer): string;
+
+export function bufferToInt(buf: Buffer): string;
+
+export function defineProperties(self: {[k: string]: any}, fields: string[], data: {[k: string]: any}): {[k: string]: any};
+
+export function ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer): Buffer;
+
+export function ecsign(msgHash: Buffer, privateKey: Buffer): {[k: string]: any};
+
+export function fromRpcSig(sig: string): {[k: string]: any};
+
+export function fromSigned(num: Buffer): any;
+
+export function generateAddress(from: Buffer, nonce: Buffer): Buffer;
+
+export function hashPersonalMessage(message: string): Buffer;
+
+export function importPublic(publicKey: Buffer): Buffer;
+
+export function isValidAddress(address: string): boolean;
+
+export function isValidChecksumAddress(address: Buffer): boolean;
+
+export function isValidPrivate(privateKey: Buffer): boolean;
+
+export function isValidPublic(publicKey: Buffer, sanitize?: boolean): any;
+
+export function isValidSignature(v: Buffer, r: Buffer, s: Buffer, homestead?: boolean): boolean;
+
+export function privateToAddress(privateKey: Buffer): Buffer;
+
+export function privateToPublic(privateKey: Buffer): Buffer;
+
+export function pubToAddress(pubKey: Buffer, sanitize: boolean): Buffer;
+
+export function ripemd160(a: Buffer | any[] | string | number, padded: boolean): Buffer;
+
+export function rlphash(a: Buffer | any[] | string | number): Buffer;
+
+export function setLengthLeft(msg: Buffer | any[], length: number, right?: boolean): Buffer | any[];
+
+export function setLengthRight(msg: Buffer | any[], length: number): Buffer | any[];
+
+export function sha256(a: Buffer | any[] | string | number): Buffer;
+
+export function sha3(a: Buffer | any[] | string | number, bits?: number): Buffer;
+
+export function toBuffer(v: any): Buffer;
+
+export function toChecksumAddress(address: string): string;
+
+export function toRpcSig(v: number, r: Buffer, s: Buffer): string;
+
+export function toUnsigned(num: any): Buffer;
+
+export function unpad(a: T): T;
+
+export function zeros(bytes: number): Buffer;
diff --git a/types/ethereumjs-util/tsconfig.json b/types/ethereumjs-util/tsconfig.json
new file mode 100644
index 0000000000..53f8c15b5b
--- /dev/null
+++ b/types/ethereumjs-util/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": false,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "ethereumjs-util-tests.ts"
+ ]
+}
\ No newline at end of file
diff --git a/types/ethereumjs-util/tslint.json b/types/ethereumjs-util/tslint.json
new file mode 100644
index 0000000000..a0051c9352
--- /dev/null
+++ b/types/ethereumjs-util/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": "dtslint/dt.json"
+}
diff --git a/types/exenv/exenv-tests.ts b/types/exenv/exenv-tests.ts
new file mode 100644
index 0000000000..d13633b4a6
--- /dev/null
+++ b/types/exenv/exenv-tests.ts
@@ -0,0 +1,6 @@
+import * as ExecutionEnvironment from 'exenv';
+
+JSON.stringify(ExecutionEnvironment.canUseDOM);
+JSON.stringify(ExecutionEnvironment.canUseEventListeners);
+JSON.stringify(ExecutionEnvironment.canUseViewport);
+JSON.stringify(ExecutionEnvironment.canUseWorkers);
diff --git a/types/exenv/index.d.ts b/types/exenv/index.d.ts
new file mode 100644
index 0000000000..701494f6d8
--- /dev/null
+++ b/types/exenv/index.d.ts
@@ -0,0 +1,10 @@
+// Type definitions for exenv 1.2
+// Project: https://github.com/JedWatson/exenv
+// Definitions by: Christian Chown
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.6
+
+export const canUseDOM: boolean;
+export const canUseEventListeners: boolean;
+export const canUseViewport: boolean;
+export const canUseWorkers: boolean;
diff --git a/types/colors/tsconfig.json b/types/exenv/tsconfig.json
similarity index 87%
rename from types/colors/tsconfig.json
rename to types/exenv/tsconfig.json
index 99d78ad72d..d8825637a1 100644
--- a/types/colors/tsconfig.json
+++ b/types/exenv/tsconfig.json
@@ -2,7 +2,7 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
- "es5"
+ "es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
@@ -18,7 +18,6 @@
},
"files": [
"index.d.ts",
- "colors-tests.ts",
- "safe.d.ts"
+ "exenv-tests.ts"
]
}
\ No newline at end of file
diff --git a/types/exenv/tslint.json b/types/exenv/tslint.json
new file mode 100644
index 0000000000..2750cc0197
--- /dev/null
+++ b/types/exenv/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
\ No newline at end of file
diff --git a/types/expect/expect-tests.ts b/types/expect/expect-tests.ts
index fea4a3d4d9..5df83340cb 100644
--- a/types/expect/expect-tests.ts
+++ b/types/expect/expect-tests.ts
@@ -1,8 +1,11 @@
-///
-
import { Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies } from 'expect';
import * as expect from 'expect';
+// Stub mocha functions
+const {describe, it, before, after, beforeEach, afterEach} = null as any as {
+ [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any};
+};
+
describe('chaining assertions', () => {
it('should allow chaining for array-like applications', () => {
expect([ 1, 2, 'foo', 3 ])
diff --git a/types/expectations/expectations-tests.ts b/types/expectations/expectations-tests.ts
index b0cef0aa0f..4e994e7546 100644
--- a/types/expectations/expectations-tests.ts
+++ b/types/expectations/expectations-tests.ts
@@ -1,9 +1,12 @@
-///
-
// transplant from https://github.com/spmason/expectations/blob/695c25bd35bb1751533a8082a5aa378e3e1b381f/test/expect.tests.js
var root = this;
+// Stub mocha functions
+const {describe, it, before, after, beforeEach, afterEach} = null as any as {
+ [s: string]: ((s: string, cb: (done: any) => void) => void) & ((cb: (done: any) => void) => void) & {only: any, skip: any};
+};
+
describe('expect', ()=> {
describe('toEqual', ()=> {
it('can expect true to be true', ()=> {
diff --git a/types/express-graphql/express-graphql-tests.ts b/types/express-graphql/express-graphql-tests.ts
index 6fdfc0d945..1557c4c0ac 100644
--- a/types/express-graphql/express-graphql-tests.ts
+++ b/types/express-graphql/express-graphql-tests.ts
@@ -1,31 +1,45 @@
import express = require('express');
import 'express-session';
import graphqlHTTP = require('express-graphql');
+import { GraphQLSchema } from 'graphql/type/schema';
const app = express();
-const schema = {};
+const schema: GraphQLSchema = {
+ getQueryType: null,
+ getMutationType: null,
+ getSubscriptionType: null,
+ getTypeMap: null,
+ getType: null,
+ getPossibleTypes: null,
+ isPossibleType: null,
+ getDirective: null,
+ getDirectives: null,
+};
-const graphqlOption: graphqlHTTP.OptionsObj = {
+const graphqlOption: graphqlHTTP.OptionsData = {
graphiql: true,
- schema: schema,
+ schema,
formatError: (error: Error) => ({
message: error.message
}),
- extensions: (args) => { }
+ validationRules: [() => false, () => true],
+ extensions: ({ document, variables, operationName, result }) => ({ key: "value", key2: "value"}),
};
-const graphqlOptionRequest = (request: express.Request, response: express.Response): graphqlHTTP.OptionsObj => ({
+const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsData => ({
graphiql: true,
- schema: schema,
- context: request.session
+ schema,
+ context: request.session,
+ validationRules: [() => false, () => true],
});
-const graphqlOptionRequestAsync = async (request: express.Request, response: express.Response): Promise => {
+const graphqlOptionRequestAsync = async (request: express.Request): Promise => {
return {
graphiql: true,
schema: await Promise.resolve(schema),
context: request.session,
- extensions: async (args) => { }
+ extensions: async (args) => { },
+ validationRules: [() => false, () => true],
};
};
diff --git a/types/express-graphql/index.d.ts b/types/express-graphql/index.d.ts
index ade08f1729..4b2d10c99b 100644
--- a/types/express-graphql/index.d.ts
+++ b/types/express-graphql/index.d.ts
@@ -1,14 +1,15 @@
-// Type definitions for express-graphql
-// Project: https://www.npmjs.org/package/express-graphql
+// Type definitions for express-graphql 0.6
+// Project: https://github.com/graphql/express-graphql
// Definitions by: Isman Usoh
// Nitin Tutlani
// Daniel Fader
// Ehsan Ziya
+// Margus Lamp
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Request, Response } from "express";
-
+import { DocumentNode, GraphQLSchema, GraphQLError } from 'graphql';
export = graphqlHTTP;
declare namespace graphqlHTTP {
@@ -16,60 +17,99 @@ declare namespace graphqlHTTP {
* Used to configure the graphQLHTTP middleware by providing a schema
* and other configuration options.
*/
- export type Options = ((req: Request, res: Response) => OptionsObj) | ((req: Request, res: Response) => Promise) | OptionsObj
- export type OptionsObj = {
+ export type Options = ((request: Request,
+ response: Response,
+ params?: GraphQLParams) => OptionsResult) | OptionsResult;
+ export type OptionsResult = OptionsData | Promise;
+ export interface OptionsData {
/**
* A GraphQL schema from graphql-js.
*/
- schema: Object,
+ schema: GraphQLSchema;
/**
* A value to pass as the context to the graphql() function.
*/
- context?: Object,
+ context?: any;
/**
* An object to pass as the rootValue to the graphql() function.
*/
- rootValue?: Object,
+ rootValue?: any;
/**
* A boolean to configure whether the output should be pretty-printed.
*/
- pretty?: boolean,
+ pretty?: boolean;
/**
* An optional function which will be used to format any errors produced by
* fulfilling a GraphQL operation. If no function is provided, GraphQL's
* default spec-compliant `formatError` function will be used.
*/
- formatError?: Function,
+ formatError?: (error: GraphQLError) => any;
+
+ /**
+ * An optional array of validation rules that will be applied on the document
+ * in additional to those defined by the GraphQL spec.
+ */
+ validationRules?: any[];
+
+ /**
+ * An optional function for adding additional metadata to the GraphQL response
+ * as a key-value object. The result will be added to "extensions" field in
+ * the resulting JSON. This is often a useful place to add development time
+ * info such as the runtime of a query or the amount of resources consumed.
+ *
+ * Information about the request is provided to be used.
+ *
+ * This function may be async.
+ */
+ extensions?: (info: RequestInfo) => { [key: string]: any };
/**
* A boolean to optionally enable GraphiQL mode.
*/
- graphiql?: boolean,
+ graphiql?: boolean;
+ }
+
+ /**
+ * All information about a GraphQL request.
+ */
+ export interface RequestInfo {
+ /**
+ * The parsed GraphQL document.
+ */
+ document?: DocumentNode;
/**
- * An optional function for adding additional metadata to the GraphQL response as a key-value object.
- * The result will be added to "extensions" field in the resulting JSON.
+ * The variable values used at runtime.
*/
- extensions?: ((args: ExtenstionsArgs) => any) | ((args: ExtenstionsArgs) => Promise);
+ variables?: { [name: string]: any };
- };
+ /**
+ * The (optional) operation name requested.
+ */
+ operationName?: string;
- interface ExtenstionsArgs {
- document: object,
- variables: object,
- operationName: any,
- result: object
+ /**
+ * The result of executing the operation.
+ */
+ result?: any;
+ }
+
+ export interface GraphQLParams {
+ query?: string;
+ variables?: { [name: string]: any };
+ operationName?: string;
+ raw?: boolean;
}
type Middleware = (request: Request, response: Response) => void;
}
/**
-* Middleware for express; takes an options object or function as input to
-* configure behavior, and returns an express middleware.
-*/
+ * Middleware for express; takes an options object or function as input to
+ * configure behavior, and returns an express middleware.
+ */
declare function graphqlHTTP(options: graphqlHTTP.Options): graphqlHTTP.Middleware;
diff --git a/types/express-graphql/tslint.json b/types/express-graphql/tslint.json
index a41bf5d19a..4c4fc86ace 100644
--- a/types/express-graphql/tslint.json
+++ b/types/express-graphql/tslint.json
@@ -1,79 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
- "adjacent-overload-signatures": false,
- "array-type": false,
- "arrow-return-shorthand": false,
- "ban-types": false,
- "callable-types": false,
- "comment-format": false,
- "dt-header": false,
- "eofline": false,
- "export-just-namespace": false,
- "import-spacing": false,
- "interface-name": false,
- "interface-over-type-literal": false,
- "jsdoc-format": false,
- "max-line-length": false,
- "member-access": false,
- "new-parens": false,
- "no-any-union": false,
- "no-boolean-literal-compare": false,
- "no-conditional-assignment": false,
- "no-consecutive-blank-lines": false,
- "no-construct": false,
- "no-declare-current-package": false,
- "no-duplicate-imports": false,
- "no-duplicate-variable": false,
- "no-empty-interface": false,
- "no-for-in-array": false,
- "no-inferrable-types": false,
- "no-internal-module": false,
- "no-irregular-whitespace": false,
- "no-mergeable-namespace": false,
- "no-misused-new": false,
- "no-namespace": false,
- "no-object-literal-type-assertion": false,
- "no-padding": false,
- "no-redundant-jsdoc": false,
- "no-redundant-jsdoc-2": false,
- "no-redundant-undefined": false,
- "no-reference-import": false,
- "no-relative-import-in-test": false,
- "no-self-import": false,
- "no-single-declare-module": false,
- "no-string-throw": false,
- "no-unnecessary-callback-wrapper": false,
- "no-unnecessary-class": false,
- "no-unnecessary-generics": false,
- "no-unnecessary-qualifier": false,
- "no-unnecessary-type-assertion": false,
- "no-useless-files": false,
- "no-var-keyword": false,
- "no-var-requires": false,
- "no-void-expression": false,
- "no-trailing-whitespace": false,
- "object-literal-key-quotes": false,
- "object-literal-shorthand": false,
- "one-line": false,
- "one-variable-per-declaration": false,
- "only-arrow-functions": false,
- "prefer-conditional-expression": false,
- "prefer-const": false,
- "prefer-declare-function": false,
- "prefer-for-of": false,
- "prefer-method-signature": false,
- "prefer-template": false,
- "radix": false,
- "semicolon": false,
- "space-before-function-paren": false,
- "space-within-parens": false,
- "strict-export-declare-modifiers": false,
- "trim-file": false,
- "triple-equals": false,
- "typedef-whitespace": false,
- "unified-signatures": false,
- "void-return": false,
- "whitespace": false
+ "strict-export-declare-modifiers": false
}
}
diff --git a/types/express-jwt/express-jwt-tests.ts b/types/express-jwt/express-jwt-tests.ts
index 798818b728..9de759adb2 100644
--- a/types/express-jwt/express-jwt-tests.ts
+++ b/types/express-jwt/express-jwt-tests.ts
@@ -13,6 +13,25 @@ app.use(jwt({
userProperty: 'auth'
}));
+app.use(jwt({
+ secret: (req: express.Request,
+ payload: any,
+ done: (err: any, secret: string) => void) => {
+ done(null, 'shhhhhhared-secret');
+ },
+ userProperty: 'auth'
+}));
+
+app.use(jwt({
+ secret: (req: express.Request,
+ header: any,
+ payload: any,
+ done: (err: any, secret: string) => void) => {
+ done(null, 'shhhhhhared-secret');
+ },
+ userProperty: 'auth'
+}));
+
var jwtCheck = jwt({
secret: 'shhhhhhared-secret'
});
@@ -28,4 +47,4 @@ app.use(function (err: any, req: express.Request, res: express.Response, next: e
} else {
next(err);
}
-});
\ No newline at end of file
+});
diff --git a/types/express-jwt/index.d.ts b/types/express-jwt/index.d.ts
index de0a2dd337..33c1206254 100644
--- a/types/express-jwt/index.d.ts
+++ b/types/express-jwt/index.d.ts
@@ -12,8 +12,10 @@ export = jwt;
declare function jwt(options: jwt.Options): jwt.RequestHandler;
declare namespace jwt {
export type secretType = string | Buffer
+ export interface SecretCallbackLong {
+ (req: express.Request, header: any, payload: any, done: (err: any, secret?: secretType) => void): void;
+ }
export interface SecretCallback {
- (req: express.Request, header: any, payload: any, done: (err: any, secret?: boolean) => void): void;
(req: express.Request, payload: any, done: (err: any, secret?: secretType) => void): void;
}
@@ -25,7 +27,7 @@ declare namespace jwt {
(req: express.Request): any;
}
export interface Options {
- secret: secretType | SecretCallback;
+ secret: secretType | SecretCallback | SecretCallbackLong;
userProperty?: string;
skip?: string[];
credentialsRequired?: boolean;
diff --git a/types/express-minify/tsconfig.json b/types/express-minify/tsconfig.json
index 65c999883e..20480fc428 100644
--- a/types/express-minify/tsconfig.json
+++ b/types/express-minify/tsconfig.json
@@ -14,10 +14,15 @@
],
"types": [],
"noEmit": true,
- "forceConsistentCasingInFileNames": true
+ "forceConsistentCasingInFileNames": true,
+ "paths": {
+ "uglify-js": [
+ "uglify-js/v2"
+ ]
+ }
},
"files": [
"index.d.ts",
"express-minify-tests.ts"
]
-}
\ No newline at end of file
+}
diff --git a/types/facebook-instant-games/facebook-instant-games-tests.ts b/types/facebook-instant-games/facebook-instant-games-tests.ts
new file mode 100644
index 0000000000..8d33e2c970
--- /dev/null
+++ b/types/facebook-instant-games/facebook-instant-games-tests.ts
@@ -0,0 +1,58 @@
+class FBInstantTest {
+ winStreak: number;
+
+ init() {
+ FBInstant.initializeAsync().then(() => {
+ FBInstant.setLoadingProgress(100);
+ FBInstant.startGameAsync().then(() => {
+ this.startGame();
+ });
+ });
+ }
+
+ startGame() {
+ const contextId = FBInstant.context.getID();
+ const contextType = FBInstant.context.getType();
+
+ const playerName = FBInstant.player.getName();
+ const playerPic = FBInstant.player.getPhoto();
+ const playerId = FBInstant.player.getID();
+ }
+
+ saveState() {
+ FBInstant.player.setDataAsync({
+ score: this.winStreak
+ });
+ }
+
+ getState() {
+ FBInstant.player.getDataAsync(['score'])
+ .then((data) => {
+ if (typeof data['score'] !== 'undefined') {
+ this.winStreak = +data['score'];
+ }
+ });
+ }
+
+ update() {
+ FBInstant.updateAsync({
+ action: 'CUSTOM',
+ cta: 'Play',
+ image: '',
+ text: {
+ default: 'Edgar played their move',
+ localizations: {
+ en_US: 'Edgar played their move',
+ es_LA: '\u00A1Edgar jug\u00F3 su jugada!'
+ }
+ },
+ template: 'play_turn',
+ data: { myReplayData: '...' },
+ strategy: 'IMMEDIATE',
+ notification: 'NO_PUSH'
+ }).then(() => {
+ // closes the game after the update is posted.
+ FBInstant.quit();
+ });
+ }
+}
diff --git a/types/facebook-instant-games/index.d.ts b/types/facebook-instant-games/index.d.ts
new file mode 100644
index 0000000000..1e8a8d76fd
--- /dev/null
+++ b/types/facebook-instant-games/index.d.ts
@@ -0,0 +1,221 @@
+// Type definitions for facebook-instant-games 6.1
+// Project: https://developers.facebook.com/docs/games/instant-games
+// Definitions by: Menushka Weeratunga
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace FBInstant {
+ let player: Player;
+ let context: Context;
+ let payments: Payments;
+
+ function getLocale(): string;
+ function getPlatform(): string;
+ function getSDKVersion(): string;
+ function initializeAsync(): Promise;
+ function setLoadingProgress(progress: number): void;
+ function getSupportedAPIs(): string[];
+ function getEntryPointData(): any;
+ function getEntryPointAsync(): Promise;
+ function setSessionData(sessionData: any): void;
+ function startGameAsync(): Promise;
+ function shareAsync(payload: SharePayload): Promise;
+ function updateAsync(payload: UpdatePayload | LeaderboardUpdatePayload): Promise;
+ function switchGameAsync(appID: string, data?: string): Promise;
+ function canCreateShortcutAsync(): Promise;
+ function createShortcutAsync(): Promise;
+ function quit(): void;
+ function logEvent(eventName: string, valueToSum?: number, parameter?: any): APIError;
+ function onPause(func: () => void): void;
+ function getInterstitialAdAsync(placementID: string): Promise;
+ function getRewardedVideoAsync(placementID: string): Promise;
+ function matchPlayerAsync(matchTag?: string, switchContextWhenMatched?: boolean): Promise;
+ function checkCanPlayerMatchAsync(): Promise;
+ function getLeaderboardAsync(name: string): Promise;
+
+ interface Player {
+ getID(): string;
+ getSignedPlayerInfoAsync(requestPayload: string): Promise;
+ canSubscribeBotAsync(): Promise;
+ subscribeBotAsync(): Promise;
+ getName(): string;
+ getPhoto(): string;
+ getDataAsync(keys?: string[]): Promise;
+ setDataAsync(data: DataObject): Promise;
+ flushDataAsync(): Promise;
+ getStatsAsync(keys?: string[]): Promise;
+ setStatsAsync(stats: StatsObject): Promise