Merge pull request #10534 from DefinitelyTyped/types2.0-merge2016-08-09

Types2.0 merge for 2016-08-09
This commit is contained in:
Nathan Shively-Sanders
2016-08-10 14:31:14 -07:00
committed by GitHub
38 changed files with 4292 additions and 445 deletions
+74
View File
@@ -0,0 +1,74 @@
/// <reference path="ajv.d.ts" />
import * as Ajv from 'ajv';
var ajv = new Ajv(); // options can be passed, e.g. {allErrors: true}
var validate = ajv.compile({});
var valid = validate({});
if (!valid) console.log(validate.errors);
var valid = ajv.validate({}, {});
if (!valid) console.log(ajv.errors);
ajv.addSchema({}, 'mySchema');
var valid = ajv.validate('mySchema', {});
if (!valid) console.log(ajv.errorsText());
ajv.addKeyword('range', {
type: 'number', compile: function (sch, parentSchema) {
var min: any = sch[0];
var max: any = sch[1];
return parentSchema.exclusiveRange === true
? function (data) { return data > min && data < max; }
: function (data) { return data >= min && data <= max; }
}
});
var schema = { "range": [2, 4], "exclusiveRange": true };
var validate = ajv.compile(schema);
console.log(validate(2.01)); // true
console.log(validate(3.99)); // true
console.log(validate(2)); // false
console.log(validate(4)); // false
declare var request: any;
function loadSchema(uri: any, callback: any) {
request.json(uri, function (err: any, res: any, body: any) {
if (err || res.statusCode >= 400)
callback(err || new Error('Loading error: ' + res.statusCode));
else
callback(null, body);
});
}
var ajv = new Ajv({ loadSchema: loadSchema });
ajv.compileAsync(schema, function (err, validate) {
if (err) return;
var valid = validate({});
});
declare var knex: any;
function checkIdExists(schema: any, data: any) {
return knex(schema.table)
.select('id')
.where('id', data)
.then(function (rows: any) {
return true;
});
}
var validate = ajv.compile(schema);
(validate({ userId: 1, postId: 19 }) as PromiseLike<boolean>)
.then(function (valid) {
// "valid" is always true here
console.log('Data is valid');
}, function (err) {
if (!(err instanceof Ajv.ValidationError)) throw err;
// data is invalid
console.log('Validation errors:', err.errors);
});
var ajv = new Ajv({ /* async: 'es7', */ transpile: 'nodent' });
var validate = ajv.compile(schema); // transpiled es7 async function
(validate({}) as PromiseLike<any>).then(() => { }, () => { });
+112
View File
@@ -0,0 +1,112 @@
// Type definitions for ajv
// Project: https://github.com/epoberezkin/ajv
// Definitions by: York Yao <https://github.com/plantain-00/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "ajv" {
class Ajv {
/**
* Create Ajv instance.
*/
constructor(options?: Ajv.AjvOptions);
/**
* Generate validating function and cache the compiled schema for future use.
*/
compile(schema: any): Ajv.AjvValidate;
/**
* Asyncronous version of compile method that loads missing remote schemas using asynchronous function in options.loadSchema.
*/
compileAsync(schema: any, callback: (error: Error, validate: Ajv.AjvValidate) => void): void;
/**
* Validate data using passed schema (it will be compiled and cached).
*/
validate(schema: any, data: any): boolean | PromiseLike<boolean>;
errors: Ajv.ValidationError[];
/**
* Add schema(s) to validator instance.
*/
addSchema(schema: any, key: string): void;
/**
* Adds meta schema(s) that can be used to validate other schemas.
* That function should be used instead of addSchema because there may be instance options that would compile a meta schema incorrectly (at the moment it is removeAdditional option).
*/
addMetaSchema(schema: any, key: string): void;
/**
* Validates schema.
* This method should be used to validate schemas rather than validate due to the inconsistency of uri format in JSON-Schema standard.
*/
validateSchema(schema: any): Boolean;
/**
* Retrieve compiled schema previously added with addSchema by the key passed to addSchema or by its full reference (id).
* Returned validating function has schema property with the reference to the original schema.
*/
getSchema(key: string): Ajv.AjvValidate;
/**
* Remove added/cached schema.
* Even if schema is referenced by other schemas it can be safely removed as dependent schemas have local references.
*/
removeSchema(schema: any): void;
/**
* Add custom format to validate strings. It can also be used to replace pre-defined formats for Ajv instance.
*/
addFormat(name: string, format: any): void;
/**
* Add custom validation keyword to Ajv instance.
*/
addKeyword(keyword: string, definition: Ajv.AjxKeywordDefinition): void;
errorsText(): any;
static ValidationError: Function;
}
namespace Ajv {
type AjvOptions = {
v5?: boolean;
allErrors?: boolean;
verbose?: boolean;
jsonPointers?: boolean;
uniqueItems?: boolean;
unicode?: boolean;
format?: string;
formats?: any;
schemas?: any;
missingRefs?: boolean;
loadSchema?(uri: string, callback: (error: Error, body: any) => void): void;
removeAdditional?: boolean;
useDefaults?: boolean;
coerceTypes?: boolean;
async?: any;
transpile?: string;
meta?: boolean;
validateSchema?: boolean;
addUsedSchema?: boolean;
inlineRefs?: boolean;
passContext?: boolean;
loopRequired?: number;
ownProperties?: boolean;
multipleOfPrecision?: boolean;
errorDataPath?: string,
messages?: boolean;
beautify?: boolean;
cache?: any;
}
type AjvValidate = ((data: any) => boolean | PromiseLike<boolean>) & {
errors: ValidationError[];
}
type AjxKeywordDefinition = {
async?: boolean;
type: string;
compile?: (schema: any, parentsSchema: any) => ((data: any) => boolean | PromiseLike<boolean>);
validate?: (schema: any, data: any) => boolean;
}
type ValidationError = {
keyword: string;
dataPath: string;
schemaPath: string;
params: any;
message: string;
schema: any;
parentSchema: any;
data: any;
}
}
export = Ajv;
}
+49
View File
@@ -0,0 +1,49 @@
/// <reference path="aws-lambda.d.ts" />
import lambda = require('aws-lambda');
var str: string;
var date: Date;
var sns: lambda.SNS;
var kinesis: lambda.Kinesis;
var recordsList: lambda.Record[];
var anyObj: any;
var num: number;
/* Records */
var records: lambda.Records;
recordsList = records.Records;
/* Record */
var record: lambda.Record;
str = record.EventVersion;
str = record.EventSubscriptionArn;
str = record.EnventSource;
sns = record.Sns;
kinesis = record.kinesis;
/* SNS */
str = sns.Type;
str = sns.MessageId;
str = sns.TopicArn;
str = sns.Subject;
str = sns.Message;
date = sns.Timestamp;
/* Kinesis */
var kinesis: lambda.Kinesis;
str = kinesis.data;
/* Context */
var context: lambda.Context;
context.log(str, anyObj);
context.fail(str);
context.succeed(str);
context.succeed(anyObj);
context.succeed(str, anyObj);
str = context.awsRequestId;
num = context.getRemainingTimeInMillis();
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for AWS Lambda
// Project: http://docs.aws.amazon.com/lambda
// Definitions by: Michael Skarum <https://github.com/skarum>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "aws-lambda" {
export interface Records {
Records: Record[];
}
interface Record {
EventVersion: string;
EventSubscriptionArn: string;
EnventSource: string;
Sns: SNS;
kinesis: Kinesis;
}
interface SNS {
Type: string;
MessageId: string;
TopicArn: string;
Subject: string;
Message: string;
Timestamp: Date;
}
interface Kinesis {
data: string;
}
export interface Context {
log(message: string, object: any): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;
succeed(message: string, object: any): void;
awsRequestId: string;
getRemainingTimeInMillis(): number;
}
export type Callback = (error?: Error, message?: string) => void;
}
+39 -3
View File
@@ -57,6 +57,7 @@ declare namespace CKEDITOR {
var basePath: string;
var currentInstance: editor;
var document: dom.document;
var env: environmentConfig;
var instances: editor[];
var loadFullCoreTimeout: number;
var revision: string;
@@ -1029,6 +1030,12 @@ declare namespace CKEDITOR {
}
interface IMenuItemDefinition {
label:string,
command:string,
group:string,
order:number
}
class editor extends event {
activeEnterMode: number;
@@ -1066,13 +1073,14 @@ declare namespace CKEDITOR {
addCommand(commandName: string, commandDefinition: commandDefinition): void;
addFeature(feature: feature): boolean;
addMenuGroup(name: string, order?: number): void;
addMenuItem(name: string, definition?: any): void;
addMenuItems(definitions: any[]): void;
addMenuItem(name: string, definition?: IMenuItemDefinition): void;
addMenuItems(definitions: {[id:string]:IMenuItemDefinition}): void;
addMode(mode: string, exec: () => void): void;
addRemoveFormatFilter(func: Function): void;
applyStyle(style: style): void;
attachStyleStateChange(style: style, callback: Function): void;
checkDirty(): boolean;
commands:any;
createFakeElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
createFakeParserElement(realElement: Object, className: Object, realElementType: Object, isResizable: Object): void;
createRange(): dom.range;
@@ -1235,6 +1243,11 @@ declare namespace CKEDITOR {
}
interface buttonDefinition {
label : string;
command : string;
toolbar : string;
}
interface template {
@@ -1284,10 +1297,31 @@ declare namespace CKEDITOR {
class ui extends event {
constructor(editor: editor);
add(name: string, type: Object, definition: Object): void;
addButton(name: string, definition: dialog.definition.button): void;
addButton(name: string, definition: buttonDefinition): void;
addHandler(type: Object, handler: Object): void;
}
class environmentConfig {
air : boolean;
chrome : boolean;
cssClass : string;
edge : boolean;
gecko : boolean;
hc : boolean;
hidpi : boolean;
iOS : boolean;
ie : boolean;
isCompatible : boolean;
mac : boolean;
needsBrFiller : boolean;
needsNbspFiller : boolean;
quirks : boolean;
safari : boolean;
version : number;
webkit : boolean;
secure( ) : boolean;
}
namespace ui {
namespace dialog {
class uiElement {
@@ -1761,6 +1795,7 @@ declare namespace CKEDITOR {
namespace tools {
var callFunction: Function;
function enableHtml5Elements(doc: Object, withAppend? : Boolean) : void;
}
@@ -1772,3 +1807,4 @@ declare namespace CKEDITOR {
function detect(defaultLanguage: string, probeLanguage: string): string;
}
}
+28 -1
View File
@@ -31,7 +31,34 @@ interface ObjectConstructor {
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects to copy properties from.
* @param source The source object from which to copy properties.
*/
assign<T, U>(target: T, source: U): T & U;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
*/
assign<T, U, V>(target: T, source1: U, source2: V): T & U & V;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source1 The first source object from which to copy properties.
* @param source2 The second source object from which to copy properties.
* @param source3 The third source object from which to copy properties.
*/
assign<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
assign(target: any, ...sources: any[]): any;
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for doctrine the JSDoc parser.
// Type definitions for doctrine the JSDoc parser
// Project: https://github.com/eslint/doctrine
// Definitions by: rictic <https://github.com/rictic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+8
View File
@@ -36,3 +36,11 @@ var e = new Drop({
content: () => greenBox
});
var Tooltip = Drop.createContext({
classPrefix: 'tooltip'
});
var t = new Tooltip({
target: yellowBox,
content: () => greenBox
});
+1 -2
View File
@@ -32,7 +32,7 @@ declare class Drop {
public once(event: string, handler: Function, context?: any): void;
public off(event: string, handler?: Function): void;
public static createContext(options: Drop.IDropContextOptions): Drop;
public static createContext(options: Drop.IDropContextOptions): typeof Drop;
}
declare namespace Drop {
@@ -60,4 +60,3 @@ declare namespace Drop {
tetherOptions?: Tether.ITetherOptions;
}
}
+39
View File
@@ -577,6 +577,42 @@ var template = <Electron.MenuItemOptions[]>[
focusedWindow.webContents.toggleDevTools();
}
}
},
{
type: 'separator'
},
{
label: 'Actual Size',
accelerator: 'CmdOrCtrl+0',
click: (item, focusedWindow) => {
if (focusedWindow) {
focusedWindow.webContents.setZoomLevel(0)
}
}
},
{
label: 'Zoom In',
accelerator: 'CmdOrCtrl+Plus',
click: (item, focusedWindow) => {
if (focusedWindow) {
const { webContents } = focusedWindow;
webContents.getZoomLevel((zoomLevel) => {
webContents.setZoomLevel(zoomLevel + 0.5)
});
}
}
},
{
label: 'Zoom Out',
accelerator: 'CmdOrCtrl+-',
click: (item, focusedWindow) => {
if (focusedWindow) {
const { webContents } = focusedWindow;
webContents.getZoomLevel((zoomLevel) => {
webContents.setZoomLevel(zoomLevel - 0.5)
});
}
}
}
]
},
@@ -827,6 +863,8 @@ shell.openExternal('https://github.com', {
shell.beep();
shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readShortcutLink('/home/user/Desktop/shortcut.lnk'));
// session
// https://github.com/atom/electron/blob/master/docs/api/session.md
@@ -860,6 +898,7 @@ session.defaultSession.cookies.set(cookie, (error) => {
session.defaultSession.on('will-download', (event, item, webContents) => {
// Set the save path, making Electron not to prompt a save dialog.
item.setSavePath('/tmp/save.pdf');
console.log(item.getSavePath());
console.log(item.getMimeType());
console.log(item.getFilename());
console.log(item.getTotalBytes());
+100 -5
View File
@@ -1,4 +1,4 @@
// Type definitions for Electron v1.3.1
// Type definitions for Electron v1.3.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -490,6 +490,13 @@ declare namespace Electron {
* Note: This API is only available on macOS.
*/
show(): void;
/**
* @returns Whether the dock icon is visible.
* The app.dock.show() call is asynchronous so this method might not return true immediately after that call.
*
* Note: This API is only available on macOS.
*/
isVisible(): boolean;
/**
* Sets the application dock menu.
*
@@ -2049,6 +2056,11 @@ declare namespace Electron {
* routine to determine the save path (Usually prompts a save dialog).
*/
setSavePath(path: string): void;
/**
* @returns The save path of the download item.
* This will be either the path set via downloadItem.setSavePath(path) or the path selected from the shown save dialog.
*/
getSavePath(): string;
/**
* Pauses the download.
*/
@@ -2438,13 +2450,17 @@ declare namespace Electron {
*/
static createFromDataURL(dataURL: string): NativeImage;
/**
* @returns Buffer Contains the image's PNG encoded data.
* @returns Buffer that contains the image's PNG encoded data.
*/
toPNG(): Buffer;
/**
* @returns Buffer Contains the image's JPEG encoded data.
* @returns Buffer that contains the image's JPEG encoded data.
*/
toJPEG(quality: number): Buffer;
/**
* @returns Buffer that contains the image's raw pixel data.
*/
toBitmap(): Buffer;
/**
* @returns string The data URL of the image.
*/
@@ -3250,6 +3266,62 @@ declare namespace Electron {
* Play the beep sound.
*/
beep(): void;
/**
* Creates or updates a shortcut link at shortcutPath.
*
* Note: This API is available only on Windows.
*/
writeShortcutLink(shortcutPath: string, options: ShortcutLinkOptions): boolean;
/**
* Creates or updates a shortcut link at shortcutPath.
*
* Note: This API is available only on Windows.
*/
writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutLinkOptions): boolean;
/**
* Resolves the shortcut link at shortcutPath.
* An exception will be thrown when any error happens.
*
* Note: This API is available only on Windows.
*/
readShortcutLink(shortcutPath: string): ShortcutLinkOptions;
}
interface ShortcutLinkOptions {
/**
* The target to launch from this shortcut.
*/
target: string;
/**
* The working directory.
* Default: empty.
*/
cwd?: string;
/**
* The arguments to be applied to target when launching from this shortcut.
* Default: empty.
*/
args?: string;
/**
* The description of the shortcut.
* Default: empty.
*/
description?: string;
/**
* The path to the icon, can be a DLL or EXE. icon and iconIndex have to be set together.
* Default: empty, which uses the target's icon.
*/
icon?: string;
/**
* The resource ID of icon when icon is a DLL or EXE.
* Default: 0.
*/
iconIndex?: number;
/**
* The Application User Model ID.
* Default: empty.
*/
appUserModelId?: string;
}
// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md
@@ -3634,9 +3706,9 @@ declare namespace Electron {
/**
* Emitted when the cursors type changes.
* If the type parameter is custom, the image parameter will hold the custom cursor image
* in a NativeImage, and the scale will hold scaling information for the image.
* in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
*/
on(event: 'cursor-changed', listener: (event: Event, type: CursorType, image?: NativeImage, scale?: number) => void): this;
on(event: 'cursor-changed', listener: (event: Event, type: CursorType, image?: NativeImage, scale?: number, size?: Size, hotspot?: Point) => void): this;
/**
* Emitted when there is a new context menu that needs to be handled.
*/
@@ -3762,6 +3834,29 @@ declare namespace Electron {
* @returns Whether this page has been muted.
*/
isAudioMuted(): boolean;
/**
* Changes the zoom factor to the specified factor.
* Zoom factor is zoom percent divided by 100, so 300% = 3.0.
*/
setZoomFactor(factor: number): void;
/**
* Sends a request to get current zoom factor.
*/
getZoomFactor(callback: (zoomFactor: number) => void): void;
/**
* Changes the zoom level to the specified level.
* The original size is 0 and each increment above or below represents
* zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.
*/
setZoomLevel(level: number): void;
/**
* Sends a request to get current zoom level.
*/
getZoomLevel(callback: (zoomLevel: number) => void): void;
/**
* Sets the maximum and minimum zoom level.
*/
setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
/**
* Executes the editing command undo in web page.
*/
+2 -2
View File
@@ -145,8 +145,8 @@ people2.some((person: Em.Object) => {
people2.everyProperty('isHappy', true);
people2.someProperty('isHappy', true);
// Examples taken from http://emberjs.com/api/classes/Ember.RSVP.Promise.html
var promise = new Ember.RSVP.Promise(function(resolve: Function, reject: Function) {
// Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html
var promise = new Em.RSVP.Promise(function(resolve: Function, reject: Function) {
// on success
resolve('ok!');
+92 -296
View File
@@ -1,4 +1,4 @@
// Type definitions for Ember.js 2.0
// Type definitions for Ember.js 2.7
// Project: http://emberjs.com/
// Definitions by: Jed Mao <https://github.com/jedmao>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -446,7 +446,6 @@ declare namespace Ember {
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
static initializer(args?: ApplicationInitializerArguments): void;
/**
Call advanceReadiness after any asynchronous setup logic has completed.
Each call to deferReadiness must be matched by a call to advanceReadiness
@@ -528,6 +527,7 @@ declare namespace Ember {
Application's router.
**/
Router: Router;
registry: Registry;
}
/**
This module implements Observer-friendly Array-like behavior. This mixin is picked up by the
@@ -695,7 +695,7 @@ declare namespace Ember {
constructor(toPath: string, fromPath: string);
connect(obj: any): Binding;
copy(): Binding;
disconnect(obj: any): Binding;
disconnect(): Binding;
from(path: string): Binding;
to(path: string): Binding;
to(pathTuple: any[]): Binding;
@@ -788,8 +788,10 @@ declare namespace Ember {
constructor(parent: Container);
parent: Container;
children: any[];
owner: any;
ownerInjection(): any;
resolver: Function;
registry: {};
registry: Registry;
cache: {};
typeInjections: {};
injections: {};
@@ -803,7 +805,7 @@ declare namespace Ember {
describe(fullName: string): string;
makeToString(factory: any, fullName: string): Function;
lookup(fullName: string, options?: {}): any;
lookupFactory(fullName: string): any;
lookupFactory(fullName: string, options?: {}): any;
destroy(): void;
reset(): void;
}
@@ -1012,9 +1014,19 @@ declare namespace Ember {
You generally won't need to create or subclass this directly.
**/
class Descriptor { }
var EMPTY_META: {}; // TODO: define interface
var ENV: {};
var EXTEND_PROTOTYPES: boolean;
namespace ENV {
export var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
export var LOG_BINDINGS: boolean;
export var LOG_STACKTRACE_ON_DEPRECATION: boolean;
export var LOG_VERSION: boolean;
export var MODEL_FACTORY_INJECTIONS: boolean;
export var RAISE_ON_DEPRECATION: boolean;
}
namespace EXTEND_PROTOTYPES {
export var Array: boolean;
export var Function: boolean;
export var String: boolean;
}
/**
This is the object instance returned when you get the @each property on an array. It uses
the unknownProperty handler to automatically create EachArray instances for property names.
@@ -1135,7 +1147,7 @@ declare namespace Ember {
var GUID_KEY: string;
namespace Handlebars {
function compile(string: string): Function;
function precompile(string: string): void;
function precompile(string: string, options: any): void;
class Compiler { }
class JavaScriptCompiler { }
function registerPartial(name: string, str: any): void;
@@ -1579,6 +1591,10 @@ declare namespace Ember {
isEmpty(): boolean;
toArray(): any[];
}
class Registry {
constructor (options: any);
static set: typeof Ember.set;
}
// FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js
namespace RSVP {
@@ -2191,25 +2207,11 @@ declare namespace Ember {
resource(name: string, options?: {}, callback?: Function): void;
resource(name: string, callback: Function): void;
route(name: string, options?: {}): void;
explicitIndex: boolean;
router: Router;
options: any;
}
var SHIM_ES5: boolean;
var STRINGS: boolean;
class SelectOption extends Component {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
Iterate over each computed property for the class, passing its name and any
associated metadata (see metaForProperty) to the callback.
**/
static eachComputedProperty(callback: Function, binding: {}): void;
/**
Returns the original hash that was passed to meta().
@param key property name
**/
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
}
class State extends Object implements Evented {
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
@@ -2292,23 +2294,28 @@ declare namespace Ember {
class TargetActionSupport {
triggerAction(opts: {}): boolean;
}
class Test {
click(selector: string): RSVP.Promise;
fillin(selector: string, text: string): RSVP.Promise;
find(selector: string): JQuery;
findWithAssert(selector: string): JQuery;
injectTestHelpers(): void;
keyEvent(selector: string, type: string, keyCode: number): RSVP.Promise;
static oninjectHelpers(callback: Function): void;
static promise(resolver: Function): RSVP.Promise;
static registerHelper(name: string, helperMethod: Function): void;
removeTestHelpers(): void;
setupForTesting(): void;
static unregisterHelper(name: string): void;
visit(url: string): RSVP.Promise;
wait(value: any): RSVP.Promise;
static adapter: Object;
testHelpers: {};
namespace Test {
class Adapter extends Ember.Object {
constructor ();
}
class Promise extends Ember.RSVP.Promise {
constructor ();
}
function oninjectHelpers(callback: Function): void;
function promise(resolver: Function, label: string): Ember.Test.Promise;
function unregisterHelper(name: string): void;
function registerHelper(name: string, helperMethod: Function): void;
function registerAsyncHelper(name: string, helperMethod: Function): void;
var adapter: Object;
var QUnitAdapter: Object;
function registerWaiter(callback: Function): void;
function registerWaiter(context: any, callback: Function): void;
function unregisterWaiter(callback: Function): void;
function unregisterWaiter(context: any, callback: Function): void;
function resolve(result: any): Ember.Test.Promise;
}
class TextArea extends Component implements TextSupport {
static detect(obj: any): boolean;
@@ -2388,7 +2395,6 @@ declare namespace Ember {
**/
var alias: typeof deprecateFunc;
function aliasMethod(methodName: string): Descriptor;
var anyUnprocessedMixins: boolean;
function assert(desc: string, test: boolean): void;
function beginPropertyChanges(): void;
function bind(obj: any, to: string, from: string): Binding;
@@ -2418,8 +2424,6 @@ declare namespace Ember {
oneWay(dependentKey: string): ComputedProperty;
or(...args: string[]): ComputedProperty;
};
// ReSharper disable DuplicatingLocalDeclaration
var config: {};
// ReSharper restore DuplicatingLocalDeclaration
function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller;
function copy(obj: any, deep: boolean): any;
@@ -2439,10 +2443,7 @@ declare namespace Ember {
// ReSharper disable once DuplicatingLocalDeclaration
var empty: typeof deprecateFunc;
function endPropertyChanges(): void;
// ReSharper disable once DuplicatingLocalDeclaration
var exports: {};
function finishChains(obj: any): void;
function flushPendingChains(): void;
function generateController(container: Container, controllerName: string, context: any): Controller;
function generateGuid(obj: any, prefix?: string): string;
function get(obj: any, keyName: string): any;
@@ -2456,7 +2457,6 @@ declare namespace Ember {
function hasListeners(context: any, name: string): boolean;
function hasOwnProperty(prop: string): boolean;
function immediateObserver(func: Function, ...propertyNames: any[]): Function;
var imports: {};
function inspect(obj: any): string;
function instrument(name: string, payload: any, callback: Function, binding: any): void;
function isArray(obj: any): boolean;
@@ -2475,13 +2475,12 @@ declare namespace Ember {
var lookup: {}; // TODO: define interface
function makeArray(obj: any): any[];
function merge(original: any, updates: any): any;
function meta(obj: any, writable?: boolean): {};
function meta(obj: any): {};
function mixin(obj: any, ...args: any[]): any;
/**
Ember.none is deprecated. Please use Ember.isNone instead.
**/
var none: typeof deprecateFunc;
function normalizeTuple(target: any, path: string): any[];
function observer(...args: any[]): Function;
function observersFor(obj: any, path: string): any[];
function onLoad(name: string, callback: Function): void;
@@ -2558,13 +2557,16 @@ declare namespace Ember {
function watchPath(obj: any, keyPath: string): void;
function watchedEvents(obj: {}): any[];
function wrap(func: Function, superFunc: Function): Function;
var _ContainerProxyMixin : Mixin;
var _RegistryProxyMixin: Mixin;
function getOwner(object: any): any;
function setOwner(object: any, owner: any): void;
var testing : boolean;
var MODEL_FACTORY_INJECTIONS : boolean;
function assign(original: any, ...sources: any[]): any;
}
// ReSharper disable DuplicatingLocalDeclaration
declare namespace Em {
/**
Alias for jQuery.
**/
var $: typeof Ember.$;
var A: typeof Ember.A;
class ActionHandlerMixin extends Ember.ActionHandlerMixin { }
@@ -2581,13 +2583,12 @@ declare namespace Em {
class Container extends Ember.Container { }
class Controller extends Ember.Controller { }
class ControllerMixin extends Ember.ControllerMixin { }
class Copyable extends Ember.Copyable { }
class Copyable extends Ember.Copyable {}
class CoreObject extends Ember.CoreObject { }
class DAG extends Ember.DAG { }
var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION;
class DAG extends Ember.DAG {}
var DEFAULT_GETTER_FUNCTION : typeof Ember.DEFAULT_GETTER_FUNCTION;
class DefaultResolver extends Ember.DefaultResolver { }
class Descriptor extends Ember.Descriptor { }
var EMPTY_META: typeof Ember.EMPTY_META;
var ENV: typeof Ember.ENV;
var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
class EachProxy extends Ember.EachProxy { }
@@ -2602,7 +2603,7 @@ declare namespace Em {
var compile: typeof Ember.Handlebars.compile;
var precompile: typeof Ember.Handlebars.precompile;
class Compiler extends Ember.Handlebars.Compiler { }
class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { }
class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler{ }
var registerPartial: typeof Ember.Handlebars.registerPartial;
var K: typeof Ember.Handlebars.K;
var createFrame: typeof Ember.Handlebars.createFrame;
@@ -2621,7 +2622,7 @@ declare namespace Em {
var LOG_BINDINGS: typeof Ember.LOG_BINDINGS;
var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION;
var LOG_VERSION: typeof Ember.LOG_VERSION;
class Location extends Ember.Location { }
class Location extends Ember.Location {}
var Logger: typeof Ember.Logger;
var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION;
var META_KEY: typeof Ember.META_KEY;
@@ -2629,7 +2630,7 @@ declare namespace Em {
class MapWithDefault extends Ember.MapWithDefault { }
class Mixin extends Ember.Mixin { }
class MutableArray extends Ember.MutableArray { }
class MutableEnumerable extends Ember.MutableEnumberable { }
class MutableEnumberable extends Ember.MutableEnumberable { }
var NAME_KEY: typeof Ember.NAME_KEY;
class Namespace extends Ember.Namespace { }
class NativeArray extends Ember.NativeArray { }
@@ -2639,35 +2640,36 @@ declare namespace Em {
class ObjectProxy extends Ember.ObjectProxy { }
class Observable extends Ember.Observable { }
class OrderedSet extends Ember.OrderedSet { }
class Registry extends Ember.Registry { }
namespace RSVP {
interface PromiseResolve extends Ember.RSVP.PromiseResolve { }
interface PromiseReject extends Ember.RSVP.PromiseReject { }
interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { }
class Promise extends Ember.RSVP.Promise { }
}
class Route extends Ember.Route { }
class Route extends Ember.Route {}
class Router extends Ember.Router { }
class RouterDSL extends Ember.RouterDSL { }
var SHIM_ES5: typeof Ember.SHIM_ES5;
var STRINGS: typeof Ember.STRINGS;
class SelectOption extends Ember.SelectOption { }
class State extends Ember.State { }
class StateManager extends Ember.StateManager { }
namespace String {
var camelize: typeof Ember.String.camelize;
var capitalize: typeof Ember.String.capitalize;
var classify: typeof Ember.String.classify;
var dasherize: typeof Ember.String.dasherize;
var decamelize: typeof Ember.String.decamelize;
var fmt: typeof Ember.String.fmt;
var htmlSafe: typeof Ember.String.htmlSafe;
var loc: typeof Ember.String.loc;
var underscore: typeof Ember.String.underscore;
var w: typeof Ember.String.w;
}
var String : typeof Ember.String;
var TEMPLATES: typeof Ember.TEMPLATES;
class TargetActionSupport extends Ember.TargetActionSupport { }
class Test extends Ember.Test { }
class TargetActionSupport extends Ember.TargetActionSupport {}
namespace Test {
class Adapter extends Ember.Test.Adapter { }
class Promise extends Ember.Test.Promise { }
var oninjectHelpers: typeof Ember.Test.oninjectHelpers;
var promise: typeof Ember.Test.promise;
var unregisterHelper: typeof Ember.Test.unregisterHelper;
var registerHelper: typeof Ember.Test.registerHelper;
var registerAsyncHelper: typeof Ember.Test.registerAsyncHelper;
var adapter: typeof Ember.Test.adapter;
var QUnitAdapter: typeof Ember.Test.QUnitAdapter;
var registerWaiter: typeof Ember.Test.registerWaiter;
var unregisterWaiter: typeof Ember.Test.unregisterWaiter
var resolve: typeof Ember.Test.resolve;
}
class TextArea extends Ember.TextArea { }
class TextField extends Ember.TextField { }
class TextSupport extends Ember.TextSupport { }
@@ -2678,7 +2680,6 @@ declare namespace Em {
var addObserver: typeof Ember.addObserver;
var alias: typeof Ember.alias;
var aliasMethod: typeof Ember.aliasMethod;
var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins;
var assert: typeof Ember.assert;
var beginPropertyChanges: typeof Ember.beginPropertyChanges;
var bind: typeof Ember.bind;
@@ -2687,20 +2688,17 @@ declare namespace Em {
var changeProperties: typeof Ember.changeProperties;
var compare: typeof Ember.compare;
var computed: typeof Ember.computed;
var config: typeof Ember.config;
var controllerFor: typeof Ember.controllerFor;
var copy: typeof Ember.copy;
var create: typeof Ember.create;
var debug: typeof Ember.debug;
var defineProperty: typeof Ember.defineProperty;
var deprecate: typeof Ember.deprecate;
var deprecateFunc: typeof Ember.deprecateFunc;
var deprecateFunc: typeof Ember.deprecateFunc
var destroy: typeof Ember.destroy;
var empty: typeof deprecateFunc;
var empty: typeof Ember.empty;
var endPropertyChanges: typeof Ember.endPropertyChanges;
var exports: typeof Ember.exports;
var finishChains: typeof Ember.finishChains;
var flushPendingChains: typeof Ember.flushPendingChains;
var generateController: typeof Ember.generateController;
var generateGuid: typeof Ember.generateGuid;
var get: typeof Ember.get;
@@ -2711,7 +2709,6 @@ declare namespace Em {
var hasListeners: typeof Ember.hasListeners;
var hasOwnProperty: typeof Ember.hasOwnProperty;
var immediateObserver: typeof Ember.immediateObserver;
var imports: typeof Ember.imports;
var inspect: typeof Ember.inspect;
var instrument: typeof Ember.instrument;
var isArray: typeof Ember.isArray;
@@ -2732,7 +2729,6 @@ declare namespace Em {
var meta: typeof Ember.meta;
var mixin: typeof Ember.mixin;
var none: typeof Ember.none;
var normalizeTuple: typeof Ember.normalizeTuple;
var observer: typeof Ember.observer;
var observersFor: typeof Ember.observersFor;
var onLoad: typeof Ember.onLoad;
@@ -2772,6 +2768,13 @@ declare namespace Em {
var watchPath: typeof Ember.watchPath;
var watchedEvents: typeof Ember.watchedEvents;
var wrap: typeof Ember.wrap;
var _ContainerProxyMixin : typeof Ember._ContainerProxyMixin;
var _RegistryProxyMixin: typeof Ember._RegistryProxyMixin;
var getOwner: typeof Ember.getOwner;
var setOwner: typeof Ember.setOwner;
var testing: typeof Ember.testing;
var MODEL_FACTORY_INJECTIONS: typeof Ember.MODEL_FACTORY_INJECTIONS;
var assign: typeof Ember.assign;
}
/**
@@ -2779,212 +2782,5 @@ declare namespace Em {
*/
declare module "Ember" {
var $: typeof Ember.$;
var A: typeof Ember.A;
class ActionHandlerMixin extends Ember.ActionHandlerMixin { }
class Application extends Ember.Application { }
class Array extends Ember.Array { }
class ArrayProxy extends Ember.ArrayProxy { }
var BOOTED: typeof Ember.BOOTED;
class Binding extends Ember.Binding { }
class Button extends Ember.Button { }
class Checkbox extends Ember.Checkbox { }
class Comparable extends Ember.Comparable { }
class Component extends Ember.Component { }
class ComputedProperty extends Ember.ComputedProperty { }
class Container extends Ember.Container { }
class Controller extends Ember.Controller { }
class ControllerMixin extends Ember.ControllerMixin { }
class Copyable extends Ember.Copyable { }
class CoreObject extends Ember.CoreObject { }
class DAG extends Ember.DAG { }
var DEFAULT_GETTER_FUNCTION: typeof Ember.DEFAULT_GETTER_FUNCTION;
class DefaultResolver extends Ember.DefaultResolver { }
class Descriptor extends Ember.Descriptor { }
var EMPTY_META: typeof Ember.EMPTY_META;
var ENV: typeof Ember.ENV;
var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES;
class EachProxy extends Ember.EachProxy { }
class Enumerable extends Ember.Enumerable { }
var Error: typeof Ember.Error;
class EventDispatcher extends Ember.EventDispatcher { }
class Evented extends Ember.Evented { }
var FROZEN_ERROR: typeof Ember.FROZEN_ERROR;
class Freezable extends Ember.Freezable { }
var GUID_KEY: typeof Ember.GUID_KEY;
namespace Handlebars {
var compile: typeof Ember.Handlebars.compile;
var precompile: typeof Ember.Handlebars.precompile;
class Compiler extends Ember.Handlebars.Compiler { }
class JavaScriptCompiler extends Ember.Handlebars.JavaScriptCompiler { }
var registerPartial: typeof Ember.Handlebars.registerPartial;
var K: typeof Ember.Handlebars.K;
var createFrame: typeof Ember.Handlebars.createFrame;
var Exception: typeof Ember.Handlebars.Exception;
class SafeString extends Ember.Handlebars.SafeString { }
var parse: typeof Ember.Handlebars.parse;
var print: typeof Ember.Handlebars.print;
var logger: typeof Ember.Handlebars.logger;
var log: typeof Ember.Handlebars.log;
}
class HashLocation extends Ember.HashLocation { }
class HistoryLocation extends Ember.HistoryLocation { }
var IS_BINDING: typeof Ember.IS_BINDING;
class Instrumentation extends Ember.Instrumentation { }
var K: typeof Ember.K;
var LOG_BINDINGS: typeof Ember.LOG_BINDINGS;
var LOG_STACKTRACE_ON_DEPRECATION: typeof Ember.LOG_STACKTRACE_ON_DEPRECATION;
var LOG_VERSION: typeof Ember.LOG_VERSION;
class Location extends Ember.Location { }
var Logger: typeof Ember.Logger;
var MANDATORY_SETTER_FUNCTION: typeof Ember.MANDATORY_SETTER_FUNCTION;
var META_KEY: typeof Ember.META_KEY;
class Map extends Ember.Map { }
class MapWithDefault extends Ember.MapWithDefault { }
class Mixin extends Ember.Mixin { }
class MutableArray extends Ember.MutableArray { }
class MutableEnumerable extends Ember.MutableEnumberable { }
var NAME_KEY: typeof Ember.NAME_KEY;
class Namespace extends Ember.Namespace { }
class NativeArray extends Ember.NativeArray { }
class NoneLocation extends Ember.NoneLocation { }
var ORDER_DEFINITION: typeof Ember.ORDER_DEFINITION;
class Object extends Ember.Object { }
class ObjectProxy extends Ember.ObjectProxy { }
class Observable extends Ember.Observable { }
class OrderedSet extends Ember.OrderedSet { }
namespace RSVP {
interface PromiseResolve extends Ember.RSVP.PromiseResolve { }
interface PromiseReject extends Ember.RSVP.PromiseReject { }
interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { }
class Promise extends Ember.RSVP.Promise { }
}
class Route extends Ember.Route { }
class Router extends Ember.Router { }
class RouterDSL extends Ember.RouterDSL { }
var SHIM_ES5: typeof Ember.SHIM_ES5;
var STRINGS: typeof Ember.STRINGS;
class SelectOption extends Ember.SelectOption { }
class State extends Ember.State { }
class StateManager extends Ember.StateManager { }
namespace String {
var camelize: typeof Ember.String.camelize;
var capitalize: typeof Ember.String.capitalize;
var classify: typeof Ember.String.classify;
var dasherize: typeof Ember.String.dasherize;
var decamelize: typeof Ember.String.decamelize;
var fmt: typeof Ember.String.fmt;
var htmlSafe: typeof Ember.String.htmlSafe;
var loc: typeof Ember.String.loc;
var underscore: typeof Ember.String.underscore;
var w: typeof Ember.String.w;
}
var TEMPLATES: typeof Ember.TEMPLATES;
class TargetActionSupport extends Ember.TargetActionSupport { }
class Test extends Ember.Test { }
class TextArea extends Ember.TextArea { }
class TextField extends Ember.TextField { }
class TextSupport extends Ember.TextSupport { }
var VERSION: typeof Ember.VERSION;
class ViewTargetActionSupport extends Ember.ViewTargetActionSupport { }
var ViewUtils: typeof Ember.ViewUtils;
var addListener: typeof Ember.addListener;
var addObserver: typeof Ember.addObserver;
var alias: typeof Ember.alias;
var aliasMethod: typeof Ember.aliasMethod;
var anyUnprocessedMixins: typeof Ember.anyUnprocessedMixins;
var assert: typeof Ember.assert;
var beginPropertyChanges: typeof Ember.beginPropertyChanges;
var bind: typeof Ember.bind;
var cacheFor: typeof Ember.cacheFor;
var canInvoke: typeof Ember.canInvoke;
var changeProperties: typeof Ember.changeProperties;
var compare: typeof Ember.compare;
var computed: typeof Ember.computed;
var config: typeof Ember.config;
var controllerFor: typeof Ember.controllerFor;
var copy: typeof Ember.copy;
var create: typeof Ember.create;
var debug: typeof Ember.debug;
var defineProperty: typeof Ember.defineProperty;
var deprecate: typeof Ember.deprecate;
var deprecateFunc: typeof Ember.deprecateFunc;
var destroy: typeof Ember.destroy;
var empty: typeof Ember.deprecateFunc;
var endPropertyChanges: typeof Ember.endPropertyChanges;
var exports: typeof Ember.exports;
var finishChains: typeof Ember.finishChains;
var flushPendingChains: typeof Ember.flushPendingChains;
var generateController: typeof Ember.generateController;
var generateGuid: typeof Ember.generateGuid;
var get: typeof Ember.get;
var getPath: typeof Ember.getPath;
var getWithDefault: typeof Ember.getWithDefault;
var guidFor: typeof Ember.guidFor;
var handleErrors: typeof Ember.handleErrors;
var hasListeners: typeof Ember.hasListeners;
var hasOwnProperty: typeof Ember.hasOwnProperty;
var immediateObserver: typeof Ember.immediateObserver;
var imports: typeof Ember.imports;
var inspect: typeof Ember.inspect;
var instrument: typeof Ember.instrument;
var isArray: typeof Ember.isArray;
var isEmpty: typeof Ember.isEmpty;
var isEqual: typeof Ember.isEqual;
var isGlobalPath: typeof Ember.isGlobalPath;
var isNamespace: typeof Ember.isNamespace;
var isNone: typeof Ember.isNone;
var isPrototypeOf: typeof Ember.isPrototypeOf;
var isWatching: typeof Ember.isWatching;
var keys: typeof Ember.keys;
var listenersDiff: typeof Ember.listenersDiff;
var listenersFor: typeof Ember.listenersFor;
var listenersUnion: typeof Ember.listenersUnion;
var lookup: typeof Ember.lookup;
var makeArray: typeof Ember.makeArray;
var merge: typeof Ember.merge;
var meta: typeof Ember.meta;
var mixin: typeof Ember.mixin;
var none: typeof Ember.none;
var normalizeTuple: typeof Ember.normalizeTuple;
var observer: typeof Ember.observer;
var observersFor: typeof Ember.observersFor;
var onLoad: typeof Ember.onLoad;
var onError: typeof Ember.onError;
var overrideChains: typeof Ember.overrideChains;
var platform: typeof Ember.platform;
var propertyDidChange: typeof Ember.propertyDidChange;
var propertyIsEnumerable: typeof Ember.propertyIsEnumerable;
var propertyWillChange: typeof Ember.propertyWillChange;
var removeChainWatcher: typeof Ember.removeChainWatcher;
var removeListener: typeof Ember.removeListener;
var removeObserver: typeof Ember.removeObserver;
var required: typeof Ember.required;
var rewatch: typeof Ember.rewatch;
var run: typeof Ember.run;
var runLoadHooks: typeof Ember.runLoadHooks;
var sendEvent: typeof Ember.sendEvent;
var set: typeof Ember.set;
var setPath: typeof Ember.setPath;
var setProperties: typeof Ember.setProperties;
var subscribe: typeof Ember.subscribe;
var toLocaleString: typeof Ember.toLocaleString;
var toString: typeof Ember.toString;
var tryCatchFinally: typeof Ember.tryCatchFinally;
var tryInvoke: typeof Ember.tryInvoke;
var trySet: typeof Ember.trySet;
var trySetPath: typeof Ember.trySetPath;
var typeOf: typeof Ember.typeOf;
var unwatch: typeof Ember.unwatch;
var unwatchKey: typeof Ember.unwatchKey;
var unwatchPath: typeof Ember.unwatchPath;
var uuid: typeof Ember.uuid;
var valueOf: typeof Ember.valueOf;
var warn: typeof Ember.warn;
var watch: typeof Ember.watch;
var watchKey: typeof Ember.watchKey;
var watchPath: typeof Ember.watchPath;
var watchedEvents: typeof Ember.watchedEvents;
var wrap: typeof Ember.wrap;
export = Ember;
}
+10 -10
View File
@@ -48,15 +48,15 @@ interface ExpressBruteMiddleware {
* @interface
*/
interface ExpressBruteOptions {
freeRetries: number;
proxyDepth: number;
attachResetToRequest: boolean;
refreshTimeoutOnRequest: boolean;
minWait: number;
maxWait: number;
lifetime: number;
failCallback: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void;
handleStoreError: any;
freeRetries?: number;
proxyDepth?: number;
attachResetToRequest?: boolean;
refreshTimeoutOnRequest?: boolean;
minWait?: number;
maxWait?: number;
lifetime?: number;
failCallback?: (req: express.Request, res: express.Response, next: Function, nextValidRequestDate: any) => void;
handleStoreError?: any;
}
/**
@@ -69,7 +69,7 @@ declare class ExpressBrute {
* @constructor
* @param {any} store The store.
*/
constructor(store: any);
constructor(store: any, options?: ExpressBruteOptions);
/**
* @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback.
+18 -1
View File
@@ -67,11 +67,28 @@ interface PayDialogParams {
test_currency?: string;
}
interface FeedDialogParams {
method: string; // "feed"
app_id: string;
redirect_uri?: string;
display?: string;
from?: string;
to?: string;
link?: string;
picture?: string;
source?: string;
name: string;
caption?: string;
description?: string;
ref?: any;
}
declare type FBUIParams = ShareDialogParams
| PageTabDialogParams
| RequestsDialogParams
| SendDialogParams
| PayDialogParams;
| PayDialogParams
| FeedDialogParams;
interface FBLoginOptions{
auth_type?: string;
+346
View File
@@ -0,0 +1,346 @@
/// <reference path="gl-matrix-typed.d.ts" />
// common
import {vec2, mat2, mat3, mat4, vec3, vec4, glMatrix, mat2d, quat} from "./gl-matrix-typed";
var result: number = glMatrix.toRadian(180);
var outVal: number;
var outBool: boolean;
var outStr: string;
let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
let vec2A = vec2.fromValues(1, 2);
let vec2B = vec2.fromValues(3, 4);
let vec3A = vec3.fromValues(1, 2, 3);
let vec3B = vec3.fromValues(3, 4, 5);
let vec4A = vec4.fromValues(1, 2, 3, 4);
let vec4B = vec4.fromValues(3, 4, 5, 6);
let mat2A = mat2.fromValues(1, 2, 3, 4);
let mat2B = mat2.fromValues(1, 2, 3, 4);
let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let quatA = quat.fromValues(1, 2, 3, 4);
let quatB = quat.fromValues(5, 6, 7, 8);
let outVec2 = vec2.create();
let outVec3 = vec3.create();
let outVec4 = vec4.create();
let outMat2 = mat2.create();
let outMat2d = mat2d.create();
let outMat3 = mat3.create();
let outMat4 = mat4.create();
let outQuat = quat.create();
// vec2
outVec2 = vec2.create();
outVec2 = vec2.clone(vec2A);
outVec2 = vec2.fromValues(1, 2);
outVec2 = vec2.copy(outVec2, vec2A);
outVec2 = vec2.set(outVec2, 1, 2);
outVec2 = vec2.add(outVec2, vec2A, vec2B);
outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
outVec2 = vec2.sub(outVec2, vec2A, vec2B);
outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
outVec2 = vec2.mul(outVec2, vec2A, vec2B);
outVec2 = vec2.divide(outVec2, vec2A, vec2B);
outVec2 = vec2.div(outVec2, vec2A, vec2B);
outVec2 = vec2.ceil(outVec2, vec2A);
outVec2 = vec2.floor(outVec2, vec2A);
outVec2 = vec2.min(outVec2, vec2A, vec2B);
outVec2 = vec2.max(outVec2, vec2A, vec2B);
outVec2 = vec2.round(outVec2, vec2A);
outVec2 = vec2.scale(outVec2, vec2A, 2);
outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
outVal = vec2.distance(vec2A, vec2B);
outVal = vec2.dist(vec2A, vec2B);
outVal = vec2.squaredDistance(vec2A, vec2B);
outVal = vec2.sqrDist(vec2A, vec2B);
outVal = vec2.length(vec2A);
outVal = vec2.len(vec2A);
outVal = vec2.squaredLength(vec2A);
outVal = vec2.sqrLen(vec2A);
outVec2 = vec2.negate(outVec2, vec2A);
outVec2 = vec2.inverse(outVec2, vec2A);
outVec2 = vec2.normalize(outVec2, vec2A);
outVal = vec2.dot(vec2A, vec2B);
outVec2 = vec2.cross(outVec2, vec2A, vec2B);
outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
outVec2 = vec2.random(outVec2);
outVec2 = vec2.random(outVec2, 5.0);
outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
outStr = vec2.str(vec2A);
outBool = vec2.exactEquals(vec2A, vec2B);
outBool = vec2.equals(vec2A, vec2B);
// vec3
outVec3 = vec3.create();
outVec3 = vec3.clone(vec3A);
outVec3 = vec3.fromValues(1, 2, 3);
outVec3 = vec3.copy(outVec3, vec3A);
outVec3 = vec3.set(outVec3, 1, 2, 3);
outVec3 = vec3.add(outVec3, vec3A, vec3B);
outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
outVec3 = vec3.sub(outVec3, vec3A, vec3B);
outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
outVec3 = vec3.mul(outVec3, vec3A, vec3B);
outVec3 = vec3.divide(outVec3, vec3A, vec3B);
outVec3 = vec3.div(outVec3, vec3A, vec3B);
outVec3 = vec3.ceil(outVec3, vec3A);
outVec3 = vec3.floor(outVec3, vec3A);
outVec3 = vec3.min(outVec3, vec3A, vec3B);
outVec3 = vec3.max(outVec3, vec3A, vec3B);
outVec3 = vec3.round(outVec3, vec3A);
outVec3 = vec3.scale(outVec3, vec3A, 2);
outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
outVal = vec3.distance(vec3A, vec3B);
outVal = vec3.dist(vec3A, vec3B);
outVal = vec3.squaredDistance(vec3A, vec3B);
outVal = vec3.sqrDist(vec3A, vec3B);
outVal = vec3.length(vec3A);
outVal = vec3.len(vec3A);
outVal = vec3.squaredLength(vec3A);
outVal = vec3.sqrLen(vec3A);
outVec3 = vec3.negate(outVec3, vec3A);
outVec3 = vec3.inverse(outVec3, vec3A);
outVec3 = vec3.normalize(outVec3, vec3A);
outVal = vec3.dot(vec3A, vec3B);
outVec3 = vec3.cross(outVec3, vec3A, vec3B);
outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
outVec3 = vec3.random(outVec3);
outVec3 = vec3.random(outVec3, 5.0);
outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
outVal = vec3.angle(vec3A, vec3B);
outStr = vec3.str(vec3A);
outBool = vec3.exactEquals(vec3A, vec3B);
outBool = vec3.equals(vec3A, vec3B);
// vec4
outVec4 = vec4.create();
outVec4 = vec4.clone(vec4A);
outVec4 = vec4.fromValues(1, 2, 3, 4);
outVec4 = vec4.copy(outVec4, vec4A);
outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
outVec4 = vec4.add(outVec4, vec4A, vec4B);
outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
outVec4 = vec4.sub(outVec4, vec4A, vec4B);
outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
outVec4 = vec4.mul(outVec4, vec4A, vec4B);
outVec4 = vec4.divide(outVec4, vec4A, vec4B);
outVec4 = vec4.div(outVec4, vec4A, vec4B);
outVec4 = vec4.ceil(outVec4, vec4A);
outVec4 = vec4.floor(outVec4, vec4A);
outVec4 = vec4.min(outVec4, vec4A, vec4B);
outVec4 = vec4.max(outVec4, vec4A, vec4B);
outVec4 = vec4.scale(outVec4, vec4A, 2);
outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
outVal = vec4.distance(vec4A, vec4B);
outVal = vec4.dist(vec4A, vec4B);
outVal = vec4.squaredDistance(vec4A, vec4B);
outVal = vec4.sqrDist(vec4A, vec4B);
outVal = vec4.length(vec4A);
outVal = vec4.len(vec4A);
outVal = vec4.squaredLength(vec4A);
outVal = vec4.sqrLen(vec4A);
outVec4 = vec4.negate(outVec4, vec4A);
outVec4 = vec4.inverse(outVec4, vec4A);
outVec4 = vec4.normalize(outVec4, vec4A);
outVal = vec4.dot(vec4A, vec4B);
outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
outVec4 = vec4.random(outVec4);
outVec4 = vec4.random(outVec4, 5.0);
outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
outStr = vec4.str(vec4A);
outBool = vec4.exactEquals(vec4A, vec4B);
outBool = vec4.equals(vec4A, vec4B);
// mat2
outMat2 = mat2.create();
outMat2 = mat2.clone(mat2A);
outMat2 = mat2.copy(outMat2, mat2A);
outMat2 = mat2.identity(outMat2);
outMat2 = mat2.fromValues(1, 2, 3, 4);
outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
outMat2 = mat2.transpose(outMat2, mat2A);
outMat2 = mat2.invert(outMat2, mat2A);
outMat2 = mat2.adjoint(outMat2, mat2A);
outVal = mat2.determinant(mat2A);
outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
outMat2 = mat2.mul(outMat2, mat2A, mat2B);
outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
outMat2 = mat2.scale(outMat2, mat2A, vec2A);
outMat2 = mat2.fromRotation(outMat2, 0.5);
outMat2 = mat2.fromScaling(outMat2, vec2A);
outStr = mat2.str(mat2A);
outVal = mat2.frob(mat2A);
var L = mat2.create();
var D = mat2.create();
var U = mat2.create();
outMat2 = mat2.LDU(L, D, U, mat2A);
outMat2 = mat2.add(outMat2, mat2A, mat2B);
outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
outMat2 = mat2.sub(outMat2, mat2A, mat2B);
outBool = mat2.exactEquals(mat2A, mat2B);
outBool = mat2.equals(mat2A, mat2B);
outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2);
outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2);
// mat2d
outMat2d = mat2d.create();
outMat2d = mat2d.clone(mat2dA);
outMat2d = mat2d.copy(outMat2d, mat2dA);
outMat2d = mat2d.identity(outMat2d);
outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
outMat2d = mat2d.invert(outMat2d, mat2dA);
outVal = mat2d.determinant(mat2dA);
outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
outMat2d = mat2d.fromRotation(outMat2d, 0.5);
outMat2d = mat2d.fromScaling(outMat2d, vec2A);
outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
outStr = mat2d.str(mat2dA);
outVal = mat2d.frob(mat2dA);
outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2);
outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2);
outBool = mat2d.exactEquals(mat2dA, mat2dB);
outBool = mat2d.equals(mat2dA, mat2dB);
// mat3
outMat3 = mat3.create();
outMat3 = mat3.fromMat4(outMat3, mat4A);
outMat3 = mat3.clone(mat3A);
outMat3 = mat3.copy(outMat3, mat3A);
outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
outMat3 = mat3.identity(outMat3);
outMat3 = mat3.transpose(outMat3, mat3A);
outMat3 = mat3.invert(outMat3, mat3A);
outMat3 = mat3.adjoint(outMat3, mat3A);
outVal = mat3.determinant(mat3A);
outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
outMat3 = mat3.mul(outMat3, mat3A, mat3B);
outMat3 = mat3.translate(outMat3, mat3A, vec3A);
outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2);
outMat3 = mat3.scale(outMat3, mat3A, vec2A);
outMat3 = mat3.fromTranslation(outMat3, vec2A);
outMat3 = mat3.fromRotation(outMat3, Math.PI);
outMat3 = mat3.fromScaling(outMat3, vec2A);
outMat3 = mat3.fromMat2d(outMat3, mat2dA);
outMat3 = mat3.fromQuat(outMat3, quatA);
outMat3 = mat3.normalFromMat4(outMat3, mat4A);
outStr = mat3.str(mat3A);
outVal = mat3.frob(mat3A);
outMat3 = mat3.add(outMat3, mat3A, mat3B);
outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
outMat3 = mat3.sub(outMat3, mat3A, mat3B);
outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2);
outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2);
outBool = mat3.exactEquals(mat3A, mat3B);
outBool = mat3.equals(mat3A, mat3B);
//mat4
outMat4 = mat4.create();
outMat4 = mat4.clone(mat4A);
outMat4 = mat4.copy(outMat4, mat4A);
outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
outMat4 = mat4.identity(outMat4);
outMat4 = mat4.transpose(outMat4, mat4A);
outMat4 = mat4.invert(outMat4, mat4A);
outMat4 = mat4.adjoint(outMat4, mat4A);
outVal = mat4.determinant(mat4A);
outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
outMat4 = mat4.mul(outMat4, mat4A, mat4B);
outMat4 = mat4.translate(outMat4, mat4A, vec3A);
outMat4 = mat4.scale(outMat4, mat4A, vec3A);
outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
outMat4 = mat4.fromTranslation(outMat4, vec3A);
outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A);
outMat4 = mat4.fromScaling(outMat4, vec3A);
outMat4 = mat4.fromXRotation(outMat4, Math.PI);
outMat4 = mat4.fromYRotation(outMat4, Math.PI);
outMat4 = mat4.fromZRotation(outMat4, Math.PI);
outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
outVec3 = mat4.getTranslation(outVec3, mat4A)
outQuat = mat4.getRotation(outQuat, mat4A)
outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
outMat4 = mat4.fromQuat(outMat4, quatB);
outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0);
outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
outStr = mat4.str(mat4A);
outVal = mat4.frob(mat4A);
outMat4 = mat4.add(outMat4, mat4A, mat4B);
outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
outMat4 = mat4.sub(outMat4, mat4A, mat4B);
outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2);
outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2);
outBool = mat4.exactEquals(mat4A, mat4B);
outBool = mat4.equals(mat4A, mat4B);
// quat
var deg90 = Math.PI / 2;
outQuat = quat.create();
outQuat = quat.clone(quatA);
outQuat = quat.fromValues(1, 2, 3, 4);
outQuat = quat.copy(outQuat, quatA);
outQuat = quat.set(outQuat, 1, 2, 3, 4);
outQuat = quat.identity(outQuat);
outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
outVal = quat.getAxisAngle (outVec3, quatA);
outQuat = quat.add(outQuat, quatA, quatB);
outQuat = quat.multiply(outQuat, quatA, quatB);
outQuat = quat.mul(outQuat, quatA, quatB);
outQuat = quat.scale(outQuat, quatA, 2);
outVal = quat.length(quatA);
outVal = quat.len(quatA);
outVal = quat.squaredLength(quatA);
outVal = quat.sqrLen(quatA);
outQuat = quat.normalize(outQuat, quatA);
outVal = quat.dot(quatA, quatB);
outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
outQuat = quat.invert(outQuat, quatA);
outQuat = quat.conjugate(outQuat, quatA);
outStr = quat.str(quatA);
outQuat = quat.rotateX(outQuat, quatA, deg90);
outQuat = quat.rotateY(outQuat, quatA, deg90);
outQuat = quat.rotateZ(outQuat, quatA, deg90);
outQuat = quat.fromMat3(outQuat, mat3A);
outQuat = quat.calculateW(outQuat, quatA);
outBool = quat.exactEquals(quatA, quatB);
outBool = quat.equals(quatA, quatB);
+3054
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -2,8 +2,9 @@
var params: ReCaptchaV2.Parameters = {
"sitekey": "mySuperSecretKey",
"theme": "black", // no type-checking here.
"theme": "light",
"type": "image",
"size": "normal",
"tabindex": 5,
"callback": (response: string) => { },
"expired-callback": () => { },
+16 -3
View File
@@ -29,6 +29,10 @@ declare namespace ReCaptchaV2
getResponse(opt_widget_id?: number): string;
}
type Theme = "light" | "dark";
type Type = "image" | "audio";
type Size = "normal" | "compact";
interface Parameters
{
/**
@@ -39,14 +43,23 @@ declare namespace ReCaptchaV2
* Optional. The color theme of the widget.
* Accepted values: "light", "dark"
* @default "light"
* @type {Theme}
**/
theme?: string;
theme?: Theme;
/**
* Optional. The type of CAPTCHA to serve.
* Accepted values: "audio ", "image"
* Accepted values: "audio", "image"
* @default "image"
* @type {Type}
**/
type?: string;
type?: Type;
/**
* Optional. The size of the widget.
* Accepted values: "compact", "normal"
* @default "compact"
* @type {Size}
*/
size?: Size;
/**
* Optional. The tabindex of the widget and challenge.
* If other elements in your page use tabindex, it should be set to make user navigation easier.
+44 -4
View File
@@ -18,7 +18,45 @@ interface HelloJSLogoutOptions {
force?: boolean;
}
interface HelloJSEvent {
interface HelloJSImmediateSuccessCB<T, TP> {
(value: T): TP;
}
interface HelloJSImmediateErrorCB<TP> {
(err: any): TP;
}
interface HelloJSDeferredSuccessCB<T, TP> {
(value: T): HelloJSThenable<TP>;
}
interface HelloJSDeferredErrorCB<TP> {
(error: any): HelloJSThenable<TP>;
}
interface HelloJSThenable<T> {
then<TP>(
successCB?: HelloJSDeferredSuccessCB<T, TP>,
errorCB?: HelloJSDeferredErrorCB<TP>
): HelloJSThenable<TP>;
then<TP>(
successCB?: HelloJSDeferredSuccessCB<T, TP>,
errorCB?: HelloJSImmediateErrorCB<TP>
): HelloJSThenable<TP>;
then<TP>(
successCB?: HelloJSImmediateSuccessCB<T, TP>,
errorCB?: HelloJSDeferredErrorCB<TP>
): HelloJSThenable<TP>;
then<TP>(
successCB?: HelloJSImmediateSuccessCB<T, TP>,
errorCB?: HelloJSImmediateErrorCB<TP>
): HelloJSThenable<TP>;
}
interface HelloJSEvent extends HelloJSThenable<void> {
on(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
off(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
findEvents(event: string, callback: (name: string, index: number) => void): void;
@@ -30,15 +68,17 @@ interface HelloJSEvent {
}
interface HelloJSEventArgument {
network: string;
authResponse?: any;
}
interface HelloJSStatic extends HelloJSEvent {
init(serviceAppIds: { [id: string]: string; }, options?: HelloJSLoginOptions): void;
login(network: string, options?: HelloJSLoginOptions, callback?: () => void): void;
logout(network: string, options?: HelloJSLogoutOptions, callback?: () => void): void;
login(network: string, options?: HelloJSLoginOptions, callback?: () => void): HelloJSStatic;
logout(network: string, options?: HelloJSLogoutOptions, callback?: () => void): HelloJSStatic;
getAuthResponse(network: string): any;
service(network: string): HelloJSServiceDef;
settings: HelloJSLoginOptions;
@@ -50,7 +90,7 @@ interface HelloJSStaticNamed {
login(option?: HelloJSLoginOptions, callback?: () => void): void;
logout(callback?: () => void): void;
getAuthResponse(): any;
api(path?: string, method?: string, data?: any, callback?: (json?: any) => void): HelloJSStatic;
api(path?: string, method?: string, data?: any, callback?: (json?: any) => void): HelloJSStatic;
}
interface HelloJSOAuthDef {
+45 -34
View File
@@ -39,15 +39,15 @@ declare namespace i18n {
count?: number;
context?: any;
replace?: any;
lng?:string;
lngs?:string[];
fallbackLng?:string;
ns?:string|string[];
keySeparator?:string;
nsSeparator?:string;
returnObjects?:boolean;
joinArrays?:string;
postProcess?:string|any[];
lng?: string;
lngs?: string[];
fallbackLng?: string;
ns?: string | string[];
keySeparator?: string;
nsSeparator?: string;
returnObjects?: boolean;
joinArrays?: string;
postProcess?: string | any[];
interpolation?: InterpolationOptions;
}
@@ -56,10 +56,10 @@ declare namespace i18n {
resources?: ResourceStore;
lng?: string;
fallbackLng?: string;
ns?: string|string[];
ns?: string | string[];
defaultNS?: string;
fallbackNS?: string|string[];
whitelist?:string[];
fallbackNS?: string | string[];
whitelist?: string[];
lowerCaseLng?: boolean;
load?: string
preload?: string[];
@@ -69,56 +69,67 @@ declare namespace i18n {
contextSeparator?: string;
saveMissing?: boolean;
saveMissingTo?: string;
missingKeyHandler?: (lng:string, ns:string, key:string, fallbackValue:string) => void;
parseMissingKeyHandler?: (key:string) => void;
missingKeyHandler?: (lng: string, ns: string, key: string, fallbackValue: string) => void;
parseMissingKeyHandler?: (key: string) => void;
appendNamespaceToMissingKey?: boolean;
postProcess?: string|any[];
postProcess?: string | any[];
returnNull?: boolean;
returnEmptyString?: boolean;
returnObjects?: boolean;
returnedObjectHandler?: (key:string, value:string, options:any) => void;
returnedObjectHandler?: (key: string, value: string, options: any) => void;
joinArrays?: string;
overloadTranslationOptionHandler?: (args:any[]) => TranslationOptions;
overloadTranslationOptionHandler?: (args: any[]) => TranslationOptions;
interpolation?: InterpolationOptions;
detection?: any;
backend?: any;
cache?: any;
}
type TranslationFunction = (key:string, options?:TranslationOptions) => string;
type TranslationFunction = (key: string, options?: TranslationOptions) => string;
interface I18n {
//constructor(options?:Options, callback?:(err:any, t:TranslationFunction) => void);
//constructor(options?: Options, callback?: (err: any, t: TranslationFunction) => void);
init(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n;
init(options?: Options, callback?: (err: any, t: TranslationFunction) => void): I18n;
loadResources(callback?:(err:any) => void):void;
loadResources(callback?: (err: any) => void): void;
language:string;
language: string;
languages:string[];
languages: string[];
use(module:any):I18n;
use(module: any): I18n;
changeLanguage(lng:string, callback?:(err:any, t:TranslationFunction) => void):void;
changeLanguage(lng: string, callback?: (err: any, t: TranslationFunction) => void): void;
getFixedT(lng?:string, ns?:string|string[]):TranslationFunction;
getFixedT(lng?: string, ns?: string | string[]): TranslationFunction;
t(key:string, options?:TranslationOptions):string|any|Array<any>;
t(key: string, options?: TranslationOptions): string | any | Array<any>;
exists():boolean;
exists(): boolean;
setDefaultNamespace(ns:string):void;
setDefaultNamespace(ns: string): void;
loadNamespaces(ns:string[], callback?:() => void):void;
loadNamespaces(ns: string[], callback?: () => void): void;
loadLanguages(lngs:string[], callback?:()=>void):void;
loadLanguages(lngs: string[], callback?: () => void): void;
dir(lng?:string):string;
dir(lng?: string): string;
createInstance(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n;
createInstance(options?: Options, callback?: (err: any, t: TranslationFunction) => void): I18n;
cloneInstance(options?:Options, callback?:(err:any, t:TranslationFunction) => void):I18n;
cloneInstance(options?: Options, callback?: (err: any, t: TranslationFunction) => void): I18n;
on(event: string, listener: () => void): void;
on(initialized: 'initialized', listener: (options: i18n.Options) => void): void;
on(loaded: 'loaded', listener: (loaded: any) => void): void;
on(failedLoading: 'failedLoading', listener: (lng: string, ns: string, msg: string) => void): void;
on(missingKey: 'missingKey', listener: (lngs: any, namespace: string, key: string, res: any) => void): void;
on(added: 'added', listener: (lng: string, ns: string) => void): void;
on(removed: 'removed', listener: (lng: string, ns: string) => void): void;
on(languageChanged: 'languageChanged', listener: (lng: string) => void): void;
off(event: string, listener: () => void): void;
}
}
+3
View File
@@ -73,6 +73,9 @@ declare class MockAjax {
stubRequest(url: RegExp, data?: string, method?: string): JasmineAjaxRequestStub;
stubRequest(url: string, data?: string, method?: string): JasmineAjaxRequestStub;
stubRequest(url: RegExp, data?: RegExp, method?: string): JasmineAjaxRequestStub;
stubRequest(url: string, data?: RegExp, method?: string): JasmineAjaxRequestStub;
requests: JasmineAjaxRequestTracker;
stubs: JasmineAjaxStubTracker;
+1 -1
View File
@@ -43,5 +43,5 @@ declare function serve(root: string, opts?: {
*/
gzip?: boolean;
}): { (ctx: Koa.Context, next?: () => any): any };
declare namespace serve{}
export = serve;
+3 -1
View File
@@ -6840,7 +6840,9 @@ namespace TestIsError {
}
{
class CustomError extends Error {}
class CustomError extends Error {
custom: string
}
let value: number|CustomError;
+4 -2
View File
@@ -1122,7 +1122,9 @@ declare module "mongoose" {
* potentially overwritting any changes that happen between when you retrieved the object
* and when you save it.
*/
sort(compareFn?: (a: T, b: T) => number): this;
// some lib.d.ts have return type "this" and others have return type "T[]"
// which causes errors. Let the inherited array provide the sort() method.
//sort(compareFn?: (a: T, b: T) => number): T[];
/**
* Wraps Array#splice with proper change tracking and casting.
@@ -2601,4 +2603,4 @@ declare module "mongoose" {
name: string;
}
}
}
}
+2 -2
View File
@@ -923,7 +923,7 @@ declare module "https" {
requestCert?: boolean;
rejectUnauthorized?: boolean;
NPNProtocols?: any;
SNICallback?: (servername: string) => any;
SNICallback?: (servername: string, cb:(err:Error,ctx:tls.SecureContext)=>any) => any;
}
export interface RequestOptions extends http.RequestOptions {
@@ -2015,7 +2015,7 @@ declare module "tls" {
requestCert?: boolean;
rejectUnauthorized?: boolean;
NPNProtocols?: any; //array or Buffer;
SNICallback?: (servername: string) => any;
SNICallback?: (servername: string, cb:(err:Error,ctx:SecureContext)=>any) => any;
}
export interface ConnectionOptions {
+20
View File
@@ -1070,6 +1070,25 @@ declare namespace olx {
rightHanded?: boolean;
}
}
namespace control {
interface ControlOptions {
/**
* The element is the control's container element. This only needs to be specified if you're developing a custom control.
*/
element?: Element;
/**
* Function called when the control should be re-rendered. This is called in a requestAnimationFrame callback.
*/
render?: any;
/**
* Specify a target if you want the control to be rendered outside of the map's viewport.
*/
target?: Element | string;
}
}
}
/**
@@ -2388,6 +2407,7 @@ declare namespace ol {
}
class Control {
constructor(options: olx.control.ControlOptions);
}
class FullScreen {
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for pkcs11js v1.0.0
// Type definitions for pkcs11js v1.0.3
// Project: https://github.com/PeculiarVentures/pkcs11js
// Definitions by: Stepan Miroshin <https://github.com/microshine>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -7,12 +7,12 @@
/**
* A Node.js implementation of the PKCS#11 2.3 interface
* v1.0.0
* v1.0.3
*/
declare module "pkcs11js" {
type Handle = number;
type Handle = Buffer;
interface Version {
+11 -11
View File
@@ -1,38 +1,38 @@
// Tests for serialport.d.ts
// Project: https://github.com/EmergingTechnologyAdvisors/node-serialport
// Project: https://github.com/EmergingTechnologyAdvisors/node-serialport
// Definitions by: Jeremy Foster <https://github.com/codefoster>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Tests taken from documentation samples.
/// <reference path="serialport.d.ts" />
import * as serialport from 'serialport';
import * as SerialPort from 'serialport';
function test_basic_connect() {
let port = new serialport.SerialPort("");
let port = new SerialPort("");
}
function test_connect_config() {
let port = new serialport.SerialPort("", {
let port = new SerialPort("", {
baudrate: 0,
disconnectedCallback: function () { },
parser: serialport.parsers.readline("\n")
parser: SerialPort.parsers.readline("\n")
});
}
function test_write() {
let port = new serialport.SerialPort("");
port.write('main screen turn on', (err, bytesWritten) => {
let port = new SerialPort("");
port.write("main screen turn on", (err, bytesWritten) => {
});
}
function test_events() {
let port = new serialport.SerialPort("");
port.on('open', function () { });
let port = new SerialPort("");
port.on("open", function () { });
}
function test_list_ports() {
serialport.list( (err:string, ports:serialport.portConfig[]) => {
SerialPort.list( (err: string, ports: SerialPort.portConfig[]) => {
});
}
}
+44 -42
View File
@@ -1,51 +1,53 @@
// Type definitions for serialport
// Project: https://github.com/EmergingTechnologyAdvisors/node-serialport
// Type definitions for serialport 4.0.1
// Project: https://github.com/EmergingTechnologyAdvisors/node-serialport
// Definitions by: Jeremy Foster <https://github.com/codefoster>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'serialport' {
module parsers {
function readline(delimiter: string):void;
function raw(emitter:any, buffer:string):void
}
export class SerialPort {
constructor(path: string, options?: Object, openImmediately?: boolean, callback?: (err:string) => void)
class SerialPort {
constructor(path: string, options?: Object, openImmediately?: boolean, callback?: (err: string) => void)
isOpen: boolean;
on(event: string, callback?: (data?:any) => void):void;
open(callback?: () => void):void;
write(buffer: any, callback?: (err:string, bytesWritten:number) => void):void
pause():void;
resume():void;
disconnected(err: Error):void;
close(callback?: () => void):void;
flush(callback?: () => void):void;
set(options: setOptions, callback: () => void):void;
drain(callback?: () => void):void;
update(options: updateOptions, callback?: () => void):void;
on(event: string, callback?: (data?: any) => void): void;
open(callback?: () => void): void;
write(buffer: any, callback?: (err: string, bytesWritten: number) => void): void
pause(): void;
resume(): void;
disconnected(err: Error): void;
close(callback?: () => void): void;
flush(callback?: () => void): void;
set(options: SerialPort.setOptions, callback: () => void): void;
drain(callback?: () => void): void;
update(options: SerialPort.updateOptions, callback?: () => void): void;
static list(callback: (err: string, ports: SerialPort.portConfig[]) => void): void;
static parsers: {
readline: (delimiter: string) => void,
raw: (emitter: any, buffer: string) => void
};
}
export function list(callback: (err: string, ports:portConfig[]) => void): void;
namespace SerialPort {
interface portConfig {
comName: string;
manufacturer: string;
serialNumber: string;
pnpId: string;
locationId: string;
vendorId: string;
productId: string;
}
interface portConfig {
comName: string,
manufacturer: string,
serialNumber: string,
pnpId: string,
locationId: string,
vendorId: string,
productId: string
interface setOptions {
brk?: boolean;
cts?: boolean;
dsr?: boolean;
dtr?: boolean;
rts?: boolean;
}
interface updateOptions {
baudRate?: number;
}
}
interface setOptions {
brk?: boolean;
cts?: boolean;
dsr?: boolean;
dtr?: boolean;
rts?: boolean;
}
interface updateOptions {
baudRate?: number
}
}
export = SerialPort
}
+10 -8
View File
@@ -19,13 +19,11 @@ self.addEventListener('fetch', function(event: FetchEvent) {
});
self.caches.open('v1').then(function(cache: Cache) {
cache.matchAll('/images/').then(function(response: Array<Request>) {
cache.matchAll('/images/').then(function(response: Array<Response>) {
response.forEach(function(element, index, array) {
cache.delete(element);
cache.delete(element.url);
});
});
});
self.addEventListener('install', function(event: InstallEvent) {
@@ -56,7 +54,11 @@ self.addEventListener('install', function(event: InstallEvent) {
});
self.addEventListener('fetch', function(event: FetchEvent) {
var cachedResponse = self.caches.match(event.request).catch(function() {
var cachedResponse = self.caches.match(event.request).then(function(response: Response) {
if (response) {
return response;
}
}).catch(function() {
return self.fetch(event.request).then(function(response: Response) {
return self.caches.open('v1').then(function(cache) {
cache.put(event.request, response.clone());
@@ -71,8 +73,8 @@ self.addEventListener('fetch', function(event: FetchEvent) {
});
self.caches.open('v1').then(function(cache) {
cache.match('/images/image.png').then(function(response) {
cache.delete(response);
cache.match('/images/image.png').then(function(response: Response) {
cache.delete(response.url);
});
});
@@ -185,4 +187,4 @@ self.addEventListener('notificationclick', function(event: NotificationEvent) {
if (self.clients.openWindow)
return self.clients.openWindow('/');
}));
});
});
+6 -5
View File
@@ -3,7 +3,8 @@
// Definitions by: Tristan Caron <https://github.com/tristancaron>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../es6-promise/es6-promise.d.ts" />
// <reference path="../es6-promise/es6-promise.d.ts" /> // REMOVED third "/" so this doesn't fire. Problem with duplicate Promises
// between es6 and typescript - https://github.com/DefinitelyTyped/DefinitelyTyped/issues/5015
/**
* Provides methods relating to the body of the response/request, allowing you
@@ -279,16 +280,16 @@ interface Cache {
* @param request The Request you are attempting to find in the Cache.
* @param {CacheOptions} options
*/
match(request: Request | string, options?: CacheOptions): Promise<Request>;
match(request: Request | string, options?: CacheOptions): Promise<Response>;
/**
* Returns a Promise that resolves to an array of all matching requests in
* Returns a Promise that resolves to an array of all matching responses in
* the Cache object.
*
* @param request The Request you are attempting to find in the Cache.
* @param {CacheOptions} options
*/
matchAll(request: Request | string, options?: CacheOptions): Promise<Array<Request>>;
matchAll(request: Request | string, options?: CacheOptions): Promise<Array<Response>>;
/**
* Returns a Promise that resolves to a new Cache entry whose key
@@ -893,4 +894,4 @@ interface Window extends ServiceWorkerGlobalScope {
interface NotificationEvent extends Event, ExtendableEvent {
notification: any;
}
}
+1
View File
@@ -99,4 +99,5 @@ declare class StatsdClient {
getChildClient(name: string): StatsdClient;
}
declare namespace StatsdClient {}
export = StatsdClient;
@@ -0,0 +1,3 @@
/// <reference path="statsd-client.d.ts" />
import * as StatsdClient from 'statsd-client';
const statsd = new StatsdClient({ debug: true });
+4 -3
View File
@@ -49,9 +49,9 @@ declare namespace request {
search(url: string, callback?: CallbackHandler): Req;
connect(url: string, callback?: CallbackHandler): Req;
parse(fn: Function): Req;
saveCookies(res: Response): void;
attachCookies(req: Req): void;
parse(fn: (res: Response, callback: (err: Error, body: any) => void) => void): this;
saveCookies(res: Response): void;
attachCookies(req: Req): void;
}
interface Response extends NodeJS.ReadableStream {
@@ -106,6 +106,7 @@ declare namespace request {
withCredentials(): this;
write(data: string, encoding?: string): this;
write(data: Buffer, encoding?: string): this;
parse(fn: (res: Response, callback: (err: Error, body: any) => void) => void): this;
}
}
+18
View File
@@ -193,6 +193,24 @@ request('/search')
var charset: string = res.charset;
});
// Custom parsers
request
.post('/search')
.parse((res, callback) => {
res.setEncoding("binary");
let data = "";
res.on("data", (chunk: string) => {
data += chunk;
});
res.on("end", () => {
callback(null, new Buffer(data, "base64"));
});
})
.end((res: request.Response) => {
res.body.toString("hex");
});
var req = request.get('/hoge');
// Aborting requests
req.abort();
+11 -1
View File
@@ -68,6 +68,8 @@ declare namespace yargs {
command(command: string, description: string, builder: { [optionName: string]: Options }, handler: (args: Argv) => void): Argv;
command(command: string, description: string, builder: (args: Argv) => Options, handler: (args: Argv) => void): Argv;
commandDir(dir: string, opts?: RequireDirectoryOptions): Argv;
completion(cmd: string, fn?: SyncCompletionFunction): Argv;
completion(cmd: string, description?: string, fn?: SyncCompletionFunction): Argv;
completion(cmd: string, fn?: AsyncCompletionFunction): Argv;
@@ -93,7 +95,7 @@ declare namespace yargs {
strict(): Argv;
help(): string;
help(): Argv;
help(option: string, description?: string): Argv;
env(prefix?: string): Argv;
@@ -134,6 +136,14 @@ declare namespace yargs {
fail(func: (msg: string) => any): void;
}
interface RequireDirectoryOptions {
recurse?: boolean;
extensions?: string[];
visit?: (commandObject: any, pathToFile?: string, filename?: string) => any;
include?: RegExp | ((pathToFile: string)=>boolean);
exclude?: RegExp | ((pathToFile: string)=>boolean);
}
interface Options {
type?: string;
group?: string;
+25 -3
View File
@@ -234,9 +234,10 @@ function completion_async() {
}
function Argv$help() {
var yargs1 = yargs
.usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
var s: string = yargs1.help();
var argv = yargs
.usage("$0 -operand1 number -operand2 number -operation [add|subtract]")
.help()
.argv;
}
function Argv$showHelpOnFail() {
@@ -319,3 +320,24 @@ function Argv$reset() {
ya.showHelp();
}
}
// http://yargs.js.org/docs/#methods-commanddirdirectory-opts
function Argv$commandDir() {
var ya = yargs
.commandDir('.')
.argv
}
// http://yargs.js.org/docs/#methods-commanddirdirectory-opts
function Argv$commandDirWithOptions() {
var ya = yargs
.commandDir('.', {
recurse: false,
extensions: ['js'],
visit: (commandObject: any, pathToFile: string, filename: string) => { },
include: /.*\.js$/,
exclude: /.*\.spec.js$/,
})
.argv
}