mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge branch 'master' into mithril-1.1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as Ably from 'ably';
|
||||
|
||||
declare var console: { log(message: any): void };
|
||||
declare const console: { log(message: any): void };
|
||||
|
||||
const ApiKey = 'appId.keyId:secret';
|
||||
const client = new Ably.Realtime(ApiKey);
|
||||
@@ -19,10 +19,9 @@ client.connection.on('failed', () => {
|
||||
// failed connection
|
||||
});
|
||||
|
||||
|
||||
// Subscribing to a channel
|
||||
|
||||
var channel = client.channels.get('test');
|
||||
const channel = client.channels.get('test');
|
||||
channel.subscribe(message => {
|
||||
message.name; // 'greeting'
|
||||
message.data; // 'Hello World!'
|
||||
@@ -68,7 +67,6 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
|
||||
console.log(messagesPage.items.length);
|
||||
});
|
||||
|
||||
|
||||
// Presence on a channel
|
||||
// Getting presence:
|
||||
|
||||
@@ -118,7 +116,7 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
|
||||
// Generate a random 256-bit key for demonstration purposes (in
|
||||
// practice you need to create one and distribute it to clients yourselves)
|
||||
Ably.Realtime.Crypto.generateRandomKey((err, key) => {
|
||||
var channel = client.channels.get('channelName', { cipher: { key } });
|
||||
const channel = client.channels.get('channelName', { cipher: { key } });
|
||||
|
||||
channel.subscribe(message => {
|
||||
message.name; // 'name is not encrypted'
|
||||
@@ -136,7 +134,7 @@ channel.setOptions({cipher: {key: '<KEY>'}}, () => {
|
||||
|
||||
// Using the REST API
|
||||
|
||||
var restChannel = restClient.channels.get('test');
|
||||
const restChannel = restClient.channels.get('test');
|
||||
|
||||
// Publishing to a channel
|
||||
|
||||
@@ -195,7 +193,6 @@ restChannel.presence.history((err, messagesPage) => { // PaginatedResult
|
||||
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
|
||||
restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
|
||||
|
||||
|
||||
// Generate Token and Token Request
|
||||
// See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism.
|
||||
|
||||
@@ -206,7 +203,7 @@ client.auth.requestToken((err, tokenDetails) => {
|
||||
// see https://www.ably.io/documentation/rest/authentication/#token-details for its properties
|
||||
|
||||
// Now we have the token, we can send it to someone who can instantiate a client with it:
|
||||
var clientUsingToken = new Ably.Realtime(tokenDetails.token);
|
||||
const clientUsingToken = new Ably.Realtime(tokenDetails.token);
|
||||
});
|
||||
|
||||
// requestToken can take two optional params
|
||||
@@ -242,15 +239,15 @@ client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as Paginat
|
||||
client.time({}, (err, time) => {}); // time is in ms since epoch
|
||||
|
||||
// Getting decoded Message objects from JSON
|
||||
var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
|
||||
const messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
|
||||
console.log(messages[0].id);
|
||||
|
||||
var message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
|
||||
const message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
|
||||
console.log(message.id);
|
||||
|
||||
// Getting decoded PresenceMessage objects from JSON
|
||||
var presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
|
||||
const presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
|
||||
console.log(presenceMessages[0].action);
|
||||
|
||||
var presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
|
||||
const presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
|
||||
console.log(presenceMessage.action);
|
||||
|
||||
Vendored
+8
-8
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Ably <https://github.com/ably/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace ablyLib {
|
||||
export namespace ablyLib {
|
||||
namespace ChannelState {
|
||||
type INITIALIZED = 'initialized';
|
||||
type ATTACHING = 'attaching';
|
||||
@@ -130,15 +130,15 @@ declare namespace ablyLib {
|
||||
* A function which is called when a new token is required.
|
||||
* The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically
|
||||
* by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object.
|
||||
**/
|
||||
authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void;
|
||||
*/
|
||||
authCallback?(data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void): void;
|
||||
authHeaders?: { [index: string]: string };
|
||||
authMethod?: HTTPMethods;
|
||||
authParams?: { [index: string]: string };
|
||||
|
||||
/**
|
||||
* A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format).
|
||||
**/
|
||||
*/
|
||||
authUrl?: string;
|
||||
key?: string;
|
||||
queryTime?: boolean;
|
||||
@@ -259,13 +259,13 @@ declare namespace ablyLib {
|
||||
/**
|
||||
* A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only),
|
||||
* 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output).
|
||||
**/
|
||||
*/
|
||||
level?: number;
|
||||
|
||||
/**
|
||||
* A function to handle each line of log output. If handler is not specified, console.log is used.
|
||||
**/
|
||||
handler?: (...args: any[]) => void;
|
||||
*/
|
||||
handler?(...args: any[]): void;
|
||||
}
|
||||
|
||||
interface ChannelEvent {
|
||||
@@ -398,7 +398,7 @@ declare namespace ablyLib {
|
||||
}
|
||||
|
||||
interface Crypto {
|
||||
generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void;
|
||||
generateRandomKey(callback: (error: ErrorInfo, key: string) => void): void;
|
||||
}
|
||||
|
||||
class Connection extends EventEmitter<connectionEventCallback> {
|
||||
|
||||
@@ -27,8 +27,6 @@ accounting.formatMoney(5318008, {
|
||||
// Will recursively format an array of values:
|
||||
accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]]
|
||||
|
||||
|
||||
|
||||
// formatColumn
|
||||
|
||||
// Format list of numbers for display:
|
||||
@@ -40,8 +38,6 @@ accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"]
|
||||
// List of numbers can be a multi-dimensional array (formatColumn is applied recursively):
|
||||
accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]]
|
||||
|
||||
|
||||
|
||||
// formatNumber
|
||||
|
||||
// Example usage:
|
||||
@@ -58,16 +54,11 @@ accounting.formatNumber(5318008, {
|
||||
// Will recursively format an array of values:
|
||||
accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]]
|
||||
|
||||
|
||||
|
||||
// toFixed
|
||||
|
||||
(0.615).toFixed(2); // "0.61"
|
||||
accounting.toFixed(0.615, 2); // "0.62"
|
||||
|
||||
|
||||
|
||||
|
||||
// unformat
|
||||
|
||||
// Example usage:
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ADAL.JS 1.0.13
|
||||
// Type definitions for ADAL.JS 1.0.14
|
||||
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
|
||||
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -29,6 +29,7 @@ declare namespace adal {
|
||||
loginResource?: string;
|
||||
resource?: string;
|
||||
extraQueryParameter?: string;
|
||||
navigateToLoginRequestUrl?: boolean;
|
||||
}
|
||||
|
||||
interface User {
|
||||
|
||||
@@ -155,15 +155,11 @@ amplify.request("twitter-search", { term: "amplifyjs" } );
|
||||
|
||||
// Similarly, we can create a request that searches for mentions, by accepting a username:
|
||||
|
||||
amplify.request.define("twitter-mentions", "ajax", {
|
||||
url: "http://search.twitter.com/search.json",
|
||||
dataType: "jsonp",
|
||||
dataMap: data => {
|
||||
return {
|
||||
q: "@" + data.user
|
||||
};
|
||||
}
|
||||
});
|
||||
amplify.request.define("twitter-mentions", "ajax", {
|
||||
url: "http://search.twitter.com/search.json",
|
||||
dataType: "jsonp",
|
||||
dataMap: data => ({ q: "@" + data.user }),
|
||||
});
|
||||
|
||||
amplify.request("twitter-mentions", { user: "amplifyjs" });
|
||||
|
||||
@@ -241,11 +237,11 @@ amplify.request({
|
||||
|
||||
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
|
||||
|
||||
amplify.request.define("statusExample1", "ajax", {
|
||||
// ...
|
||||
});
|
||||
amplify.request.define("statusExample1", "ajax", {
|
||||
// ...
|
||||
});
|
||||
|
||||
amplify.request({
|
||||
amplify.request({
|
||||
resourceId: "statusExample1",
|
||||
success: (data, status) => {
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// promise api tests
|
||||
import amqp = require('amqplib');
|
||||
|
||||
var msg = 'Hello World';
|
||||
const msg = 'Hello World';
|
||||
|
||||
// test promise api
|
||||
amqp.connect('amqp://localhost')
|
||||
@@ -21,11 +21,10 @@ amqp.connect('amqp://localhost')
|
||||
});
|
||||
|
||||
// test promise api properties
|
||||
var amqpMessage: amqp.Message;
|
||||
let amqpMessage: amqp.Message;
|
||||
amqpMessage.properties.contentType = 'application/json';
|
||||
var amqpAssertExchangeOptions: amqp.Options.AssertExchange;
|
||||
var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
|
||||
|
||||
let amqpAssertExchangeOptions: amqp.Options.AssertExchange;
|
||||
let anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
|
||||
|
||||
// callback api tests
|
||||
import amqpcb = require('amqplib/callback_api');
|
||||
@@ -59,7 +58,7 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
|
||||
});
|
||||
|
||||
// test callback api properties
|
||||
var amqpcbMessage: amqpcb.Message;
|
||||
let amqpcbMessage: amqpcb.Message;
|
||||
amqpcbMessage.properties.contentType = 'application/json';
|
||||
var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
|
||||
var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
|
||||
let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
|
||||
let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
|
||||
|
||||
@@ -820,8 +820,8 @@ angular.module('docsTimeDirective', [])
|
||||
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
|
||||
return {
|
||||
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
|
||||
let format: any,
|
||||
timeoutId: any;
|
||||
let format: any;
|
||||
let timeoutId: any;
|
||||
|
||||
function updateTime() {
|
||||
element.text(dateFilter(new Date(), format));
|
||||
@@ -896,7 +896,10 @@ angular.module('docsIsoFnBindExample', [])
|
||||
angular.module('dragModule', [])
|
||||
.directive('myDraggable', ['$document', ($document: any) => {
|
||||
return (scope: any, element: any, attr: any) => {
|
||||
let startX = 0, startY = 0, x = 0, y = 0;
|
||||
let startX = 0;
|
||||
let startY = 0;
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
|
||||
element.css({
|
||||
position: 'relative',
|
||||
|
||||
Vendored
+4
-3
@@ -413,7 +413,7 @@ declare namespace angular {
|
||||
// https://docs.angularjs.org/api/ng/directive/ngModelOptions
|
||||
interface INgModelOptions {
|
||||
updateOn?: string;
|
||||
debounce?: any;
|
||||
debounce?: number | { [key: string]: number; };
|
||||
allowInvalid?: boolean;
|
||||
getterSetter?: boolean;
|
||||
timezone?: string;
|
||||
@@ -602,7 +602,7 @@ declare namespace angular {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ITimeoutService {
|
||||
(delay?: number, invokeApply?: boolean): IPromise<void>;
|
||||
<T>(fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
|
||||
<T>(fn: (...args: any[]) => T | IPromise<T>, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
|
||||
cancel(promise?: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
@@ -875,7 +875,8 @@ declare namespace angular {
|
||||
* @param identifierStart The function that will decide whether the given character is a valid identifier start character.
|
||||
* @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
|
||||
**/
|
||||
setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
|
||||
setIdentifierFns(
|
||||
identifierStart?: (character: string, codePoint: number) => boolean,
|
||||
identifierContinue?: (character: string, codePoint: number) => boolean): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,13 @@
|
||||
"quotemark": [true, "single"],
|
||||
"variable-name": [true, "check-format"],
|
||||
|
||||
// Below are all TODOs
|
||||
"callable-types": false,
|
||||
"ban-types": false,
|
||||
"interface-name": false,
|
||||
"no-empty-interface": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"no-empty-interface": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ describe("ApplePaySession", () => {
|
||||
}
|
||||
});
|
||||
it("can create a new instance", () => {
|
||||
|
||||
const version = 1;
|
||||
const paymentRequest = {
|
||||
countryCode: "US",
|
||||
@@ -42,7 +41,6 @@ describe("ApplePaySession", () => {
|
||||
const session = new ApplePaySession(version, paymentRequest);
|
||||
});
|
||||
it("can call static methods", () => {
|
||||
|
||||
const merchantIdentifier = "MyMerchantId";
|
||||
|
||||
let canMakePayments: boolean = ApplePaySession.canMakePayments();
|
||||
@@ -59,7 +57,6 @@ describe("ApplePaySession", () => {
|
||||
});
|
||||
});
|
||||
it("can call instance methods", () => {
|
||||
|
||||
const version = 1;
|
||||
const paymentRequest = {
|
||||
countryCode: "US",
|
||||
@@ -171,7 +168,6 @@ describe("ApplePaySession", () => {
|
||||
});
|
||||
describe("ApplePayPaymentRequest", () => {
|
||||
it("can create a new instance", () => {
|
||||
|
||||
let paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
|
||||
applicationData: "ApplicationData",
|
||||
countryCode: "GB",
|
||||
|
||||
Vendored
-16
@@ -7,7 +7,6 @@
|
||||
* A session object for managing the payment process on the web.
|
||||
*/
|
||||
declare class ApplePaySession extends EventTarget {
|
||||
|
||||
/**
|
||||
* Creates a new instance of the ApplePaySession class.
|
||||
* @param version - The version of the ApplePay JS API you are using.
|
||||
@@ -164,12 +163,10 @@ declare class ApplePaySession extends EventTarget {
|
||||
}
|
||||
|
||||
declare namespace ApplePayJS {
|
||||
|
||||
/**
|
||||
* Defines a line item in a payment request - for example, total, tax, discount, or grand total.
|
||||
*/
|
||||
interface ApplePayLineItem {
|
||||
|
||||
/**
|
||||
* A short, localized description of the line item.
|
||||
*/
|
||||
@@ -190,7 +187,6 @@ declare namespace ApplePayJS {
|
||||
* Represents the result of authorizing a payment request and contains encrypted payment information.
|
||||
*/
|
||||
interface ApplePayPayment {
|
||||
|
||||
/**
|
||||
* The encrypted token for an authorized payment.
|
||||
*/
|
||||
@@ -211,7 +207,6 @@ declare namespace ApplePayJS {
|
||||
* The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
|
||||
*/
|
||||
abstract class ApplePayPaymentAuthorizedEvent extends Event {
|
||||
|
||||
/**
|
||||
* The payment token used to authorize a payment.
|
||||
*/
|
||||
@@ -222,7 +217,6 @@ declare namespace ApplePayJS {
|
||||
* Encapsulates contact information needed for billing and shipping.
|
||||
*/
|
||||
interface ApplePayPaymentContact {
|
||||
|
||||
/**
|
||||
* An email address for the contact.
|
||||
*/
|
||||
@@ -278,7 +272,6 @@ declare namespace ApplePayJS {
|
||||
* Contains information about an Apple Pay payment card.
|
||||
*/
|
||||
interface ApplePayPaymentMethod {
|
||||
|
||||
/**
|
||||
* A string, suitable for display, that describes the card.
|
||||
*/
|
||||
@@ -305,7 +298,6 @@ declare namespace ApplePayJS {
|
||||
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
|
||||
*/
|
||||
abstract class ApplePayPaymentMethodSelectedEvent extends Event {
|
||||
|
||||
/**
|
||||
* The card used to complete a payment.
|
||||
*/
|
||||
@@ -316,7 +308,6 @@ declare namespace ApplePayJS {
|
||||
* Represents a provisioned payment card for Apple Pay payments.
|
||||
*/
|
||||
interface ApplePayPaymentPass {
|
||||
|
||||
/**
|
||||
* The unique identifier for the primary account number for the payment card.
|
||||
*/
|
||||
@@ -347,7 +338,6 @@ declare namespace ApplePayJS {
|
||||
* Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information.
|
||||
*/
|
||||
interface ApplePayPaymentRequest {
|
||||
|
||||
/**
|
||||
* The merchant's two-letter ISO 3166 country code.
|
||||
*/
|
||||
@@ -419,7 +409,6 @@ declare namespace ApplePayJS {
|
||||
* Contains the user's payment credentials.
|
||||
*/
|
||||
interface ApplePayPaymentToken {
|
||||
|
||||
/**
|
||||
* An object containing the encrypted payment data.
|
||||
*/
|
||||
@@ -440,7 +429,6 @@ declare namespace ApplePayJS {
|
||||
* The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
|
||||
*/
|
||||
abstract class ApplePayShippingContactSelectedEvent extends Event {
|
||||
|
||||
/**
|
||||
* The shipping address selected by the user.
|
||||
*/
|
||||
@@ -451,7 +439,6 @@ declare namespace ApplePayJS {
|
||||
* Defines a shipping method for delivering physical goods.
|
||||
*/
|
||||
interface ApplePayShippingMethod {
|
||||
|
||||
/**
|
||||
* A short description of the shipping method.
|
||||
*/
|
||||
@@ -477,7 +464,6 @@ declare namespace ApplePayJS {
|
||||
* The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
|
||||
*/
|
||||
abstract class ApplePayShippingMethodSelectedEvent extends Event {
|
||||
|
||||
/**
|
||||
* The shipping method selected by the user.
|
||||
*/
|
||||
@@ -488,7 +474,6 @@ declare namespace ApplePayJS {
|
||||
* The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
|
||||
*/
|
||||
abstract class ApplePayValidateMerchantEvent extends Event {
|
||||
|
||||
/**
|
||||
* The URL used to validate the merchant server.
|
||||
*/
|
||||
@@ -496,7 +481,6 @@ declare namespace ApplePayJS {
|
||||
}
|
||||
|
||||
abstract class Event {
|
||||
|
||||
readonly bubbles: boolean;
|
||||
|
||||
cancelBubble: boolean;
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
{ "extends": "../tslint.json" }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
|
||||
|
||||
var config: Microsoft.ApplicationInsights.IConfig = {
|
||||
const config: Microsoft.ApplicationInsights.IConfig = {
|
||||
instrumentationKey: "<your iKey>",
|
||||
endpointUrl: "endpointUrl",
|
||||
emitLineDelimitedJson: false,
|
||||
@@ -30,7 +30,7 @@ var config: Microsoft.ApplicationInsights.IConfig = {
|
||||
isStorageUseDisabled: true
|
||||
};
|
||||
|
||||
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
|
||||
appInsights = {
|
||||
config,
|
||||
context: null,
|
||||
queue: null,
|
||||
@@ -91,9 +91,8 @@ appInsights.setAuthenticatedUserContext("userId", "accountId");
|
||||
// set config dynamically
|
||||
appInsights.config.instrumentationKey = "<new key>";
|
||||
|
||||
|
||||
// TelementryContext
|
||||
var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
|
||||
const context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
|
||||
|
||||
context.application.ver = "v0.0.0";
|
||||
context.application.build = "1.1.1";
|
||||
@@ -113,54 +112,54 @@ context.operation.id = "1";
|
||||
context.operation.syntheticSource = "testAgent";
|
||||
|
||||
// track
|
||||
var data = new Microsoft.Telemetry.Base();
|
||||
var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
|
||||
const data = new Microsoft.Telemetry.Base();
|
||||
const envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
|
||||
|
||||
context.track(envelope);
|
||||
|
||||
context.addTelemetryInitializer((envelope) => false);
|
||||
context.addTelemetryInitializer(telemetryEnvelope => false);
|
||||
|
||||
// track event
|
||||
var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
|
||||
var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
|
||||
var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
|
||||
const eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
|
||||
const eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
|
||||
const eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
|
||||
context.track(eventEnvelope);
|
||||
|
||||
// track exception
|
||||
var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
|
||||
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
|
||||
const exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
|
||||
const exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
|
||||
Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
|
||||
var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
|
||||
const exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
|
||||
context.track(exceptionEnvelope);
|
||||
|
||||
// track metric
|
||||
var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
|
||||
var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
|
||||
var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
|
||||
const metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
|
||||
const metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
|
||||
const metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
|
||||
context.track(metricEnvelope);
|
||||
|
||||
// track page view
|
||||
var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
|
||||
var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
|
||||
var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
|
||||
const pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
|
||||
const pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
|
||||
const pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
|
||||
context.track(pageViewEnvelope);
|
||||
|
||||
// track page view performance
|
||||
var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
|
||||
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
|
||||
const pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
|
||||
const pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
|
||||
Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
|
||||
var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
|
||||
const pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
|
||||
context.track(pageViewPerfEnvelope);
|
||||
|
||||
// track remote dependency
|
||||
var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
|
||||
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
|
||||
const remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
|
||||
const remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
|
||||
Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
|
||||
var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
|
||||
const remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
|
||||
context.track(pageViewPerfEnvelope);
|
||||
|
||||
// track trace
|
||||
var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
|
||||
var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
|
||||
var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
|
||||
context.track(traceEnvelope);
|
||||
const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
|
||||
const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
|
||||
const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
|
||||
context.track(traceEnvelope);
|
||||
|
||||
+85
-84
@@ -195,8 +195,8 @@ declare module Microsoft.ApplicationInsights.Context {
|
||||
|
||||
interface IInternal {
|
||||
/**
|
||||
* The SDK version used to create this telemetry item.
|
||||
*/
|
||||
* The SDK version used to create this telemetry item.
|
||||
*/
|
||||
sdkVersion: string;
|
||||
/**
|
||||
* The SDK agent version.
|
||||
@@ -206,15 +206,15 @@ declare module Microsoft.ApplicationInsights.Context {
|
||||
|
||||
interface ISample {
|
||||
/**
|
||||
* Sample rate
|
||||
*/
|
||||
* Sample rate
|
||||
*/
|
||||
sampleRate: number;
|
||||
}
|
||||
|
||||
interface ISession {
|
||||
/**
|
||||
* The session ID.
|
||||
*/
|
||||
* The session ID.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The true if this is the first session
|
||||
@@ -258,8 +258,8 @@ declare module Microsoft.ApplicationInsights.Context {
|
||||
|
||||
interface IUser {
|
||||
/**
|
||||
* The telemetry configuration.
|
||||
*/
|
||||
* The telemetry configuration.
|
||||
*/
|
||||
config: any;
|
||||
/**
|
||||
* The user ID.
|
||||
@@ -345,12 +345,12 @@ declare module Microsoft.ApplicationInsights.Telemetry {
|
||||
measurements: Microsoft.ApplicationInsights.FieldType;
|
||||
};
|
||||
/**
|
||||
* Constructs a new isntance of the ExceptionTelemetry object
|
||||
*/
|
||||
* Constructs a new isntance of the ExceptionTelemetry object
|
||||
*/
|
||||
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
|
||||
/**
|
||||
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
|
||||
*/
|
||||
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
|
||||
*/
|
||||
static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception;
|
||||
}
|
||||
|
||||
@@ -414,8 +414,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
|
||||
getIsValid(): boolean;
|
||||
private durationMs;
|
||||
/**
|
||||
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
|
||||
*/
|
||||
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
|
||||
*/
|
||||
getDurationMs(): number;
|
||||
/**
|
||||
* Constructs a new instance of the PageEventTelemetry object
|
||||
@@ -423,8 +423,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
|
||||
constructor(name: string, url: string, unused: number, properties?: any, measurements?: any);
|
||||
static getPerformanceTiming(): PerformanceTiming;
|
||||
/**
|
||||
* Returns true is window performance timing API is supported, false otherwise.
|
||||
*/
|
||||
* Returns true is window performance timing API is supported, false otherwise.
|
||||
*/
|
||||
static isPerformanceTimingSupported(): PerformanceTiming;
|
||||
/**
|
||||
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
|
||||
@@ -615,16 +615,16 @@ declare module Microsoft.ApplicationInsights {
|
||||
|
||||
interface ITelemetryContext {
|
||||
/**
|
||||
* The object describing a component tracked by this object.
|
||||
*/
|
||||
* The object describing a component tracked by this object.
|
||||
*/
|
||||
application: Context.IApplication;
|
||||
/**
|
||||
* The object describing a device tracked by this object.
|
||||
*/
|
||||
device: Context.IDevice;
|
||||
/**
|
||||
* The object describing internal settings.
|
||||
*/
|
||||
* The object describing internal settings.
|
||||
*/
|
||||
internal: Context.IInternal;
|
||||
/**
|
||||
* The object describing a location tracked by this object.
|
||||
@@ -635,8 +635,8 @@ declare module Microsoft.ApplicationInsights {
|
||||
*/
|
||||
operation: Context.IOperation;
|
||||
/**
|
||||
* The object describing sampling settings.
|
||||
*/
|
||||
* The object describing sampling settings.
|
||||
*/
|
||||
sample: Context.ISample;
|
||||
/**
|
||||
* The object describing a user tracked by this object.
|
||||
@@ -647,13 +647,13 @@ declare module Microsoft.ApplicationInsights {
|
||||
*/
|
||||
session: Context.ISession;
|
||||
/**
|
||||
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
|
||||
* before telemetry item is pushed for sending and in the order they were added.
|
||||
*/
|
||||
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
|
||||
* before telemetry item is pushed for sending and in the order they were added.
|
||||
*/
|
||||
addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
|
||||
/**
|
||||
* Tracks telemetry object.
|
||||
*/
|
||||
* Tracks telemetry object.
|
||||
*/
|
||||
track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
|
||||
}
|
||||
|
||||
@@ -662,23 +662,23 @@ declare module Microsoft.ApplicationInsights {
|
||||
context: ITelemetryContext;
|
||||
queue: Array<() => void>;
|
||||
/**
|
||||
* Starts timing how long the user views a page or other item. Call this when the page opens.
|
||||
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
|
||||
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
|
||||
*/
|
||||
* Starts timing how long the user views a page or other item. Call this when the page opens.
|
||||
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
|
||||
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
|
||||
*/
|
||||
startTrackPage(name?: string): any;
|
||||
/**
|
||||
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
stopTrackPage(name?: string, url?: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}): any;
|
||||
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
stopTrackPage(
|
||||
name?: string,
|
||||
url?: string,
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Logs that a page or other item was viewed.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
@@ -687,11 +687,11 @@ declare module Microsoft.ApplicationInsights {
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
* @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
|
||||
*/
|
||||
trackPageView(name?: string, url?: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}, duration?: number): any;
|
||||
trackPageView(
|
||||
name?: string,
|
||||
url?: string,
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number }, duration?: number): any;
|
||||
/**
|
||||
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
|
||||
* @param name A string that identifies this event uniquely within the document.
|
||||
@@ -703,22 +703,20 @@ declare module Microsoft.ApplicationInsights {
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
stopTrackEvent(name: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}): any;
|
||||
stopTrackEvent(
|
||||
name: string,
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Log a user action or other occurrence.
|
||||
* @param name A string to identify this event in the portal.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackEvent(name: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}): any;
|
||||
* Log a user action or other occurrence.
|
||||
* @param name A string to identify this event in the portal.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackEvent(
|
||||
name: string,
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Log a dependency call
|
||||
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
|
||||
@@ -737,11 +735,12 @@ declare module Microsoft.ApplicationInsights {
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
* @param severityLevel AI.SeverityLevel - severity level
|
||||
*/
|
||||
trackException(exception: Error, handledAt?: string, properties?: {
|
||||
[name: string]: string;
|
||||
}, measurements?: {
|
||||
[name: string]: number;
|
||||
}, severityLevel?: AI.SeverityLevel): any;
|
||||
trackException(
|
||||
exception: Error,
|
||||
handledAt?: string,
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number },
|
||||
severityLevel?: AI.SeverityLevel): any;
|
||||
/**
|
||||
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
|
||||
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
|
||||
@@ -752,28 +751,30 @@ declare module Microsoft.ApplicationInsights {
|
||||
* @param min The smallest measurement in the sample. Defaults to the average.
|
||||
* @param max The largest measurement in the sample. Defaults to the average.
|
||||
*/
|
||||
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
|
||||
[name: string]: string;
|
||||
}): any;
|
||||
trackMetric(
|
||||
name: string,
|
||||
average: number,
|
||||
sampleCount?: number,
|
||||
min?: number,
|
||||
max?: number,
|
||||
properties?: { [name: string]: string }): any;
|
||||
/**
|
||||
* Log a diagnostic message.
|
||||
* @param message A message string
|
||||
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
|
||||
*/
|
||||
trackTrace(message: string, properties?: {
|
||||
[name: string]: string;
|
||||
}): any;
|
||||
* Log a diagnostic message.
|
||||
* @param message A message string
|
||||
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
|
||||
*/
|
||||
trackTrace(message: string, properties?: { [name: string]: string }): any;
|
||||
/**
|
||||
* Immediately send all queued telemetry.
|
||||
*/
|
||||
flush(): any;
|
||||
/**
|
||||
* Sets the autheticated user id and the account id in this session.
|
||||
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
|
||||
*
|
||||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
|
||||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
|
||||
*/
|
||||
* Sets the autheticated user id and the account id in this session.
|
||||
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
|
||||
*
|
||||
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
|
||||
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
|
||||
*/
|
||||
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
|
||||
/**
|
||||
* Clears the authenticated user id and the account id from the user context.
|
||||
@@ -796,4 +797,4 @@ declare module 'applicationinsights-js' {
|
||||
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
}
|
||||
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
|
||||
@@ -8,4 +8,4 @@ point = {
|
||||
spatialReference: {
|
||||
wkid: 4326
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Vendored
+1
-4
@@ -65,7 +65,6 @@ export interface BezierCurve {
|
||||
|
||||
export type JsonCurve = CircularArc | Arc | OldCircularArc | BezierCurve;
|
||||
|
||||
|
||||
export interface SpatialReferenceWkid {
|
||||
wkid?: number;
|
||||
latestWkid?: number;
|
||||
@@ -131,7 +130,6 @@ export interface Envelope extends Geometry {
|
||||
|
||||
export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" | "esriGeometryPolyline" | "esriGeometryPolygon" | "esriGeometryEnvelope";
|
||||
|
||||
|
||||
export type Color = [number, number, number, number];
|
||||
export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle";
|
||||
export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid";
|
||||
@@ -181,7 +179,6 @@ export interface PictureSourced {
|
||||
"angle"?: number;
|
||||
"xoffset"?: number;
|
||||
"yoffset"?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced {
|
||||
@@ -217,4 +214,4 @@ export interface TextSymbol extends MarkerSymbol {
|
||||
"kerning"?: boolean;
|
||||
"font"?: Font;
|
||||
"text"?: string; // only applicable when specified as a client-side graphic.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ const geojsonPoint: GeoJSON.Point = {
|
||||
};
|
||||
|
||||
// parse ArcGIS JSON, convert it to GeoJSON
|
||||
var geojson = utils.arcgisToGeoJSON(arcgisPoint);
|
||||
const geojson = utils.arcgisToGeoJSON(arcgisPoint);
|
||||
|
||||
// take GeoJSON and convert it to ArcGIS JSON
|
||||
var arcgis = utils.geojsonToArcGIS(geojsonPoint);
|
||||
const arcgis = utils.geojsonToArcGIS(geojsonPoint);
|
||||
|
||||
+1
-1
@@ -15,4 +15,4 @@ export function arcgisToGeoJSON<T extends ArcGis.Geometry>(arcgis: T): GeoJSON.G
|
||||
/**
|
||||
* Converts a GeoJSON geometry into a ArcGIS geometry.
|
||||
*/
|
||||
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
|
||||
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
|
||||
|
||||
@@ -2,4 +2,4 @@ import arrayUniq = require("array-uniq");
|
||||
|
||||
arrayUniq([1, 1, 2, 3, 3]);
|
||||
|
||||
arrayUniq(["foo", "foo", "bar", "foo"]);
|
||||
arrayUniq(["foo", "foo", "bar", "foo"]);
|
||||
|
||||
Vendored
+1
-1
@@ -5,4 +5,4 @@
|
||||
|
||||
declare function arrayUniq<T>(arr: T[]): T[];
|
||||
|
||||
export = arrayUniq;
|
||||
export = arrayUniq;
|
||||
|
||||
@@ -29,4 +29,4 @@ artyom.getVoices();
|
||||
artyom.getLanguage();
|
||||
|
||||
// Get the artyom.js version
|
||||
artyom.getVersion();
|
||||
artyom.getVersion();
|
||||
|
||||
Vendored
+20
-20
@@ -22,16 +22,16 @@ interface SpeechRecognition extends EventTarget {
|
||||
start(): void;
|
||||
stop(): void;
|
||||
abort(): void;
|
||||
onaudiostart: (ev: Event) => any;
|
||||
onsoundstart: (ev: Event) => any;
|
||||
onspeechstart: (ev: Event) => any;
|
||||
onspeechend: (ev: Event) => any;
|
||||
onsoundend: (ev: Event) => any;
|
||||
onresult: (ev: SpeechRecognitionEvent) => any;
|
||||
onnomatch: (ev: SpeechRecognitionEvent) => any;
|
||||
onerror: (ev: SpeechRecognitionError) => any;
|
||||
onstart: (ev: Event) => any;
|
||||
onend: (ev: Event) => any;
|
||||
onaudiostart(ev: Event): any;
|
||||
onsoundstart(ev: Event): any;
|
||||
onspeechstart(ev: Event): any;
|
||||
onspeechend(ev: Event): any;
|
||||
onsoundend(ev: Event): any;
|
||||
onresult(ev: SpeechRecognitionEvent): any;
|
||||
onnomatch(ev: SpeechRecognitionEvent): any;
|
||||
onerror(ev: SpeechRecognitionError): any;
|
||||
onstart(ev: Event): any;
|
||||
onend(ev: Event): any;
|
||||
}
|
||||
|
||||
interface SpeechRecognitionStatic {
|
||||
@@ -106,7 +106,7 @@ interface SpeechSynthesis extends EventTarget {
|
||||
speaking: boolean;
|
||||
paused: boolean;
|
||||
|
||||
onvoiceschanged: (ev: Event) => any;
|
||||
onvoiceschanged(ev: Event): any;
|
||||
speak(utterance: SpeechSynthesisUtterance): void;
|
||||
cancel(): void;
|
||||
pause(): void;
|
||||
@@ -128,13 +128,13 @@ interface SpeechSynthesisUtterance extends EventTarget {
|
||||
rate: number;
|
||||
pitch: number;
|
||||
|
||||
onstart: (ev: SpeechSynthesisEvent) => any;
|
||||
onend: (ev: SpeechSynthesisEvent) => any;
|
||||
onerror: (ev: SpeechSynthesisErrorEvent) => any;
|
||||
onpause: (ev: SpeechSynthesisEvent) => any;
|
||||
onresume: (ev: SpeechSynthesisEvent) => any;
|
||||
onmark: (ev: SpeechSynthesisEvent) => any;
|
||||
onboundary: (ev: SpeechSynthesisEvent) => any;
|
||||
onstart(ev: SpeechSynthesisEvent): any;
|
||||
onend(ev: SpeechSynthesisEvent): any;
|
||||
onerror(ev: SpeechSynthesisErrorEvent): any;
|
||||
onpause(ev: SpeechSynthesisEvent): any;
|
||||
onresume(ev: SpeechSynthesisEvent): any;
|
||||
onmark(ev: SpeechSynthesisEvent): any;
|
||||
onboundary(ev: SpeechSynthesisEvent): any;
|
||||
}
|
||||
|
||||
interface SpeechSynthesisUtteranceStatic {
|
||||
@@ -211,7 +211,7 @@ declare namespace Artyom {
|
||||
/** Triggers of the command */
|
||||
indexes: string[];
|
||||
/** Logic to execute when the command is triggered */
|
||||
action: (i: number, wildcard?: string, full?: string) => void;
|
||||
action(i: number, wildcard?: string, full?: string): void;
|
||||
/** Description of the command */
|
||||
description?: string;
|
||||
/** Flag to specify is a command is either normal or smart */
|
||||
@@ -502,7 +502,7 @@ declare namespace Artyom {
|
||||
/**
|
||||
* Method to bla, bla, bla...
|
||||
*/
|
||||
static getInstance(): ArtyomJS
|
||||
static getInstance(): ArtyomJS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
-2
@@ -122,7 +122,6 @@ export function AssertionError(options: any, message ?: string): void;
|
||||
*/
|
||||
export function fail(actual: any, expected: any, message: any, operator: any): void;
|
||||
|
||||
|
||||
/**
|
||||
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
|
||||
*
|
||||
@@ -353,5 +352,4 @@ export function doesNotThrow(block: any, error ?: any, message ?: string): void;
|
||||
*/
|
||||
export function ifError(value: any): void;
|
||||
|
||||
|
||||
export as namespace AssertPlus;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Awesomplete from 'awesomplete';
|
||||
|
||||
var input = document.getElementById("myinput");
|
||||
const input = document.getElementById("myinput");
|
||||
new Awesomplete(input, {list: "#mylist"});
|
||||
|
||||
new Awesomplete(input, {list: document.querySelector("#mylist")});
|
||||
@@ -9,7 +9,7 @@ new Awesomplete(input, {
|
||||
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
|
||||
});
|
||||
|
||||
var awesomplete = new Awesomplete(input);
|
||||
const awesomplete = new Awesomplete(input);
|
||||
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
|
||||
|
||||
new Awesomplete(input, {
|
||||
@@ -46,15 +46,15 @@ new Awesomplete('input[data-multiple]', {
|
||||
},
|
||||
|
||||
replace: (text: string) => {
|
||||
var before = this.input.value.match(/^.+,\s*|/)[0];
|
||||
const before = this.input.value.match(/^.+,\s*|/)[0];
|
||||
this.input.value = before + text + ", ";
|
||||
}
|
||||
});
|
||||
|
||||
var ajax = new XMLHttpRequest();
|
||||
const ajax = new XMLHttpRequest();
|
||||
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
|
||||
ajax.onload = () => {
|
||||
var list = JSON.parse(ajax.responseText).map((i: any) => i.name);
|
||||
const list = JSON.parse(ajax.responseText).map((i: any) => i.name);
|
||||
new Awesomplete(document.querySelector("#ajax-example input"), { list });
|
||||
};
|
||||
ajax.send();
|
||||
|
||||
Vendored
+10
-10
@@ -6,14 +6,14 @@
|
||||
declare class Awesomplete {
|
||||
constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options);
|
||||
static all: any[];
|
||||
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
|
||||
static $$(expr: string | NodeSelector, con?: any): NodeList;
|
||||
static ITEM: (text: string, input: string) => HTMLElement;
|
||||
static $: {
|
||||
(expr: string|Element, con?: NodeSelector): string | Element;
|
||||
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
|
||||
create: (tag: string, o: any) => HTMLElement;
|
||||
fire: (target: EventTarget, type: string, properties: any) => any;
|
||||
siblingIndex: (el: Element) => number;
|
||||
regExpEscape(s: { replace(arg0: RegExp, arg1: string): void }): any;
|
||||
create(tag: string, o: any): HTMLElement;
|
||||
fire(target: EventTarget, type: string, properties: any): any;
|
||||
siblingIndex(el: Element): number;
|
||||
};
|
||||
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
|
||||
static FILTER_CONTAINS: (text: string, input: string) => boolean;
|
||||
@@ -45,11 +45,11 @@ declare namespace Awesomplete {
|
||||
minChars?: number;
|
||||
maxItems?: number;
|
||||
autoFirst?: boolean;
|
||||
data?: (item: Suggestion, input: string) => string;
|
||||
filter?: (text: string, input: string) => boolean;
|
||||
sort?: (left: number | any[], right: number | any[]) => number;
|
||||
item?: (text: string, input: string) => HTMLElement;
|
||||
replace?: (text: string) => void;
|
||||
data?(item: Suggestion, input: string): string;
|
||||
filter?(text: string, input: string): boolean;
|
||||
sort?(left: number | any[], right: number | any[]): number;
|
||||
item?(text: string, input: string): HTMLElement;
|
||||
replace?(text: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface BabelCodeFrameOptions {
|
||||
/** Syntax highlight the code as JavaScript for terminals. default: false*/
|
||||
/** Syntax highlight the code as JavaScript for terminals. default: false */
|
||||
highlightCode?: boolean;
|
||||
/** The number of lines to show above the error. default: 2 */
|
||||
linesBelow?: number;
|
||||
|
||||
Vendored
+1
-1
@@ -22,4 +22,4 @@ export function encode(input: string): string;
|
||||
* with atob() as described in the HTML Standard.
|
||||
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob
|
||||
*/
|
||||
export function decode(input: string): string;
|
||||
export function decode(input: string): string;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import BigInteger = require('bigi');
|
||||
|
||||
var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
|
||||
var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
|
||||
const b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
|
||||
const b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
|
||||
|
||||
var b3 = b1.multiply(b2);
|
||||
const b3 = b1.multiply(b2);
|
||||
|
||||
console.log(b3.toHex());
|
||||
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
|
||||
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
var x: BigNumber.BigNumber = new BigNumber(9);
|
||||
var y = new BigNumber(x);
|
||||
let x: BigNumber.BigNumber = new BigNumber(9);
|
||||
let y = new BigNumber(x);
|
||||
|
||||
BigNumber(435.345);
|
||||
|
||||
@@ -27,7 +27,7 @@ new BigNumber(1.23456789);
|
||||
new BigNumber(1.23456789, 10);
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 });
|
||||
var BN = BigNumber.another({ DECIMAL_PLACES: 9 });
|
||||
let BN = BigNumber.another({ DECIMAL_PLACES: 9 });
|
||||
|
||||
x = new BigNumber(1);
|
||||
y = new BN(1);
|
||||
@@ -112,14 +112,14 @@ BigNumber.config({
|
||||
|
||||
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80);
|
||||
|
||||
var obj = BigNumber.config();
|
||||
const obj = BigNumber.config();
|
||||
obj.ERRORS;
|
||||
obj.RANGE;
|
||||
|
||||
x = new BigNumber('3257869345.0378653');
|
||||
BigNumber.max(4e9, x, '123456789.9');
|
||||
|
||||
var arr = [12, '13', new BigNumber(14)];
|
||||
let arr = [12, '13', new BigNumber(14)];
|
||||
BigNumber.max(arr);
|
||||
|
||||
x = new BigNumber('3257869345.0378653');
|
||||
@@ -137,7 +137,7 @@ BigNumber.config({ ROUNDING_MODE: 2 });
|
||||
|
||||
x = new BigNumber(-0.8);
|
||||
y = x.absoluteValue();
|
||||
var z = y.abs();
|
||||
let z = y.abs();
|
||||
|
||||
x = new BigNumber(1.3);
|
||||
x.ceil();
|
||||
@@ -300,7 +300,7 @@ y.toFixed(2);
|
||||
y.toFixed(2, 1);
|
||||
y.toFixed(5);
|
||||
|
||||
var format = {
|
||||
const format = {
|
||||
decimalSeparator: '.',
|
||||
groupSeparator: ',',
|
||||
groupSize: 3,
|
||||
@@ -332,7 +332,7 @@ x.toFormat(6);
|
||||
x = new BigNumber(1.75);
|
||||
x.toFraction();
|
||||
|
||||
var pi = new BigNumber('3.14159265358');
|
||||
const pi = new BigNumber('3.14159265358');
|
||||
pi.toFraction();
|
||||
pi.toFraction(100000);
|
||||
pi.toFraction(10000);
|
||||
@@ -344,7 +344,7 @@ x = new BigNumber('177.7e+457');
|
||||
y = new BigNumber(235.4325);
|
||||
z = new BigNumber('0.0098074');
|
||||
|
||||
var str = JSON.stringify([x, y, z]);
|
||||
const str = JSON.stringify([x, y, z]);
|
||||
|
||||
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val));
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -673,4 +673,4 @@ declare namespace BigNumber {
|
||||
*/
|
||||
isBigNumber: true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
import bigi = require('bigi');
|
||||
import bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
declare var it: any;
|
||||
declare var describe: any;
|
||||
declare var assert: any;
|
||||
declare const it: any;
|
||||
declare const describe: any;
|
||||
declare const assert: any;
|
||||
|
||||
describe('bitcoinjs-lib (basic)', () => {
|
||||
it('can generate a random bitcoin address', () => {
|
||||
@@ -13,18 +13,18 @@ describe('bitcoinjs-lib (basic)', () => {
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
|
||||
// generate random keyPair
|
||||
var keyPair = bitcoin.ECPair.makeRandom({ rng });
|
||||
var address = keyPair.getAddress();
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ rng });
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
|
||||
});
|
||||
|
||||
it('can generate an address from a SHA256 hash', () => {
|
||||
var hash = bitcoin.crypto.sha256('correct horse battery staple');
|
||||
var d = bigi.fromBuffer(hash);
|
||||
const hash = bitcoin.crypto.sha256('correct horse battery staple');
|
||||
const d = bigi.fromBuffer(hash);
|
||||
|
||||
var keyPair = new bitcoin.ECPair(d);
|
||||
var address = keyPair.getAddress();
|
||||
const keyPair = new bitcoin.ECPair(d);
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
|
||||
});
|
||||
@@ -33,26 +33,26 @@ describe('bitcoinjs-lib (basic)', () => {
|
||||
// for testing only
|
||||
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
|
||||
|
||||
var litecoin = bitcoin.networks.litecoin;
|
||||
const litecoin = bitcoin.networks.litecoin;
|
||||
|
||||
var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
|
||||
var wif = keyPair.toWIF();
|
||||
var address = keyPair.getAddress();
|
||||
const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
|
||||
const wif = keyPair.toWIF();
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
|
||||
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
|
||||
});
|
||||
|
||||
it('can import an address via WIF', () => {
|
||||
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
|
||||
var address = keyPair.getAddress();
|
||||
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
|
||||
const address = keyPair.getAddress();
|
||||
|
||||
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
|
||||
});
|
||||
|
||||
it('can create a Transaction', () => {
|
||||
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
|
||||
var tx = new bitcoin.TransactionBuilder();
|
||||
const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
|
||||
const tx = new bitcoin.TransactionBuilder();
|
||||
|
||||
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
|
||||
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var someInput = { a: 1, b: 2, c: 3 };
|
||||
const someInput = { a: 1, b: 2, c: 3 };
|
||||
|
||||
import blacklist = require('blacklist');
|
||||
|
||||
@@ -10,4 +10,4 @@ blacklist(someInput, {
|
||||
b: false, // b will be in the result
|
||||
c: 1 > 2 // false, therefore c will be in the result
|
||||
});
|
||||
// => { b: 2, c: 3 }
|
||||
// => { b: 2, c: 3 }
|
||||
|
||||
Vendored
+169
-351
@@ -7,7 +7,7 @@
|
||||
* @module braintree-web/american-express
|
||||
* @description This module is for use with Amex Express Checkout. To accept American Express cards, use Hosted Fields.
|
||||
*/
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
export interface AmericanExpress {
|
||||
/**
|
||||
* @static
|
||||
@@ -24,22 +24,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options Options
|
||||
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.</strong>
|
||||
* @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
|
||||
*/
|
||||
export class AmericanExpress {
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options Options
|
||||
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.</strong>
|
||||
* @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
|
||||
*/
|
||||
constructor(options: any);
|
||||
|
||||
/**
|
||||
* Gets the rewards balance associated with a Braintree nonce.
|
||||
@@ -63,7 +47,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* });
|
||||
*/
|
||||
public getRewardsBalance(options: { nonce: string }, callback: callback): void;
|
||||
getRewardsBalance(options: { nonce: string }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Gets the Express Checkout nonce profile given a nonce from American Express.
|
||||
@@ -87,121 +71,123 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* });
|
||||
*/
|
||||
public getExpressCheckoutProfile(options: { nonce: string }, callback: callback): void;
|
||||
getExpressCheckoutProfile(options: { nonce: string }, callback: callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// more info https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest
|
||||
declare namespace braintree {
|
||||
// more info https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest
|
||||
|
||||
// billingContact
|
||||
// Billing contact information for the user.
|
||||
// countryCode
|
||||
//Required.The merchant’s two- letter ISO 3166 country code.
|
||||
// currencyCode
|
||||
// Required.The three- letter ISO 4217 currency code for the payment.
|
||||
// lineItems
|
||||
//A set of line items that explain recurring payments and additional charges.
|
||||
// merchantCapabilities
|
||||
// Required.The payment capabilities supported by the merchant.The value must be one or more of supports3DS, supportsEMV, supportsCredit, or supportsDebit.
|
||||
// requiredBillingContactFields
|
||||
// The billing information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
|
||||
// requiredShippingContactFields
|
||||
// The shipping information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
|
||||
// shippingContact
|
||||
// Shipping contact information for the user.
|
||||
// shippingMethods
|
||||
//A set of available shipping methods.Totals for all shipping methods must be non- negative to pass validation.
|
||||
// shippingType
|
||||
// How the items are to be shipped.This property is optional.If specified, it must be one or more of shipping, delivery, storePickup, or servicePickup.The default value is shipping.
|
||||
// supportedNetworks
|
||||
// Required.The payment networks supported by the merchant.The value must be one or more of amex, discover, interac, masterCard, privateLabel, or visa.
|
||||
// total
|
||||
// Required.The total amount for the payment.The total must be greater than zero and have a label to pass validation.
|
||||
interface ApplePayPaymentRequest {
|
||||
total: {
|
||||
label: string;
|
||||
amount: string;
|
||||
};
|
||||
countryCode: string;
|
||||
currencyCode: string;
|
||||
supportedNetworks: string[];
|
||||
merchantCapabilities: string[];
|
||||
// billingContact
|
||||
// Billing contact information for the user.
|
||||
// countryCode
|
||||
//Required.The merchant’s two- letter ISO 3166 country code.
|
||||
// currencyCode
|
||||
// Required.The three- letter ISO 4217 currency code for the payment.
|
||||
// lineItems
|
||||
//A set of line items that explain recurring payments and additional charges.
|
||||
// merchantCapabilities
|
||||
// Required.The payment capabilities supported by the merchant.The value must be one or more of supports3DS, supportsEMV, supportsCredit, or supportsDebit.
|
||||
// requiredBillingContactFields
|
||||
// The billing information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
|
||||
// requiredShippingContactFields
|
||||
// The shipping information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
|
||||
// shippingContact
|
||||
// Shipping contact information for the user.
|
||||
// shippingMethods
|
||||
//A set of available shipping methods.Totals for all shipping methods must be non- negative to pass validation.
|
||||
// shippingType
|
||||
// How the items are to be shipped.This property is optional.If specified, it must be one or more of shipping, delivery, storePickup, or servicePickup.The default value is shipping.
|
||||
// supportedNetworks
|
||||
// Required.The payment networks supported by the merchant.The value must be one or more of amex, discover, interac, masterCard, privateLabel, or visa.
|
||||
// total
|
||||
// Required.The total amount for the payment.The total must be greater than zero and have a label to pass validation.
|
||||
interface ApplePayPaymentRequest {
|
||||
total: {
|
||||
label: string;
|
||||
amount: string;
|
||||
};
|
||||
countryCode: string;
|
||||
currencyCode: string;
|
||||
supportedNetworks: string[];
|
||||
merchantCapabilities: string[];
|
||||
|
||||
billingContact?: any;
|
||||
shippingContact?: any;
|
||||
shippingMethods?: any;
|
||||
shippingType?: any;
|
||||
requiredBillingContactFields?: any;
|
||||
requiredShippingContactFields?: any;
|
||||
}
|
||||
billingContact?: any;
|
||||
shippingContact?: any;
|
||||
shippingMethods?: any;
|
||||
shippingType?: any;
|
||||
requiredBillingContactFields?: any;
|
||||
requiredShippingContactFields?: any;
|
||||
}
|
||||
|
||||
declare enum ApplePayStatusCodes {
|
||||
// The requested action succeeded.
|
||||
STATUS_SUCCESS = 1,
|
||||
// The requested action failed.
|
||||
STATUS_FAILURE,
|
||||
// The billing address is not valid.
|
||||
STATUS_INVALID_BILLING_POSTAL_ADDRESS,
|
||||
// The shipping address is not valid.
|
||||
STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
|
||||
// The shipping contact information is not valid.
|
||||
STATUS_INVALID_SHIPPING_CONTACT,
|
||||
// The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
|
||||
STATUS_PIN_REQUIRED,
|
||||
// The PIN information is not valid.Cards on the China Union Pay network may require a PIN.
|
||||
STATUS_PIN_INCORRECT,
|
||||
// The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
|
||||
STATUS_PIN_LOCKOUT,
|
||||
}
|
||||
export enum ApplePayStatusCodes {
|
||||
// The requested action succeeded.
|
||||
STATUS_SUCCESS = 1,
|
||||
// The requested action failed.
|
||||
STATUS_FAILURE,
|
||||
// The billing address is not valid.
|
||||
STATUS_INVALID_BILLING_POSTAL_ADDRESS,
|
||||
// The shipping address is not valid.
|
||||
STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
|
||||
// The shipping contact information is not valid.
|
||||
STATUS_INVALID_SHIPPING_CONTACT,
|
||||
// The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
|
||||
STATUS_PIN_REQUIRED,
|
||||
// The PIN information is not valid.Cards on the China Union Pay network may require a PIN.
|
||||
STATUS_PIN_INCORRECT,
|
||||
// The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
|
||||
STATUS_PIN_LOCKOUT,
|
||||
}
|
||||
|
||||
interface ApplePayPayload {
|
||||
merchantIdentifier: string;
|
||||
domainName: string;
|
||||
displayName: string;
|
||||
}
|
||||
interface ApplePayPayload {
|
||||
merchantIdentifier: string;
|
||||
domainName: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
declare class ApplePaySession {
|
||||
constructor(version: number, request: ApplePayPaymentRequest);
|
||||
export class ApplePaySession {
|
||||
constructor(version: number, request: ApplePayPaymentRequest);
|
||||
|
||||
canMakePayments(): boolean;
|
||||
canMakePayments(): boolean;
|
||||
|
||||
canMakePaymentsWithActiveCard(merchantIdentifier: string): boolean;
|
||||
canMakePaymentsWithActiveCard(merchantIdentifier: string): boolean;
|
||||
|
||||
completeMerchantValidation(merchantSession: any): void;
|
||||
completeMerchantValidation(merchantSession: any): void;
|
||||
|
||||
abort(): void;
|
||||
abort(): void;
|
||||
|
||||
begin(): void;
|
||||
begin(): void;
|
||||
|
||||
completePayment(status: ApplePayStatusCodes): void;
|
||||
completePayment(status: ApplePayStatusCodes): void;
|
||||
|
||||
completePaymentMethodSelection(newTotal: any, newLineItems: any): void;
|
||||
completePaymentMethodSelection(newTotal: any, newLineItems: any): void;
|
||||
|
||||
completeShippingContactSelection(status: ApplePayStatusCodes, newShippingMethods: any, newTotal: any, newLineItems: any): void;
|
||||
completeShippingContactSelection(status: ApplePayStatusCodes, newShippingMethods: any, newTotal: any, newLineItems: any): void;
|
||||
|
||||
completeShippingMethodSelection(status: ApplePayStatusCodes, newTotal: any, newLineItems: any): void;
|
||||
completeShippingMethodSelection(status: ApplePayStatusCodes, newTotal: any, newLineItems: any): void;
|
||||
|
||||
supportsVersion(version: number): boolean;
|
||||
supportsVersion(version: number): boolean;
|
||||
|
||||
oncancel: (event: any) => void;
|
||||
oncancel: (event: any) => void;
|
||||
|
||||
onpaymentauthorized: (event: any) => void;
|
||||
onpaymentauthorized: (event: any) => void;
|
||||
|
||||
onpaymentmethodselected: (event: any) => void;
|
||||
onpaymentmethodselected: (event: any) => void;
|
||||
|
||||
onshippingcontactselected: (event: any) => void;
|
||||
onshippingcontactselected: (event: any) => void;
|
||||
|
||||
onshippingmethodselected: (event: any) => void;
|
||||
onshippingmethodselected: (event: any) => void;
|
||||
|
||||
onvalidatemerchant: (event: any) => void;
|
||||
onvalidatemerchant: (event: any) => void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @module braintree-web/apple-pay
|
||||
* @description Accept Apple Pay on the Web. *This component is currently in beta and is subject to change.*
|
||||
*/
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
export interface ApplePay {
|
||||
/**
|
||||
* @static
|
||||
@@ -218,22 +204,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options Options
|
||||
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.apple-pay.create} instead.</strong>
|
||||
* @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
|
||||
*/
|
||||
export class ApplePay {
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options Options
|
||||
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.apple-pay.create} instead.</strong>
|
||||
* @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
|
||||
*/
|
||||
constructor(options: any);
|
||||
|
||||
/**
|
||||
* Merges a payment request with Braintree defaults
|
||||
@@ -260,7 +230,7 @@ declare namespace BraintreeWeb {
|
||||
* // { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
|
||||
*
|
||||
*/
|
||||
public createPaymentRequest(paymentRequest: ApplePayPaymentRequest): ApplePayPaymentRequest
|
||||
createPaymentRequest(paymentRequest: ApplePayPaymentRequest): ApplePayPaymentRequest
|
||||
|
||||
/**
|
||||
* Validates the merchant website, as required by ApplePaySession before payment can be authorized.
|
||||
@@ -302,7 +272,7 @@ declare namespace BraintreeWeb {
|
||||
* };
|
||||
* });
|
||||
*/
|
||||
public performValidation(options: { validationURL: string, displayName?: string, merchantIdentifier?: string }, callback: callback): void;
|
||||
performValidation(options: { validationURL: string, displayName?: string, merchantIdentifier?: string }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Tokenizes an Apple Pay payment.
|
||||
@@ -332,16 +302,14 @@ declare namespace BraintreeWeb {
|
||||
* };
|
||||
* });
|
||||
*/
|
||||
public tokenize(options: { token: any }, callback: callback): void;
|
||||
|
||||
tokenize(options: { token: any }, callback: callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
/** @module braintree-web/client */
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
/**
|
||||
* This object is returned by {@link Client#getConfiguration|getConfiguration}. This information is used extensively by other Braintree modules to properly configure themselves.
|
||||
* @typedef {object} Client~configuration
|
||||
* @property {object} client The braintree-web/client parameters.
|
||||
* @property {string} client.authorization A tokenizationKey or clientToken.
|
||||
* @property {object} gatewayConfiguration Gateway-supplied configuration.
|
||||
@@ -398,30 +366,13 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {Client~configuration} configuration Options
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.</strong>
|
||||
* @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
|
||||
*/
|
||||
export class Client {
|
||||
/**
|
||||
* @class
|
||||
* @param {Client~configuration} configuration Options
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.</strong>
|
||||
* @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
|
||||
*/
|
||||
constructor(configuration: Configuration);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a copy of the configuration values.
|
||||
* @public
|
||||
* @returns {Client~configuration} configuration
|
||||
*/
|
||||
public getConfiguration(): Configuration;
|
||||
getConfiguration(): Configuration;
|
||||
|
||||
/**
|
||||
* Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization.
|
||||
@@ -470,13 +421,12 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public request(options: { method: string, endpoint: string, data: any, timeout?: number }, callback: callback): void;
|
||||
|
||||
request(options: { method: string, endpoint: string, data: any, timeout?: number }, callback: callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
/** @module braintree-web/data-collector */
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
export interface DataCollector {
|
||||
/**
|
||||
* @static
|
||||
@@ -496,24 +446,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @global
|
||||
* @name DataCollector
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.</strong>
|
||||
* @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions. Before using DataCollector, make sure you have enabled advanced fraud protection in the Braintree gateway. To use your own Kount ID, contact our support team ([support@braintreepayments.com](mailto:support@braintreepayments.com) or [877.434.2894](tel:877.434.2894)).
|
||||
*/
|
||||
export class DataCollector {
|
||||
/**
|
||||
* @class
|
||||
* @global
|
||||
* @name DataCollector
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.</strong>
|
||||
* @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions.
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* @memberof DataCollector
|
||||
@@ -534,12 +466,11 @@ declare namespace BraintreeWeb {
|
||||
* @returns {void}
|
||||
*/
|
||||
teardown(callback?: callback): void;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** @module braintree-web/hosted-fields */
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
/**
|
||||
* Fields used in {@link module:braintree-web/hosted-fields~fieldOptions fields options}
|
||||
* @typedef {object} field
|
||||
@@ -578,7 +509,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} HostedFields~hostedFieldsCard
|
||||
* @description Information about the card type, sent in {@link HostedFields~stateObject|stateObjects}.
|
||||
* @property {string} type The code-friendly representation of the card type. It will be one of the following strings:
|
||||
* - `american-express`
|
||||
@@ -618,7 +548,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} HostedFields~hostedFieldsFieldData
|
||||
* @description Data about Hosted Fields fields, sent in {@link HostedFields~stateObject|stateObjects}.
|
||||
* @property {HTMLElement} container Reference to the container DOM element on your page associated with the current event.
|
||||
* @property {boolean} isFocused Whether or not the input is currently focused.
|
||||
@@ -641,7 +570,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} HostedFields~stateObject
|
||||
* @description The event payload sent from {@link HostedFields#on|on} or {@link HostedFields#getState|getState}.
|
||||
* @property {HostedFields~hostedFieldsCard[]} cards
|
||||
* This will return an array of potential {@link HostedFields~hostedFieldsCard|cards}. If the card type has been determined, the array will contain only one card.
|
||||
@@ -679,7 +607,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} HostedFields~tokenizePayload
|
||||
* @property {string} nonce The payment method nonce.
|
||||
* @property {object} details Additional account details.
|
||||
* @property {string} details.cardType Type of card, ex: Visa, MasterCard.
|
||||
@@ -781,22 +708,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class HostedFields
|
||||
* @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.</strong>
|
||||
* @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
|
||||
*/
|
||||
export class HostedFields {
|
||||
/**
|
||||
* @class HostedFields
|
||||
* @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.</strong>
|
||||
* @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
|
||||
*/
|
||||
constructor(options: any);
|
||||
|
||||
/**
|
||||
* @name HostedFields#on
|
||||
@@ -829,7 +740,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public teardown(callback?: callback): void;
|
||||
teardown(callback?: callback): void;
|
||||
|
||||
/**
|
||||
* Tokenizes fields and returns a nonce payload.
|
||||
@@ -872,7 +783,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public tokenize(options?: { vault: boolean }, callback?: callback): void;
|
||||
tokenize(options?: { vault: boolean }, callback?: callback): void;
|
||||
|
||||
/**
|
||||
* Add a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
|
||||
@@ -889,7 +800,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public addClass(field: string, classname: string, callback?: callback): void;
|
||||
addClass(field: string, classname: string, callback?: callback): void;
|
||||
|
||||
/**
|
||||
* Removes a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
|
||||
@@ -910,7 +821,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public removeClass(field: string, classname: string, callback?: callback): void;
|
||||
removeClass(field: string, classname: string, callback?: callback): void;
|
||||
|
||||
/**
|
||||
* Sets the placeholder of a {@link module:braintree-web/hosted-fields~field field}.
|
||||
@@ -940,7 +851,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public setPlaceholder(field: string, placeholder: string, callback?: callback): void;
|
||||
setPlaceholder(field: string, placeholder: string, callback?: callback): void;
|
||||
|
||||
/**
|
||||
* Clear the value of a {@link module:braintree-web/hosted-fields~field field}.
|
||||
@@ -960,7 +871,7 @@ declare namespace BraintreeWeb {
|
||||
* hostedFieldsInstance.clear('cvv');
|
||||
* hostedFieldsInstance.clear('expirationDate');
|
||||
*/
|
||||
public clear(field: string, callback?: callback): void;
|
||||
clear(field: string, callback?: callback): void;
|
||||
|
||||
/**
|
||||
* Returns an {@link HostedFields~stateObject|object} that includes the state of all fields and possible card types.
|
||||
@@ -973,14 +884,13 @@ declare namespace BraintreeWeb {
|
||||
* return state.fields[key].isValid;
|
||||
* });
|
||||
*/
|
||||
public getState(): any;
|
||||
getState(): any;
|
||||
}
|
||||
}
|
||||
|
||||
/** @module braintree-web/paypal */
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
/**
|
||||
* @typedef {object} PayPal~tokenizeReturn
|
||||
* @property {Function} close A handle to close the PayPal checkout flow.
|
||||
*/
|
||||
interface PayPalTokenizeReturn {
|
||||
@@ -988,7 +898,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} PayPal~tokenizePayload
|
||||
* @property {string} nonce The payment method nonce.
|
||||
* @property {string} type The payment method type, always `PayPalAccount`.
|
||||
* @property {object} details Additional PayPal account details.
|
||||
@@ -1082,20 +991,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
|
||||
* @classdesc This class represents a PayPal component. Instances of this class have methods for launching auth dialogs and other programmatic interactions with the PayPal component.
|
||||
*/
|
||||
export class PayPal {
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
|
||||
* @classdesc This class represents a PayPal component. Instances of this class have methods for launching auth dialogs and other programmatic interactions with the PayPal component.
|
||||
*/
|
||||
constructor(options: any);
|
||||
|
||||
/**
|
||||
* Launches the PayPal login flow and returns a nonce payload. Only one PayPal login flow should be active at a time. One way to achieve this is to disable your PayPal button while the flow is open.
|
||||
@@ -1192,7 +1087,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {PayPal~tokenizeReturn} A handle to close the PayPal checkout frame.
|
||||
*/
|
||||
public tokenize(options: { flow: string, intent: string, offerCredit: boolean, useraction: string, amount: (string | number), currency: string, displayName: string, locale: string, enableShippingAddress: boolean, shippingAddressOverride: PayPalShippingAddress, shippingAddressEditable: boolean, billingAgreementDescription: string }, callback: callback): PayPalTokenizeReturn;
|
||||
tokenize(options: { flow: string, intent: string, offerCredit: boolean, useraction: string, amount: (string | number), currency: string, displayName: string, locale: string, enableShippingAddress: boolean, shippingAddressOverride: PayPalShippingAddress, shippingAddressEditable: boolean, billingAgreementDescription: string }, callback: callback): PayPalTokenizeReturn;
|
||||
|
||||
/**
|
||||
* Cleanly tear down anything set up by {@link module:braintree-web/paypal.create|create}.
|
||||
@@ -1200,15 +1095,13 @@ declare namespace BraintreeWeb {
|
||||
* @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
|
||||
* @returns {void}
|
||||
*/
|
||||
public teardown(callback?: () => void): void;
|
||||
|
||||
teardown(callback?: () => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
/** @module braintree-web/three-d-secure */
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
/**
|
||||
* @typedef {object} ThreeDSecure~verifyPayload
|
||||
* @property {string} nonce The new payment method nonce produced by the 3D Secure lookup. The original nonce passed into {@link ThreeDSecure#verifyCard|verifyCard} was consumed. This new nonce should be used to transact on your server.
|
||||
* @property {object} details Additional account details.
|
||||
* @property {string} details.cardType Type of card, ex: Visa, MasterCard.
|
||||
@@ -1250,23 +1143,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.</strong>
|
||||
* @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
|
||||
*/
|
||||
export class ThreeDSecure {
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
|
||||
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.</strong>
|
||||
* @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
|
||||
*/
|
||||
constructor(options: any);
|
||||
|
||||
|
||||
/**
|
||||
* @callback ThreeDSecure~addFrameCallback
|
||||
@@ -1329,7 +1205,7 @@ declare namespace BraintreeWeb {
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
public verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
|
||||
verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Cancel the 3DS flow and return the verification payload if available.
|
||||
@@ -1349,7 +1225,7 @@ declare namespace BraintreeWeb {
|
||||
* verifyPayload.liabilityShiftPossible; // boolean
|
||||
* });
|
||||
*/
|
||||
public cancelVerifyCard(callback: callback): void;
|
||||
cancelVerifyCard(callback: callback): void;
|
||||
|
||||
/**
|
||||
* Cleanly tear down anything set up by {@link module:braintree-web/three-d-secure.create|create}
|
||||
@@ -1357,7 +1233,7 @@ declare namespace BraintreeWeb {
|
||||
* @param {errback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
|
||||
* @returns {void}
|
||||
*/
|
||||
public teardown(callback?: callback): void;
|
||||
teardown(callback?: callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1365,9 +1241,8 @@ declare namespace BraintreeWeb {
|
||||
* @module braintree-web/unionpay
|
||||
* @description This module allows you to accept UnionPay payments. *It is currently in beta and is subject to change.*
|
||||
*/
|
||||
declare namespace BraintreeWeb {
|
||||
declare namespace braintree {
|
||||
/**
|
||||
* @typedef {object} UnionPay~tokenizePayload
|
||||
* @property {string} nonce The payment method nonce.
|
||||
* @property {string} type Always <code>CreditCard</code>.
|
||||
* @property {object} details Additional account details:
|
||||
@@ -1388,7 +1263,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} UnionPay~enrollPayload
|
||||
* @property {string} enrollmentId UnionPay enrollment ID. This value should be passed to `tokenize`.
|
||||
* @property {boolean} smsCodeRequired UnionPay `smsCodeRequired` flag.
|
||||
* </p><b>true</b> - the user will receive an SMS code that needs to be supplied for tokenization.
|
||||
@@ -1400,7 +1274,6 @@ declare namespace BraintreeWeb {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} UnionPay~fetchCapabilitiesPayload
|
||||
* @property {boolean} isUnionPay Determines if this card is a UnionPay card.
|
||||
* @property {boolean} isDebit Determines if this card is a debit card. This property is only present if `isUnionPay` is `true`.
|
||||
* @property {object} unionPay UnionPay specific properties. This property is only present if `isUnionPay` is `true`.
|
||||
@@ -1443,22 +1316,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options See {@link module:braintree-web/unionpay.create|unionpay.create}.
|
||||
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/unionpay.create|braintree-web.unionpay.create} instead.</strong>
|
||||
* @classdesc This class represents a UnionPay component. Instances of this class have methods for {@link UnionPay#fetchCapabilities fetching capabilities} of UnionPay cards, {@link UnionPay#enroll enrolling} a UnionPay card, and {@link UnionPay#tokenize tokenizing} a UnionPay card.
|
||||
*/
|
||||
export class UnionPay {
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options See {@link module:braintree-web/unionpay.create|unionpay.create}.
|
||||
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/unionpay.create|braintree-web.unionpay.create} instead.</strong>
|
||||
* @classdesc This class represents a UnionPay component. Instances of this class have methods for {@link UnionPay#fetchCapabilities fetching capabilities} of UnionPay cards, {@link UnionPay#enroll enrolling} a UnionPay card, and {@link UnionPay#tokenize tokenizing} a UnionPay card.
|
||||
*/
|
||||
constructor(options: any);
|
||||
|
||||
/**
|
||||
* Fetches the capabilities of a card, including whether or not the SMS enrollment process is required.
|
||||
@@ -1531,7 +1388,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public fetchCapabilities(options: { card: any, hostedFields: HostedFields }, callback: callback): void;
|
||||
fetchCapabilities(options: { card: any, hostedFields: HostedFields }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Enrolls a UnionPay card. Use {@link UnionPay#fetchCapabilities|fetchCapabilities} to determine if the SMS enrollment process is required.
|
||||
@@ -1594,7 +1451,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public enroll(options: { card: any, hostedFields: HostedFields, mobile: any }, callback: callback): void;
|
||||
enroll(options: { card: any, hostedFields: HostedFields, mobile: any }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Tokenizes a UnionPay card and returns a nonce payload.
|
||||
@@ -1643,7 +1500,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public tokenize(options: { card: any, hostedFields: HostedFields, enrollmentId: string, smsCode: string }, callback: callback): void;
|
||||
tokenize(options: { card: any, hostedFields: HostedFields, enrollmentId: string, smsCode: string }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Cleanly tear down anything set up by {@link module:braintree-web/unionpay.create|create}. This only needs to be called when using UnionPay with Hosted Fields.
|
||||
@@ -1659,8 +1516,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* @returns {void}
|
||||
*/
|
||||
public teardown(callback?: callback): void;
|
||||
|
||||
teardown(callback?: callback): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1683,21 +1539,6 @@ declare namespace BraintreeWeb {
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
|
||||
* @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. <strong>You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.</strong>
|
||||
*/
|
||||
export class USBankAccount {
|
||||
/**
|
||||
* @class
|
||||
* @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
|
||||
* @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. <strong>You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.</strong>
|
||||
*/
|
||||
constructor(options: any)
|
||||
|
||||
|
||||
/**
|
||||
* Tokenizes bank information to return a payment method nonce. You can tokenize bank details by providing information like account and routing numbers. You can also tokenize with a bank login UI that prompts the customer to log into their bank account.
|
||||
@@ -1778,7 +1619,7 @@ declare namespace BraintreeWeb {
|
||||
* });
|
||||
* });
|
||||
*/
|
||||
public tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void;
|
||||
tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void;
|
||||
|
||||
/**
|
||||
* Cleanly tear down anything set up by {@link module:braintree-web/us-bank-account.create|create}.
|
||||
@@ -1786,77 +1627,53 @@ declare namespace BraintreeWeb {
|
||||
* @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
|
||||
* @returns {void}
|
||||
*/
|
||||
public teardown(callback?: callback): void;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare namespace BraintreeError {
|
||||
/**
|
||||
* Enum for {@link BraintreeError} types.
|
||||
* @name BraintreeError.types
|
||||
* @enum
|
||||
* @readonly
|
||||
* @memberof BraintreeError
|
||||
* @property {string} CUSTOMER An error caused by the customer.
|
||||
* @property {string} MERCHANT An error that is actionable by the merchant.
|
||||
* @property {string} NETWORK An error due to a network problem.
|
||||
* @property {string} INTERNAL An error caused by Braintree code.
|
||||
* @property {string} UNKNOWN An error where the origin is unknown.
|
||||
*/
|
||||
export enum Types {
|
||||
CUSTOMER,
|
||||
MERCHANT,
|
||||
NETWORK,
|
||||
INTERNAL,
|
||||
UNKNOWN
|
||||
teardown(callback?: callback): void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @global
|
||||
* @param {object} options Construction options
|
||||
* @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
|
||||
* @description <strong>You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.</strong>
|
||||
*/
|
||||
declare class BraintreeError {
|
||||
/**
|
||||
* @class
|
||||
* @global
|
||||
* @param {object} options Construction options
|
||||
* @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
|
||||
* @description <strong>You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.</strong>
|
||||
*/
|
||||
constructor(options: any);
|
||||
declare namespace braintree {
|
||||
export namespace BraintreeError {
|
||||
/**
|
||||
* Enum for {@link BraintreeError} types.
|
||||
* @name BraintreeError.types
|
||||
* @enum
|
||||
* @readonly
|
||||
* @memberof BraintreeError
|
||||
* @property {string} CUSTOMER An error caused by the customer.
|
||||
* @property {string} MERCHANT An error that is actionable by the merchant.
|
||||
* @property {string} NETWORK An error due to a network problem.
|
||||
* @property {string} INTERNAL An error caused by Braintree code.
|
||||
* @property {string} UNKNOWN An error where the origin is unknown.
|
||||
*/
|
||||
export type Types = "CUSTOMER" | "MERCHANT" | "NETWORK" | "INTERNAL" | "UNKNOWN";
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @description A code that corresponds to specific errors.
|
||||
*/
|
||||
code: string;
|
||||
export interface BraintreeError {
|
||||
/**
|
||||
* @type {string}
|
||||
* @description A code that corresponds to specific errors.
|
||||
*/
|
||||
code: string;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
* @description A short description of the error.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* @type {string}
|
||||
* @description A short description of the error.
|
||||
*/
|
||||
message: string;
|
||||
|
||||
/**
|
||||
* @type {BraintreeError.types}
|
||||
* @description The type of error.
|
||||
*/
|
||||
type: BraintreeError.Types;
|
||||
/**
|
||||
* @type {BraintreeError.types}
|
||||
* @description The type of error.
|
||||
*/
|
||||
type: BraintreeError.Types;
|
||||
|
||||
/**
|
||||
* @type {object=}
|
||||
* @description Additional information about the error, such as an underlying network error response.
|
||||
*/
|
||||
details: any;
|
||||
}
|
||||
/**
|
||||
* @type {object=}
|
||||
* @description Additional information about the error, such as an underlying network error response.
|
||||
*/
|
||||
details: any;
|
||||
}
|
||||
|
||||
declare namespace BraintreeWeb {
|
||||
/**
|
||||
* @global
|
||||
* @callback callback
|
||||
@@ -1895,39 +1712,40 @@ declare namespace BraintreeWeb {
|
||||
* braintreeClient.create(...);
|
||||
* });
|
||||
*/
|
||||
interface BraintreeStatic {
|
||||
declare namespace braintree {
|
||||
/** @type {module:braintree-web/client} */
|
||||
client: BraintreeWeb.Client;
|
||||
export var client: braintree.Client;
|
||||
|
||||
/** @type {module:braintree-web/paypal} */
|
||||
paypal: BraintreeWeb.PayPal;
|
||||
export var paypal: braintree.PayPal;
|
||||
|
||||
/** @type {module:braintree-web/hosted-fields} */
|
||||
hostedFields: BraintreeWeb.HostedFields;
|
||||
export var hostedFields: braintree.HostedFields;
|
||||
|
||||
/** @type {module:braintree-web/three-d-secure} */
|
||||
threeDSecure: BraintreeWeb.ThreeDSecure;
|
||||
export var threeDSecure: braintree.ThreeDSecure;
|
||||
|
||||
/** @type {module:braintree-web/data-collector} */
|
||||
dataCollector: BraintreeWeb.DataCollector;
|
||||
export var dataCollector: braintree.DataCollector;
|
||||
|
||||
/** @type {module:braintree-web/american-express} */
|
||||
americanExpress: BraintreeWeb.AmericanExpress;
|
||||
export var americanExpress: braintree.AmericanExpress;
|
||||
|
||||
/** @type {module:braintree-web/unionpay} */
|
||||
unionpay: BraintreeWeb.UnionPay;
|
||||
export var unionpay: braintree.UnionPay;
|
||||
|
||||
/** @type {module:braintree-web/apple-pay} */
|
||||
applePay: BraintreeWeb.ApplePay;
|
||||
export var applePay: braintree.ApplePay;
|
||||
|
||||
/** @type {module:braintree-web/us-bank-account} */
|
||||
usBankAccount: BraintreeWeb.USBankAccount;
|
||||
/** @type {module:braintree-web/us-bank-account} */
|
||||
export var usBankAccount: braintree.USBankAccount;
|
||||
|
||||
/**
|
||||
* @description The current version of the SDK, i.e. `3.0.2`.
|
||||
* @type {string}
|
||||
*/
|
||||
VERSION: string;
|
||||
export var VERSION: string;
|
||||
}
|
||||
|
||||
declare var braintree: BraintreeStatic;
|
||||
export = braintree;
|
||||
export as namespace braintree;
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
import * as braintree from 'braintree-web';
|
||||
|
||||
let version: string = braintree.VERSION;
|
||||
|
||||
let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI0YjlhYzVmYmI4ZTNkYzQzMmFkZjJhNzBlNjZlMWNjY2M5ODRkYzE4ZTM4YmY4NjYzZTM5NjM3NWZjYmQzY2U5fGNyZWF0ZWRfYXQ9MjAxNi0wOS0wOFQwNTowMzo0MC4xNjk1NTUwMzUrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJtZXJjaGFudEFjY291bnRJZCI6ImFjbWV3aWRnZXRzbHRkc2FuZGJveCIsImN1cnJlbmN5SXNvQ29kZSI6IlVTRCJ9LCJjb2luYmFzZUVuYWJsZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
|
||||
|
||||
braintree.client.create({
|
||||
authorization: clientToken
|
||||
}, function (error: braintree.BraintreeError, clientInstance: any) {
|
||||
|
||||
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
|
||||
var data: { creditCard: braintree.CreditCardInfo } = {
|
||||
creditCard: {
|
||||
number: form['cc-number'].value,
|
||||
cvv: form['cc-cvv'].value,
|
||||
expirationDate: form['cc-date'].value,
|
||||
billingAddress: {
|
||||
postalCode: form['cc-postal'].value
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
clientInstance.request({
|
||||
endpoint: 'payment_methods/credit_cards',
|
||||
method: 'post',
|
||||
data: data
|
||||
}, function (requestErr: braintree.BraintreeError, response: { creditCards: any[]; }) {
|
||||
if (requestErr) { throw new Error(requestErr.message); }
|
||||
|
||||
console.log('Got nonce:', response.creditCards[0].nonce);
|
||||
});
|
||||
|
||||
braintree.hostedFields.create({
|
||||
client: clientInstance,
|
||||
styles: {
|
||||
'input': {
|
||||
'font-size': '16pt',
|
||||
'color': '#3A3A3A'
|
||||
},
|
||||
|
||||
'.number': {
|
||||
'font-family': 'monospace'
|
||||
},
|
||||
'.valid': {
|
||||
'color': 'green'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
number: {
|
||||
selector: '#card-number'
|
||||
},
|
||||
cvv: {
|
||||
selector: '#cvv',
|
||||
type: 'password'
|
||||
},
|
||||
expirationMonth: {
|
||||
selector: '#expiration-month',
|
||||
select: {
|
||||
options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"]
|
||||
}
|
||||
},
|
||||
expirationYear: {
|
||||
selector: '#expiration-year',
|
||||
select: true
|
||||
}
|
||||
}
|
||||
}, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
|
||||
|
||||
if (hostedFieldsErr) {
|
||||
// Handle error in Hosted Fields creation
|
||||
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let form = new HTMLFormElement();
|
||||
|
||||
form.addEventListener('submit', function (event: Event) {
|
||||
event.preventDefault();
|
||||
|
||||
hostedFieldsInstance.tokenize(function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
// Handle error in Hosted Fields tokenization
|
||||
switch (tokenizeErr.code) {
|
||||
case 'HOSTED_FIELDS_FIELDS_EMPTY':
|
||||
console.error('All fields are empty! Please fill out the form.');
|
||||
break;
|
||||
case 'HOSTED_FIELDS_FIELDS_INVALID':
|
||||
console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys);
|
||||
break;
|
||||
case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
|
||||
console.error('Tokenization failed server side. Is the card valid?');
|
||||
break;
|
||||
case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
|
||||
console.error('Network error occurred when tokenizing.');
|
||||
break;
|
||||
default:
|
||||
console.error('Something bad happened!', tokenizeErr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Put `payload.nonce` into the `payment-method-nonce` input, and then
|
||||
// submit the form. Alternatively, you could send the nonce to your server
|
||||
// with AJAX.
|
||||
(document.querySelector('input[name="payment-method-nonce"]') as HTMLInputElement).value = payload.nonce;
|
||||
form.submit();
|
||||
});
|
||||
}, false);
|
||||
|
||||
hostedFieldsInstance.on('focus', function (event: braintree.HostedFieldsStateObject) {
|
||||
console.log(event.emittedBy, 'has been focused');
|
||||
});
|
||||
|
||||
hostedFieldsInstance.teardown(function (teardownErr: braintree.BraintreeError) {
|
||||
if (teardownErr) {
|
||||
console.error('Could not tear down Hosted Fields!');
|
||||
} else {
|
||||
console.info('Hosted Fields has been torn down!');
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.tokenize({
|
||||
vault: true
|
||||
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
console.error(tokenizeErr);
|
||||
} else {
|
||||
console.log('Got nonce:', payload.nonce);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
|
||||
if (addClassErr) {
|
||||
console.error(addClassErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
|
||||
if (addClassErr) {
|
||||
console.error(addClassErr);
|
||||
return;
|
||||
}
|
||||
|
||||
// some time later...
|
||||
hostedFieldsInstance.removeClass('number', 'custom-class');
|
||||
});
|
||||
|
||||
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: braintree.BraintreeError) {
|
||||
if (placeholderErr) {
|
||||
console.error(placeholderErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.on('cardTypeChange', function (event: braintree.HostedFieldsStateObject) {
|
||||
// Update the placeholder value if there is only one possible card type
|
||||
if (event.cards.length === 1) {
|
||||
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: braintree.BraintreeError) {
|
||||
if (placeholderErr) {
|
||||
// Handle errors, such as invalid field name
|
||||
console.error(placeholderErr);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.clear('number', function (clearErr: braintree.BraintreeError) {
|
||||
if (clearErr) {
|
||||
console.error(clearErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.clear('number');
|
||||
hostedFieldsInstance.clear('cvv');
|
||||
hostedFieldsInstance.clear('expirationDate');
|
||||
|
||||
var state = braintree.hostedFields.getState();
|
||||
|
||||
var formValid = Object.keys(state.fields).every(function (key) {
|
||||
return state.fields[key].isValid;
|
||||
});
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
|
||||
if (createErr) {
|
||||
// Handle error in client creation
|
||||
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let request = {
|
||||
countryCode: 'US',
|
||||
currencyCode: 'USD',
|
||||
supportedNetworks: ['visa', 'masterCard'],
|
||||
merchantCapabilities: ['supports3DS'],
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var paymentRequest = braintree.applePay.createPaymentRequest(request);
|
||||
|
||||
console.log(paymentRequest);
|
||||
// { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
|
||||
let request = {
|
||||
countryCode: 'US',
|
||||
currencyCode: 'USD',
|
||||
supportedNetworks: ['visa', 'masterCard'],
|
||||
merchantCapabilities: ['supports3DS'],
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var session = new braintree.ApplePaySession(1, request);
|
||||
|
||||
session.onvalidatemerchant = function (event: { validationURL: string }) {
|
||||
braintree.applePay.performValidation({
|
||||
validationURL: event.validationURL
|
||||
}, function (err, validationData) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
session.abort();
|
||||
return;
|
||||
}
|
||||
session.completeMerchantValidation(validationData);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
|
||||
let request = {
|
||||
countryCode: 'US',
|
||||
currencyCode: 'USD',
|
||||
supportedNetworks: ['visa', 'masterCard'],
|
||||
merchantCapabilities: ['supports3DS'],
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var session = new braintree.ApplePaySession(1, request);
|
||||
|
||||
session.onpaymentauthorized = function (event) {
|
||||
braintree.applePay.tokenize({
|
||||
token: event.payment.token
|
||||
}, function (err, tokenizedPayload) {
|
||||
if (err) {
|
||||
session.completePayment(braintree.ApplePayStatusCodes.STATUS_FAILURE);
|
||||
return;
|
||||
}
|
||||
session.completePayment(braintree.ApplePayStatusCodes.STATUS_SUCCESS);
|
||||
|
||||
// Send the tokenizedPayload to your server.
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
braintree.paypal.create({
|
||||
client: clientInstance
|
||||
}, function (createErr, paypalInstance) {
|
||||
if (createErr) {
|
||||
if (createErr.code === 'PAYPAL_BROWSER_NOT_SUPPORTED') {
|
||||
console.error('This browser is not supported.');
|
||||
} else {
|
||||
console.error('Error!', createErr);
|
||||
}
|
||||
}
|
||||
|
||||
let button = new HTMLButtonElement();
|
||||
|
||||
button.addEventListener('click', function () {
|
||||
// Disable the button so that we don't attempt to open multiple popups.
|
||||
button.setAttribute('disabled', 'disabled');
|
||||
|
||||
// Because PayPal tokenization opens a popup, this must be called
|
||||
// as a result of a user action, such as a button click.
|
||||
paypalInstance.tokenize({
|
||||
flow: 'vault' // Required
|
||||
// Any other tokenization options
|
||||
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.PayPalTokenizePayload) {
|
||||
button.removeAttribute('disabled');
|
||||
|
||||
if (tokenizeErr) {
|
||||
// Handle tokenization errors or premature flow closure
|
||||
|
||||
switch (tokenizeErr.code) {
|
||||
case 'PAYPAL_POPUP_CLOSED':
|
||||
console.error('Customer closed PayPal popup.');
|
||||
break;
|
||||
case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
|
||||
console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
|
||||
break;
|
||||
case 'PAYPAL_FLOW_FAILED':
|
||||
console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
|
||||
break;
|
||||
default:
|
||||
console.error('Error!', tokenizeErr);
|
||||
}
|
||||
} else {
|
||||
// Submit payload.nonce to your server
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
braintree.unionpay.create({ client: clientInstance }, function (createErr, unionpayInstance) {
|
||||
if (createErr) {
|
||||
console.error(createErr);
|
||||
return;
|
||||
}
|
||||
|
||||
unionpayInstance.fetchCapabilities({
|
||||
card: {
|
||||
number: '4111111111111111'
|
||||
}
|
||||
}, function (fetchErr: braintree.BraintreeError, cardCapabilities: braintree.UnionPayFetchCapabilitiesPayload) {
|
||||
if (fetchErr) {
|
||||
console.error(fetchErr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardCapabilities.isUnionPay) {
|
||||
if (cardCapabilities.unionPay && !cardCapabilities.unionPay.isSupported) {
|
||||
// Braintree cannot process this UnionPay card.
|
||||
// Ask the user for a different card.
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardCapabilities.isDebit) {
|
||||
// CVV and expiration date are not required
|
||||
} else {
|
||||
// CVV and expiration date are required
|
||||
}
|
||||
|
||||
// Show mobile phone number field for enrollment
|
||||
}
|
||||
});
|
||||
|
||||
unionpayInstance.enroll({
|
||||
card: {
|
||||
number: '4111111111111111',
|
||||
expirationMonth: '12',
|
||||
expirationYear: '2038'
|
||||
},
|
||||
mobile: {
|
||||
countryCode: '62',
|
||||
number: '111111111111'
|
||||
}
|
||||
}, function (enrollErr: braintree.BraintreeError, response: braintree.UnionPayEnrollPayload) {
|
||||
if (enrollErr) {
|
||||
console.error(enrollErr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.smsCodeRequired) {
|
||||
// If smsCodeRequired, wait for SMS auth code from customer
|
||||
// Then use response.enrollmentId during {@link UnionPay#tokenize}
|
||||
} else {
|
||||
// SMS code is not required from the user.
|
||||
// {@link UnionPay#tokenize} can be called immediately
|
||||
}
|
||||
});
|
||||
|
||||
let enrollResponse: {
|
||||
enrollmentId: string
|
||||
};
|
||||
|
||||
unionpayInstance.tokenize({
|
||||
card: {
|
||||
number: '4111111111111111',
|
||||
expirationMonth: '12',
|
||||
expirationYear: '2038',
|
||||
cvv: '123'
|
||||
},
|
||||
enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
|
||||
smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
|
||||
}, function (tokenizeErr: braintree.BraintreeError, response: braintree.UnionPayTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
console.error(tokenizeErr);
|
||||
return;
|
||||
}
|
||||
|
||||
// Send response.nonce to your server
|
||||
});
|
||||
|
||||
unionpayInstance.teardown(function (teardownErr: braintree.BraintreeError) {
|
||||
if (teardownErr) {
|
||||
console.error('Could not tear down UnionPay.');
|
||||
} else {
|
||||
console.log('UnionPay has been torn down.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
let existingNonce = "fake-valid-nonce";
|
||||
let submitNonceToServer: (nonce: string) => void;
|
||||
|
||||
braintree.threeDSecure.verifyCard({
|
||||
nonce: existingNonce,
|
||||
amount: 123.45,
|
||||
addFrame: function (err, iframe) {
|
||||
// Set up your UI and add the iframe.
|
||||
let my3DSContainer = document.createElement('div');
|
||||
my3DSContainer.appendChild(iframe);
|
||||
document.body.appendChild(my3DSContainer);
|
||||
},
|
||||
removeFrame: function () {
|
||||
let my3DSContainer = document.createElement('div');
|
||||
|
||||
// Remove UI that you added in addFrame.
|
||||
document.body.removeChild(my3DSContainer);
|
||||
}
|
||||
}, function (err: braintree.BraintreeError, payload: braintree.ThreeDSecureVerifyPayload) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (payload.liabilityShifted) {
|
||||
// Liablity has shifted
|
||||
submitNonceToServer(payload.nonce);
|
||||
} else if (payload.liabilityShiftPossible) {
|
||||
// Liablity may still be shifted
|
||||
// Decide if you want to submit the nonce
|
||||
} else {
|
||||
// Liablity has not shifted and will not shift
|
||||
// Decide if you want to submit the nonce
|
||||
}
|
||||
});
|
||||
|
||||
braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError, verifyPayload: braintree.ThreeDSecureVerifyPayload) {
|
||||
if (err) {
|
||||
// Handle error
|
||||
console.log(err.message); // No verification payload available
|
||||
return;
|
||||
}
|
||||
|
||||
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
|
||||
verifyPayload.liabilityShifted; // boolean
|
||||
verifyPayload.liabilityShiftPossible; // boolean
|
||||
});
|
||||
@@ -4,10 +4,10 @@ let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiO
|
||||
|
||||
braintree.client.create({
|
||||
authorization: clientToken
|
||||
}, function (error: BraintreeError, clientInstance: any) {
|
||||
}, function (error: braintree.BraintreeError, clientInstance: any) {
|
||||
|
||||
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
|
||||
var data: { creditCard: BraintreeWeb.CreditCardInfo } = {
|
||||
var data: { creditCard: braintree.CreditCardInfo } = {
|
||||
creditCard: {
|
||||
number: form['cc-number'].value,
|
||||
cvv: form['cc-cvv'].value,
|
||||
@@ -22,7 +22,7 @@ braintree.client.create({
|
||||
endpoint: 'payment_methods/credit_cards',
|
||||
method: 'post',
|
||||
data: data
|
||||
}, function (requestErr: BraintreeError, response: { creditCards: any[]; }) {
|
||||
}, function (requestErr: braintree.BraintreeError, response: { creditCards: any[]; }) {
|
||||
if (requestErr) { throw new Error(requestErr.message); }
|
||||
|
||||
console.log('Got nonce:', response.creditCards[0].nonce);
|
||||
@@ -62,7 +62,7 @@ braintree.client.create({
|
||||
select: true
|
||||
}
|
||||
}
|
||||
}, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
|
||||
}, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
|
||||
|
||||
if (hostedFieldsErr) {
|
||||
// Handle error in Hosted Fields creation
|
||||
@@ -75,7 +75,7 @@ braintree.client.create({
|
||||
form.addEventListener('submit', function (event: Event) {
|
||||
event.preventDefault();
|
||||
|
||||
hostedFieldsInstance.tokenize(function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
|
||||
hostedFieldsInstance.tokenize(function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
// Handle error in Hosted Fields tokenization
|
||||
switch (tokenizeErr.code) {
|
||||
@@ -105,11 +105,11 @@ braintree.client.create({
|
||||
});
|
||||
}, false);
|
||||
|
||||
hostedFieldsInstance.on('focus', function (event: BraintreeWeb.HostedFieldsStateObject) {
|
||||
hostedFieldsInstance.on('focus', function (event: braintree.HostedFieldsStateObject) {
|
||||
console.log(event.emittedBy, 'has been focused');
|
||||
});
|
||||
|
||||
hostedFieldsInstance.teardown(function (teardownErr: BraintreeError) {
|
||||
hostedFieldsInstance.teardown(function (teardownErr: braintree.BraintreeError) {
|
||||
if (teardownErr) {
|
||||
console.error('Could not tear down Hosted Fields!');
|
||||
} else {
|
||||
@@ -119,7 +119,7 @@ braintree.client.create({
|
||||
|
||||
hostedFieldsInstance.tokenize({
|
||||
vault: true
|
||||
}, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
|
||||
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
console.error(tokenizeErr);
|
||||
} else {
|
||||
@@ -127,13 +127,13 @@ braintree.client.create({
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
|
||||
if (addClassErr) {
|
||||
console.error(addClassErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
|
||||
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
|
||||
if (addClassErr) {
|
||||
console.error(addClassErr);
|
||||
return;
|
||||
@@ -143,16 +143,16 @@ braintree.client.create({
|
||||
hostedFieldsInstance.removeClass('number', 'custom-class');
|
||||
});
|
||||
|
||||
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: BraintreeError) {
|
||||
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: braintree.BraintreeError) {
|
||||
if (placeholderErr) {
|
||||
console.error(placeholderErr);
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.on('cardTypeChange', function (event: BraintreeWeb.HostedFieldsStateObject) {
|
||||
hostedFieldsInstance.on('cardTypeChange', function (event: braintree.HostedFieldsStateObject) {
|
||||
// Update the placeholder value if there is only one possible card type
|
||||
if (event.cards.length === 1) {
|
||||
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: BraintreeError) {
|
||||
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: braintree.BraintreeError) {
|
||||
if (placeholderErr) {
|
||||
// Handle errors, such as invalid field name
|
||||
console.error(placeholderErr);
|
||||
@@ -161,7 +161,7 @@ braintree.client.create({
|
||||
}
|
||||
});
|
||||
|
||||
hostedFieldsInstance.clear('number', function (clearErr: BraintreeError) {
|
||||
hostedFieldsInstance.clear('number', function (clearErr: braintree.BraintreeError) {
|
||||
if (clearErr) {
|
||||
console.error(clearErr);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ braintree.client.create({
|
||||
});
|
||||
});
|
||||
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr?: BraintreeError, applePayInstance?: any) {
|
||||
braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
|
||||
if (createErr) {
|
||||
// Handle error in client creation
|
||||
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
|
||||
@@ -209,7 +209,7 @@ braintree.client.create({
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var session = new ApplePaySession(1, request);
|
||||
var session = new braintree.ApplePaySession(1, request);
|
||||
|
||||
session.onvalidatemerchant = function (event: { validationURL: string }) {
|
||||
braintree.applePay.performValidation({
|
||||
@@ -234,17 +234,17 @@ braintree.client.create({
|
||||
total: { label: 'Your Label', amount: '10.00' },
|
||||
};
|
||||
|
||||
var session = new ApplePaySession(1, request);
|
||||
var session = new braintree.ApplePaySession(1, request);
|
||||
|
||||
session.onpaymentauthorized = function (event) {
|
||||
braintree.applePay.tokenize({
|
||||
token: event.payment.token
|
||||
}, function (err, tokenizedPayload) {
|
||||
if (err) {
|
||||
session.completePayment(ApplePayStatusCodes.STATUS_FAILURE);
|
||||
session.completePayment(braintree.ApplePayStatusCodes.STATUS_FAILURE);
|
||||
return;
|
||||
}
|
||||
session.completePayment(ApplePayStatusCodes.STATUS_SUCCESS);
|
||||
session.completePayment(braintree.ApplePayStatusCodes.STATUS_SUCCESS);
|
||||
|
||||
// Send the tokenizedPayload to your server.
|
||||
});
|
||||
@@ -273,7 +273,7 @@ braintree.client.create({
|
||||
paypalInstance.tokenize({
|
||||
flow: 'vault' // Required
|
||||
// Any other tokenization options
|
||||
}, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.PayPalTokenizePayload) {
|
||||
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.PayPalTokenizePayload) {
|
||||
button.removeAttribute('disabled');
|
||||
|
||||
if (tokenizeErr) {
|
||||
@@ -309,7 +309,7 @@ braintree.client.create({
|
||||
card: {
|
||||
number: '4111111111111111'
|
||||
}
|
||||
}, function (fetchErr: BraintreeError, cardCapabilities: BraintreeWeb.UnionPayFetchCapabilitiesPayload) {
|
||||
}, function (fetchErr: braintree.BraintreeError, cardCapabilities: braintree.UnionPayFetchCapabilitiesPayload) {
|
||||
if (fetchErr) {
|
||||
console.error(fetchErr);
|
||||
return;
|
||||
@@ -342,7 +342,7 @@ braintree.client.create({
|
||||
countryCode: '62',
|
||||
number: '111111111111'
|
||||
}
|
||||
}, function (enrollErr: BraintreeError, response: BraintreeWeb.UnionPayEnrollPayload) {
|
||||
}, function (enrollErr: braintree.BraintreeError, response: braintree.UnionPayEnrollPayload) {
|
||||
if (enrollErr) {
|
||||
console.error(enrollErr);
|
||||
return;
|
||||
@@ -370,7 +370,7 @@ braintree.client.create({
|
||||
},
|
||||
enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
|
||||
smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
|
||||
}, function (tokenizeErr: BraintreeError, response: BraintreeWeb.UnionPayTokenizePayload) {
|
||||
}, function (tokenizeErr: braintree.BraintreeError, response: braintree.UnionPayTokenizePayload) {
|
||||
if (tokenizeErr) {
|
||||
console.error(tokenizeErr);
|
||||
return;
|
||||
@@ -379,7 +379,7 @@ braintree.client.create({
|
||||
// Send response.nonce to your server
|
||||
});
|
||||
|
||||
unionpayInstance.teardown(function (teardownErr: BraintreeError) {
|
||||
unionpayInstance.teardown(function (teardownErr: braintree.BraintreeError) {
|
||||
if (teardownErr) {
|
||||
console.error('Could not tear down UnionPay.');
|
||||
} else {
|
||||
@@ -407,7 +407,7 @@ braintree.threeDSecure.verifyCard({
|
||||
// Remove UI that you added in addFrame.
|
||||
document.body.removeChild(my3DSContainer);
|
||||
}
|
||||
}, function (err: BraintreeError, payload: BraintreeWeb.ThreeDSecureVerifyPayload) {
|
||||
}, function (err: braintree.BraintreeError, payload: braintree.ThreeDSecureVerifyPayload) {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return;
|
||||
@@ -425,7 +425,7 @@ braintree.threeDSecure.verifyCard({
|
||||
}
|
||||
});
|
||||
|
||||
braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPayload: BraintreeWeb.ThreeDSecureVerifyPayload) {
|
||||
braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError, verifyPayload: braintree.ThreeDSecureVerifyPayload) {
|
||||
if (err) {
|
||||
// Handle error
|
||||
console.log(err.message); // No verification payload available
|
||||
@@ -435,4 +435,4 @@ braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPay
|
||||
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
|
||||
verifyPayload.liabilityShifted; // boolean
|
||||
verifyPayload.liabilityShiftPossible; // boolean
|
||||
});
|
||||
});
|
||||
@@ -18,6 +18,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"braintree-web-tests.ts"
|
||||
"test/web.ts",
|
||||
"test/node.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ const text = 'Always after me lucky charms.';
|
||||
|
||||
let offset = 0;
|
||||
const iv = setInterval(() => {
|
||||
let y = 0, dy = 1;
|
||||
let y = 0;
|
||||
let dy = 1;
|
||||
for (let i = 0; i < 40; i++) {
|
||||
const color = colors[(i + offset) % colors.length];
|
||||
const c = text[(i + offset) % text.length];
|
||||
|
||||
@@ -89,4 +89,4 @@ myCalendar
|
||||
.setEvents([])
|
||||
.addEvents([])
|
||||
.removeEvents(event => event.id === 'idToRemove')
|
||||
.destroy();
|
||||
.destroy();
|
||||
|
||||
@@ -3,9 +3,9 @@ import * as http from 'http';
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
const cookies = new Cookies(req, res);
|
||||
let unsigned: string,
|
||||
signed: string,
|
||||
tampered: string;
|
||||
let unsigned: string;
|
||||
let signed: string;
|
||||
let tampered: string;
|
||||
|
||||
if (req.url === "/set") {
|
||||
cookies
|
||||
|
||||
Vendored
+153
-153
@@ -26,13 +26,13 @@ and limitations under the License.
|
||||
|
||||
interface SymbolConstructor {
|
||||
/**
|
||||
* Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
|
||||
*/
|
||||
* Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
|
||||
*/
|
||||
useSimple(): void;
|
||||
|
||||
/**
|
||||
* Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
|
||||
*/
|
||||
* Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
|
||||
*/
|
||||
userSetter(): void;
|
||||
}
|
||||
|
||||
@@ -80,202 +80,202 @@ interface Set<T> {
|
||||
|
||||
interface ArrayConstructor {
|
||||
/**
|
||||
* Appends new elements to an array, and returns the new length of the array.
|
||||
* @param items New elements of the Array.
|
||||
*/
|
||||
* Appends new elements to an array, and returns the new length of the array.
|
||||
* @param items New elements of the Array.
|
||||
*/
|
||||
push<T>(array: ArrayLike<T>, ...items: T[]): number;
|
||||
/**
|
||||
* Removes the last element from an array and returns it.
|
||||
*/
|
||||
* Removes the last element from an array and returns it.
|
||||
*/
|
||||
pop<T>(array: ArrayLike<T>): T;
|
||||
/**
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
* Combines two or more arrays.
|
||||
* @param items Additional items to add to the end of array1.
|
||||
*/
|
||||
concat<T>(array: ArrayLike<T>, ...items: Array<T[]| T>): T[];
|
||||
/**
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
*/
|
||||
* Adds all the elements of an array separated by the specified separator string.
|
||||
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
|
||||
*/
|
||||
join<T>(array: ArrayLike<T>, separator?: string): string;
|
||||
/**
|
||||
* Reverses the elements in an Array.
|
||||
*/
|
||||
* Reverses the elements in an Array.
|
||||
*/
|
||||
reverse<T>(array: ArrayLike<T>): T[];
|
||||
/**
|
||||
* Removes the first element from an array and returns it.
|
||||
*/
|
||||
* Removes the first element from an array and returns it.
|
||||
*/
|
||||
shift<T>(array: ArrayLike<T>): T;
|
||||
/**
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
* Returns a section of an array.
|
||||
* @param start The beginning of the specified portion of the array.
|
||||
* @param end The end of the specified portion of the array.
|
||||
*/
|
||||
slice<T>(array: ArrayLike<T>, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
* Sorts an array.
|
||||
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
|
||||
*/
|
||||
* Sorts an array.
|
||||
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
|
||||
*/
|
||||
sort<T>(array: ArrayLike<T>, compareFn?: (a: T, b: T) => number): T[];
|
||||
|
||||
/**
|
||||
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
|
||||
* @param start The zero-based location in the array from which to start removing elements.
|
||||
* @param deleteCount The number of elements to remove.
|
||||
* @param items Elements to insert into the array in place of the deleted elements.
|
||||
*/
|
||||
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
|
||||
* @param start The zero-based location in the array from which to start removing elements.
|
||||
* @param deleteCount The number of elements to remove.
|
||||
* @param items Elements to insert into the array in place of the deleted elements.
|
||||
*/
|
||||
splice<T>(array: ArrayLike<T>, start: number, deleteCount?: number, ...items: T[]): T[];
|
||||
|
||||
/**
|
||||
* Inserts new elements at the start of an array.
|
||||
* @param items Elements to insert at the start of the Array.
|
||||
*/
|
||||
* Inserts new elements at the start of an array.
|
||||
* @param items Elements to insert at the start of the Array.
|
||||
*/
|
||||
unshift<T>(array: ArrayLike<T>, ...items: T[]): number;
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
|
||||
*/
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
|
||||
*/
|
||||
indexOf<T>(array: ArrayLike<T>, searchElement: T, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Returns the index of the last occurrence of a specified value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
|
||||
*/
|
||||
* Returns the index of the last occurrence of a specified value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
|
||||
*/
|
||||
lastIndexOf<T>(array: ArrayLike<T>, earchElement: T, fromIndex?: number): number;
|
||||
|
||||
/**
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments.
|
||||
* The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
* Determines whether all the members of an array satisfy the specified test.
|
||||
* @param callbackfn A function that accepts up to three arguments.
|
||||
* The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
every<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments.
|
||||
* The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
* Determines whether the specified callback function returns true for any element of an array.
|
||||
* @param callbackfn A function that accepts up to three arguments.
|
||||
* The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
some<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
|
||||
|
||||
/**
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
* Performs the specified action for each element in an array.
|
||||
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
forEach<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
|
||||
|
||||
/**
|
||||
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
|
||||
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
map<T, U>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
|
||||
|
||||
/**
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
* Returns the elements of an array that meet the condition specified in a callback function.
|
||||
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
|
||||
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
||||
*/
|
||||
filter<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
* Calls the specified callback function for all the elements in an array.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduce<T, U>(array: ArrayLike<T>, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
* Calls the specified callback function for all the elements in an array.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduce<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduceRight<T, U>(array: ArrayLike<T>, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
|
||||
|
||||
/**
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
* Calls the specified callback function for all the elements in an array, in descending order.
|
||||
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
|
||||
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
|
||||
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
|
||||
* The first call to the callbackfn function provides this value as an argument instead of an array value.
|
||||
*/
|
||||
reduceRight<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
|
||||
|
||||
/**
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
* Returns an array of key, value pairs for every entry in the array
|
||||
*/
|
||||
entries<T>(array: ArrayLike<T>): IterableIterator<[number, T]>;
|
||||
|
||||
/**
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
* Returns an list of keys in the array
|
||||
*/
|
||||
keys<T>(array: ArrayLike<T>): IterableIterator<number>;
|
||||
|
||||
/**
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
* Returns an list of values in the array
|
||||
*/
|
||||
values<T>(array: ArrayLike<T>): IterableIterator<T>;
|
||||
|
||||
/**
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
* Returns the value of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
find<T>(array: ArrayLike<T>, predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
* Returns the index of the first element in the array where predicate is true, and undefined
|
||||
* otherwise.
|
||||
* @param predicate find calls predicate once for each element of the array, in ascending
|
||||
* order, until it finds one where predicate returns true. If such an element is found, find
|
||||
* immediately returns that element value. Otherwise, find returns undefined.
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of
|
||||
* predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex<T>(array: ArrayLike<T>, predicate: (value: T) => boolean, thisArg?: any): number;
|
||||
|
||||
/**
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
* Returns the this object after filling the section identified by start and end with value
|
||||
* @param value value to fill array section with
|
||||
* @param start index to start filling the array at. If start is negative, it is treated as
|
||||
* length+start where length is the length of the array.
|
||||
* @param end index to stop filling the array at. If end is negative, it is treated as
|
||||
* length+end.
|
||||
*/
|
||||
fill<T>(array: ArrayLike<T>, value: T, start?: number, end?: number): T[];
|
||||
|
||||
/**
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
* Returns the this object after copying a section of the array identified by start and end
|
||||
* to the same array starting at position target
|
||||
* @param target If target is negative, it is treated as length+target where length is the
|
||||
* length of the array.
|
||||
* @param start If start is negative, it is treated as length+start. If end is negative, it
|
||||
* is treated as length+end.
|
||||
* @param end If not specified, length of the this object is used as its default value.
|
||||
*/
|
||||
copyWithin<T>(array: ArrayLike<T>, target: number, start: number, end?: number): T[];
|
||||
|
||||
includes<T>(array: ArrayLike<T>, value: T, fromIndex?: number): boolean;
|
||||
@@ -290,23 +290,23 @@ interface ArrayConstructor {
|
||||
|
||||
interface ObjectConstructor {
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
isObject(value: any): boolean;
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
classof(value: any): string;
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
define<T>(target: T, mixin: any): T;
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
make<T>(proto: T, mixin?: any): T;
|
||||
}
|
||||
|
||||
@@ -322,8 +322,8 @@ interface Log extends Console {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
declare var log: Log;
|
||||
|
||||
// #############################################################################################
|
||||
@@ -369,8 +369,8 @@ interface DictConstructor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
declare var Dict: DictConstructor;
|
||||
|
||||
// #############################################################################################
|
||||
@@ -380,8 +380,8 @@ declare var Dict: DictConstructor;
|
||||
|
||||
interface Function {
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
part(...args: any[]): any;
|
||||
}
|
||||
|
||||
@@ -392,13 +392,13 @@ interface Function {
|
||||
|
||||
interface Date {
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
format(template: string, locale?: string): string;
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
formatUTC(template: string, locale?: string): string;
|
||||
}
|
||||
|
||||
@@ -409,13 +409,13 @@ interface Date {
|
||||
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
turn<U>(callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U;
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
turn(callbackfn: (memo: T[], value: T, index: number, array: T[]) => void, memo?: T[]): T[];
|
||||
}
|
||||
|
||||
@@ -426,8 +426,8 @@ interface Array<T> {
|
||||
|
||||
interface Number {
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<number>;
|
||||
}
|
||||
|
||||
@@ -438,13 +438,13 @@ interface Number {
|
||||
|
||||
interface String {
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
escapeHTML(): string;
|
||||
|
||||
/**
|
||||
* Non-standard.
|
||||
*/
|
||||
* Non-standard.
|
||||
*/
|
||||
unescapeHTML(): string;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {
|
||||
console.log('files copied');
|
||||
});
|
||||
|
||||
|
||||
cpy('foo.js', 'destination', {
|
||||
rename: basename => `prefix-${basename}`
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+4
-1
@@ -4,4 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cpy;
|
||||
declare function cpy(src: string | string[], dest: string, opts?: { cwd?: string, parents?: boolean, rename?: (s: string) => string }): Promise<void>;
|
||||
declare function cpy(
|
||||
src: string | string[],
|
||||
dest: string,
|
||||
opts?: { cwd?: string, parents?: boolean, rename?(s: string): string }): Promise<void>;
|
||||
|
||||
@@ -7,7 +7,6 @@ const c = new Croppie(document.getElementById('item'), {
|
||||
enableOrientation: false,
|
||||
});
|
||||
|
||||
|
||||
c.bind({
|
||||
url: 'demo/demo-2.jpg',
|
||||
orientation: 4,
|
||||
|
||||
Vendored
-1
@@ -27,7 +27,6 @@ export default class Croppie {
|
||||
destroy(): void;
|
||||
}
|
||||
|
||||
|
||||
export type CropType = 'square' | 'circle';
|
||||
|
||||
export type Format = 'jpeg' | 'png' | 'webp';
|
||||
|
||||
Vendored
+3
-3
@@ -183,7 +183,7 @@ declare namespace csvtojson {
|
||||
* @param {string} str the string to convert
|
||||
* @return {Converter} returns this object for chaining
|
||||
*/
|
||||
fromString(str: string): this
|
||||
fromString(str: string): this;
|
||||
|
||||
/**
|
||||
* Reads in a CSV from a string.
|
||||
@@ -197,7 +197,7 @@ declare namespace csvtojson {
|
||||
* @param {string} filePath the path to the CSV file
|
||||
* @return {Converter} returns this object for chaining
|
||||
*/
|
||||
fromFile(filePath: string): this
|
||||
fromFile(filePath: string): this;
|
||||
|
||||
/**
|
||||
* Reads in a CSV from a file.
|
||||
@@ -211,7 +211,7 @@ declare namespace csvtojson {
|
||||
* @param {Stream} stream the stream
|
||||
* @return {Converter} returns this object for chaining
|
||||
*/
|
||||
fromStream(stream: NodeJS.ReadableStream): this
|
||||
fromStream(stream: NodeJS.ReadableStream): this;
|
||||
|
||||
/**
|
||||
* Reads in a CSV from a stream.
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
{
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -153,8 +153,8 @@ export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): n
|
||||
export const bisect: typeof bisectRight;
|
||||
|
||||
export interface Bisector<T, U> {
|
||||
left: (array: T[], x: U, lo?: number, hi?: number) => number;
|
||||
right: (array: T[], x: U, lo?: number, hi?: number) => number;
|
||||
left(array: T[], x: U, lo?: number, hi?: number): number;
|
||||
right(array: T[], x: U, lo?: number, hi?: number): number;
|
||||
}
|
||||
|
||||
export function bisector<T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>;
|
||||
|
||||
Vendored
+8
-8
@@ -61,10 +61,10 @@ export interface Axis<Domain> {
|
||||
(context: Selection<AxisContainerElement, any, any, any>): void;
|
||||
|
||||
/**
|
||||
* Render the axis to the given context.
|
||||
*
|
||||
* @param context A transition defined on SVG containers (either SVG or G elements).
|
||||
*/
|
||||
* Render the axis to the given context.
|
||||
*
|
||||
* @param context A transition defined on SVG containers (either SVG or G elements).
|
||||
*/
|
||||
(context: TransitionLike<AxisContainerElement, any>): void;
|
||||
|
||||
/**
|
||||
@@ -142,10 +142,10 @@ export interface Axis<Domain> {
|
||||
tickArguments(args: [AxisTimeInterval, string]): this;
|
||||
|
||||
/**
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* @param args An array with arguments suitable for the scale to be used for tick generation
|
||||
*/
|
||||
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
|
||||
*
|
||||
* @param args An array with arguments suitable for the scale to be used for tick generation
|
||||
*/
|
||||
tickArguments(args: any[]): this;
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,7 +55,6 @@ let circleDrag: d3Drag.DragBehavior<SVGCircleElement, CircleDatum, CircleDatum |
|
||||
// This drag behavior will use a custom subject accessor to set the subject of the drag event
|
||||
let circleCustomDrag: d3Drag.DragBehavior<SVGCircleElement, CircleDatum, CustomSubject | d3Drag.SubjectPosition>;
|
||||
|
||||
|
||||
// create new drag behavior ------------------------------------------
|
||||
|
||||
circleDrag = d3Drag.drag<SVGCircleElement, CircleDatum>(); // Use short form method
|
||||
@@ -99,7 +98,6 @@ filterFn = function(d) {
|
||||
|
||||
// chainable
|
||||
circleDrag = circleDrag.filter(function(d, i, group) {
|
||||
|
||||
return (d.color !== 'green' && this.r.baseVal.value < 10) ? !event.button : true; // 'this' is SVGCircleElement and d is CircleDatum
|
||||
});
|
||||
|
||||
@@ -192,10 +190,8 @@ const wrongSelection: Selection<HTMLDivElement, any, any, any> = select<HTMLDivE
|
||||
// Test Drag Event Interface
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
let e: d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CircleDatum | d3Drag.SubjectPosition> = event;
|
||||
|
||||
|
||||
circleDrag = e.target; // target return drag behavior
|
||||
|
||||
const type: string = e.type;
|
||||
@@ -224,7 +220,6 @@ handler = e.on('dragged');
|
||||
// fails, handler with wrong datum type
|
||||
// let wrongHandler4: ((this:SVGCircleElement, d:{test: number}, i: number, group: SVGCircleElement[] | NodeListOf<SVGCircleElement>)=> void) | undefined = e.on('dragged');
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Test dragDisable() and dragEnable()
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Vendored
-3
@@ -7,12 +7,10 @@
|
||||
|
||||
import { ArrayLike, Selection, ValueFn } from 'd3-selection';
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Shared Type Definitions and Interfaces
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* DraggedElementBaseType serves as an alias for the 'minimal' data type which can be selected
|
||||
* without 'd3-drag' (and related code in 'd3-selection') trying to use properties internally which would otherwise not
|
||||
@@ -20,7 +18,6 @@ import { ArrayLike, Selection, ValueFn } from 'd3-selection';
|
||||
*/
|
||||
export type DraggedElementBaseType = Element;
|
||||
|
||||
|
||||
/**
|
||||
* Container element type usable for mouse/touch functions
|
||||
*/
|
||||
|
||||
Vendored
+46
-46
@@ -4,11 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
|
||||
declare var loader: (
|
||||
/** the symbol used to seperate cells in the row.*/
|
||||
declare function loader(
|
||||
/** the symbol used to seperate cells in the row. */
|
||||
delimiter: string,
|
||||
/** example: "text/plain" */
|
||||
encoding?: string) => D3Dsv;
|
||||
encoding?: string): D3Dsv;
|
||||
|
||||
export = loader;
|
||||
export as namespace d3_dsv;
|
||||
@@ -16,21 +16,21 @@ export as namespace d3_dsv;
|
||||
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
|
||||
interface D3Dsv {
|
||||
/**
|
||||
Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows.
|
||||
The string is assumed to be RFC4180-compliant.
|
||||
Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names;
|
||||
these column names become the attributes on the returned objects.
|
||||
For example, consider the following CSV file:
|
||||
|
||||
Year,Make,Model,Length
|
||||
1997,Ford,E350,2.34
|
||||
2000,Mercury,Cougar,2.38
|
||||
|
||||
The resulting JavaScript array is:
|
||||
|
||||
[ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
|
||||
{"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ]
|
||||
*/
|
||||
* Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows.
|
||||
* The string is assumed to be RFC4180-compliant.
|
||||
* Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names;
|
||||
* these column names become the attributes on the returned objects.
|
||||
* For example, consider the following CSV file:
|
||||
*
|
||||
* Year,Make,Model,Length
|
||||
* 1997,Ford,E350,2.34
|
||||
* 2000,Mercury,Cougar,2.38
|
||||
*
|
||||
* The resulting JavaScript array is:
|
||||
*
|
||||
* [ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
|
||||
* {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ]
|
||||
*/
|
||||
parse<TRow>(
|
||||
table: string,
|
||||
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */
|
||||
@@ -38,42 +38,42 @@ interface D3Dsv {
|
||||
): TRow[];
|
||||
|
||||
/**
|
||||
Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows.
|
||||
The string is assumed to be RFC4180-compliant.
|
||||
Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header.
|
||||
Each row is represented as an array rather than an object.
|
||||
Rows may have variable length.
|
||||
For example, consider the following CSV file:
|
||||
|
||||
1997,Ford,E350,2.34
|
||||
2000,Mercury,Cougar,2.38
|
||||
The resulting JavaScript array is:
|
||||
|
||||
[ ["1997", "Ford", "E350", "2.34"],
|
||||
["2000", "Mercury", "Cougar", "2.38"] ]
|
||||
Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.
|
||||
*/
|
||||
* Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows.
|
||||
* The string is assumed to be RFC4180-compliant.
|
||||
* Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header.
|
||||
* Each row is represented as an array rather than an object.
|
||||
* Rows may have variable length.
|
||||
* For example, consider the following CSV file:
|
||||
*
|
||||
* 1997,Ford,E350,2.34
|
||||
* 2000,Mercury,Cougar,2.38
|
||||
* The resulting JavaScript array is:
|
||||
*
|
||||
* [ ["1997", "Ford", "E350", "2.34"],
|
||||
* ["2000", "Mercury", "Cougar", "2.38"] ]
|
||||
* Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.
|
||||
*/
|
||||
parseRows<TRow>(
|
||||
table: string,
|
||||
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/
|
||||
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */
|
||||
accessor?: (row: string[]) => TRow
|
||||
): TRow[];
|
||||
|
||||
/**
|
||||
Converts the specified array of rows into comma-separated values format, returning a string.
|
||||
This operation is the reverse of parse.
|
||||
Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
|
||||
Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
|
||||
|
||||
Each row should be an object, and all object properties will be converted into fields.
|
||||
For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows.
|
||||
*/
|
||||
* Converts the specified array of rows into comma-separated values format, returning a string.
|
||||
* This operation is the reverse of parse.
|
||||
* Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
|
||||
* Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
|
||||
*
|
||||
* Each row should be an object, and all object properties will be converted into fields.
|
||||
* For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows.
|
||||
*/
|
||||
format(rows: any[]): string;
|
||||
|
||||
/**
|
||||
Converts the specified array of rows into comma-separated values format, returning a string.
|
||||
This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
|
||||
Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
|
||||
*/
|
||||
* Converts the specified array of rows into comma-separated values format, returning a string.
|
||||
* This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
|
||||
* Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
|
||||
*/
|
||||
formatRows(rows: any[]): string;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ t_out = d3Ease.easeCubicIn(t_in);
|
||||
t_out = d3Ease.easeCubicOut(t_in);
|
||||
t_out = d3Ease.easeCubicInOut(t_in);
|
||||
|
||||
|
||||
let easePolyFactory: d3Ease.PolynomialEasingFactory;
|
||||
|
||||
easePolyFactory = d3Ease.easePoly;
|
||||
|
||||
Vendored
+17
-20
@@ -94,25 +94,24 @@ export interface PolynomialEasingFactory {
|
||||
* Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1].
|
||||
* If the exponent is not specified, it defaults to 3, equivalent to cubic.
|
||||
*/
|
||||
export var easePoly: PolynomialEasingFactory;
|
||||
export const easePoly: PolynomialEasingFactory;
|
||||
/**
|
||||
* Polynomial easing/easing factory; raises t to the specified exponent.
|
||||
* If the exponent is not specified, it defaults to 3, equivalent to cubicIn.
|
||||
*/
|
||||
export var easePolyIn: PolynomialEasingFactory;
|
||||
export const easePolyIn: PolynomialEasingFactory;
|
||||
|
||||
/**
|
||||
* Reverse polynomial easing/easing factory; equivalent to 1 - polyIn(1 - t).
|
||||
* If the exponent is not specified, it defaults to 3, equivalent to cubicOut.
|
||||
*/
|
||||
export var easePolyOut: PolynomialEasingFactory;
|
||||
export const easePolyOut: PolynomialEasingFactory;
|
||||
|
||||
/**
|
||||
* Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1].
|
||||
* If the exponent is not specified, it defaults to 3, equivalent to cubic.
|
||||
*/
|
||||
export var easePolyInOut: PolynomialEasingFactory;
|
||||
|
||||
export const easePolyInOut: PolynomialEasingFactory;
|
||||
|
||||
/**
|
||||
* Symmetric sinusoidal easing; scales sinIn for t in [0, 0.5] and sinOut for t in [0.5, 1].
|
||||
@@ -226,7 +225,6 @@ export function easeBounceOut(normalizedTime: number): number;
|
||||
*/
|
||||
export function easeBounceInOut(normalizedTime: number): number;
|
||||
|
||||
|
||||
/**
|
||||
* Anticipatory easing function factory
|
||||
*/
|
||||
@@ -249,26 +247,25 @@ export interface BackEasingFactory {
|
||||
* Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1].
|
||||
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
|
||||
*/
|
||||
export var easeBack: BackEasingFactory;
|
||||
export const easeBack: BackEasingFactory;
|
||||
|
||||
/**
|
||||
* Anticipatory easing, like a dancer bending his knees before jumping off the floor.
|
||||
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
|
||||
*/
|
||||
export var easeBackIn: BackEasingFactory;
|
||||
export const easeBackIn: BackEasingFactory;
|
||||
|
||||
/**
|
||||
* Reverse anticipatory easing; equivalent to 1 - backIn(1 - t).
|
||||
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
|
||||
*/
|
||||
export var easeBackOut: BackEasingFactory;
|
||||
export const easeBackOut: BackEasingFactory;
|
||||
|
||||
/**
|
||||
* Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1].
|
||||
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
|
||||
*/
|
||||
export var easeBackInOut: BackEasingFactory;
|
||||
|
||||
export const easeBackInOut: BackEasingFactory;
|
||||
|
||||
/**
|
||||
* Elastic easing function factory
|
||||
@@ -287,11 +284,11 @@ export interface ElasticEasingFactory {
|
||||
*/
|
||||
amplitude(a: number): ElasticEasingFactory;
|
||||
/**
|
||||
* Returns a new elastic easing with the specified amplitude a.
|
||||
* Defaults to 0.3,if not specified.
|
||||
*
|
||||
* @param p Period for elastic easing.
|
||||
*/
|
||||
* Returns a new elastic easing with the specified amplitude a.
|
||||
* Defaults to 0.3,if not specified.
|
||||
*
|
||||
* @param p Period for elastic easing.
|
||||
*/
|
||||
period(p: number): ElasticEasingFactory;
|
||||
}
|
||||
|
||||
@@ -300,25 +297,25 @@ export interface ElasticEasingFactory {
|
||||
* The amplitude and period of the oscillation are configurable;
|
||||
* if not specified, they default to 1 and 0.3, respectively.
|
||||
*/
|
||||
export var easeElastic: ElasticEasingFactory;
|
||||
export const easeElastic: ElasticEasingFactory;
|
||||
|
||||
/**
|
||||
* Elastic easing, like a rubber band.
|
||||
* The amplitude and period of the oscillation are configurable;
|
||||
* if not specified, they default to 1 and 0.3, respectively.
|
||||
*/
|
||||
export var easeElasticIn: ElasticEasingFactory;
|
||||
export const easeElasticIn: ElasticEasingFactory;
|
||||
|
||||
/**
|
||||
* Reverse elastic easing; equivalent to 1 - elasticIn(1 - t).
|
||||
* The amplitude and period of the oscillation are configurable;
|
||||
* if not specified, they default to 1 and 0.3, respectively.
|
||||
*/
|
||||
export var easeElasticOut: ElasticEasingFactory;
|
||||
export const easeElasticOut: ElasticEasingFactory;
|
||||
|
||||
/**
|
||||
* Symmetric elastic easing; scales elasticIn for t in [0, 0.5] and elasticOut for t in [0.5, 1].
|
||||
* The amplitude and period of the oscillation are configurable;
|
||||
* if not specified, they default to 1 and 0.3, respectively.
|
||||
*/
|
||||
export var easeElasticInOut: ElasticEasingFactory;
|
||||
export const easeElasticInOut: ElasticEasingFactory;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
* are not intended as functional tests.
|
||||
*/
|
||||
|
||||
|
||||
import * as d3Force from 'd3-force';
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@@ -30,7 +29,6 @@ interface Graph {
|
||||
links: SimLink[];
|
||||
}
|
||||
|
||||
|
||||
const graph: Graph = {
|
||||
nodes: [
|
||||
{ id: 'Myriel', group: 1, r: 5 },
|
||||
@@ -112,7 +110,6 @@ forceCollide = d3Force.forceCollide<SimNode>((node, index, nodes) => {
|
||||
return n.r;
|
||||
});
|
||||
|
||||
|
||||
// Configure Collision force -----------------------------------------------------------
|
||||
|
||||
let radiusAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number;
|
||||
@@ -139,7 +136,6 @@ num = forceCollide.strength();
|
||||
forceCollide = forceCollide.iterations(10);
|
||||
num = forceCollide.iterations();
|
||||
|
||||
|
||||
// Use Collision force -----------------------------------------------------------------
|
||||
|
||||
forceCollide.initialize(graph.nodes);
|
||||
@@ -157,7 +153,6 @@ forceLink = d3Force.forceLink<SimNode, SimLink>();
|
||||
// with link data
|
||||
forceLink = d3Force.forceLink<SimNode, SimLink>(graph.links);
|
||||
|
||||
|
||||
// Configure Link force -----------------------------------------------------------
|
||||
|
||||
let linkNumberAccessor: (link: SimLink, i: number, links: SimLink[]) => number;
|
||||
@@ -181,7 +176,6 @@ num = simLink.value;
|
||||
num = simLink.d;
|
||||
num = simLink.s;
|
||||
|
||||
|
||||
// id (node id accessor)
|
||||
|
||||
forceLink = forceLink.id((node, index, nodes) => {
|
||||
@@ -220,13 +214,11 @@ linkNumberAccessor = forceLink.strength();
|
||||
forceLink = forceLink.iterations(10);
|
||||
num = forceLink.iterations();
|
||||
|
||||
|
||||
// Use Link force -----------------------------------------------------------------
|
||||
|
||||
forceLink.initialize(graph.nodes);
|
||||
forceLink(0.1); // alpha
|
||||
|
||||
|
||||
// ManyBody ============================================================================
|
||||
|
||||
// create ManyBody force --------------------------------------------------------------
|
||||
@@ -255,7 +247,6 @@ simNodeNumberAccessor = forceCharge.strength();
|
||||
forceCharge = forceCharge.theta(0.8);
|
||||
num = forceCharge.theta();
|
||||
|
||||
|
||||
// distanceMin
|
||||
|
||||
forceCharge = forceCharge.distanceMin(1);
|
||||
@@ -266,13 +257,11 @@ num = forceCharge.distanceMin();
|
||||
forceCharge = forceCharge.distanceMax(1000);
|
||||
num = forceCharge.distanceMax();
|
||||
|
||||
|
||||
// Use ManyBody force -----------------------------------------------------------------
|
||||
|
||||
forceCharge.initialize(graph.nodes);
|
||||
forceCharge(0.1); // alpha
|
||||
|
||||
|
||||
// ForceX ==============================================================================
|
||||
|
||||
// create ForceX force --------------------------------------------------------------
|
||||
@@ -327,7 +316,6 @@ simNodeNumberAccessor = forcePosX.x();
|
||||
forcePosX.initialize(graph.nodes);
|
||||
forcePosX(0.1); // alpha
|
||||
|
||||
|
||||
// ForceY ==============================================================================
|
||||
|
||||
// create ForceY force --------------------------------------------------------------
|
||||
@@ -388,7 +376,6 @@ forcePosY(0.1); // alpha
|
||||
|
||||
// Create Force Simulation =============================================================
|
||||
|
||||
|
||||
let nodeSimulation: d3Force.Simulation<SimNode, undefined>;
|
||||
let nodeLinkSimulation: d3Force.Simulation<SimNode, SimLink>;
|
||||
|
||||
@@ -435,7 +422,6 @@ num = nodeLinkSimulation.alphaTarget();
|
||||
nodeLinkSimulation = nodeLinkSimulation.velocityDecay(0.4);
|
||||
num = nodeLinkSimulation.velocityDecay();
|
||||
|
||||
|
||||
// force() -----------------------------------------------------------------------------
|
||||
|
||||
nodeSimulation = nodeSimulation.force('posx', forcePosX);
|
||||
@@ -444,7 +430,6 @@ nodeSimulation.force('posy', forcePosY);
|
||||
// Remove force
|
||||
nodeSimulation = nodeSimulation.force('posx', null);
|
||||
|
||||
|
||||
nodeLinkSimulation = nodeLinkSimulation.force('link', forceLink);
|
||||
|
||||
nodeLinkSimulation
|
||||
@@ -480,7 +465,6 @@ simLinks = nodeLinkSimulation.force<d3Force.ForceLink<SimNode, SimLink>>('link')
|
||||
|
||||
// fLink = nodeLinkSimulation.force('link')!; // fails, as ForceLink specific properties are missing from 'generic' force
|
||||
|
||||
|
||||
// on() --------------------------------------------------------------------------------
|
||||
|
||||
function drawLink(d: SimLink) {
|
||||
@@ -502,7 +486,6 @@ function drawNode(d: SimNode) {
|
||||
}
|
||||
|
||||
nodeLinkSimulation = nodeLinkSimulation.on('tick', function ticked() {
|
||||
|
||||
const that: d3Force.Simulation<SimNode, SimLink> = this;
|
||||
|
||||
if (context) {
|
||||
|
||||
Vendored
-3
@@ -3,7 +3,6 @@
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
// Last module patch version validated against: 1.0.4
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -356,7 +355,6 @@ export interface Force<NodeDatum extends SimulationNodeDatum, LinkDatum extends
|
||||
initialize?(nodes: NodeDatum[]): void;
|
||||
}
|
||||
|
||||
|
||||
// Centering ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -668,7 +666,6 @@ export interface ForceLink<NodeDatum extends SimulationNodeDatum, LinkDatum exte
|
||||
* @param iterations Number of iterations.
|
||||
*/
|
||||
iterations(iterations: number): this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -597,7 +597,7 @@ const context: d3Geo.GeoContext = {
|
||||
|
||||
// geoTransform(...) ====================================================
|
||||
|
||||
const transformFunction: { stream: (s: d3Geo.GeoStream) => {} } = d3Geo.geoTransform({});
|
||||
const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({});
|
||||
|
||||
interface CustomTranformProto extends d3Geo.GeoTransformPrototype {
|
||||
a: number;
|
||||
@@ -612,7 +612,7 @@ customTransformProto = {
|
||||
a: 10
|
||||
};
|
||||
|
||||
const t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto);
|
||||
const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto);
|
||||
|
||||
// geoIdentity() ========================================================
|
||||
|
||||
|
||||
Vendored
+33
-33
@@ -699,14 +699,14 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent.
|
||||
@@ -719,14 +719,14 @@ export interface GeoProjection extends GeoStreamWrapper {
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
|
||||
/**
|
||||
@@ -1340,7 +1340,7 @@ export interface GeoTransformPrototype {
|
||||
*
|
||||
* @param methods An object with custom method implementations, which are used to create a transform projection.
|
||||
*/
|
||||
export function geoTransform<T extends GeoTransformPrototype>(methods: T): { stream: (s: GeoStream) => (T & GeoStream) };
|
||||
export function geoTransform<T extends GeoTransformPrototype>(methods: T): { stream(s: GeoStream): T & GeoStream };
|
||||
|
||||
// geoIdentity() =================================================================
|
||||
|
||||
@@ -1382,14 +1382,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature<GeoGeometryObjects, any>): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
* Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent.
|
||||
@@ -1402,14 +1402,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this;
|
||||
/**
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
* Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
|
||||
* Returns the projection.
|
||||
*
|
||||
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
|
||||
*
|
||||
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
|
||||
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
|
||||
*/
|
||||
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
|
||||
|
||||
/**
|
||||
|
||||
@@ -92,7 +92,6 @@ linearScaleNumString = linearScaleNumString.domain(domainNumeric);
|
||||
linearScaleNumString = linearScaleNumString.domain(domainNumbers);
|
||||
domainNumbers = linearScaleNumString.domain();
|
||||
|
||||
|
||||
// range(...) -----------------------------------------------------------------
|
||||
|
||||
linearScaleNumber = linearScaleNumber.range(rangeNumbers);
|
||||
@@ -138,7 +137,6 @@ linearScaleNumString = linearScaleNumber.interpolate((a, b) => {
|
||||
|
||||
// nice(...) -----------------------------------------------------------------------
|
||||
|
||||
|
||||
// chainable
|
||||
linearScaleNumber = linearScaleNumber.nice();
|
||||
linearScaleNumber = linearScaleNumber.nice(5);
|
||||
@@ -180,7 +178,6 @@ powerScaleNumber = d3Scale.scalePow();
|
||||
powerScaleString = d3Scale.scalePow<string>();
|
||||
powerScaleNumString = d3Scale.scalePow<number, string>();
|
||||
|
||||
|
||||
let squarerootScaleNumber: d3Scale.ScalePower<number, number>;
|
||||
let squarerootScaleString: d3Scale.ScalePower<string, string>;
|
||||
let squarerootScaleNumString: d3Scale.ScalePower<number, string>;
|
||||
@@ -211,7 +208,6 @@ powerScaleNumString = powerScaleNumString.domain(domainNumeric);
|
||||
powerScaleNumString = powerScaleNumString.domain(domainNumbers);
|
||||
domainNumbers = powerScaleNumString.domain();
|
||||
|
||||
|
||||
// range(...) -----------------------------------------------------------------
|
||||
|
||||
powerScaleNumber = powerScaleNumber.range(rangeNumbers);
|
||||
@@ -282,7 +278,6 @@ const copiedPowerScale: d3Scale.ScalePower<number, string> = powerScaleNumString
|
||||
// Logarithmic Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// scaleLog() ---------------------------------------------------------------------
|
||||
|
||||
let logScaleNumber: d3Scale.ScaleLogarithmic<number, number>;
|
||||
@@ -293,7 +288,6 @@ logScaleNumber = d3Scale.scaleLog();
|
||||
logScaleString = d3Scale.scaleLog<string>();
|
||||
logScaleNumString = d3Scale.scaleLog<number, string>();
|
||||
|
||||
|
||||
// ScaleLogarithmic Interface ========================================================
|
||||
|
||||
// base --------------------------------------------------------------------
|
||||
@@ -316,7 +310,6 @@ logScaleNumString = logScaleNumString.domain(domainNumeric);
|
||||
logScaleNumString = logScaleNumString.domain(domainNumbers);
|
||||
domainNumbers = logScaleNumString.domain();
|
||||
|
||||
|
||||
// range(...) -----------------------------------------------------------------
|
||||
|
||||
logScaleNumber = logScaleNumber.range(rangeNumbers);
|
||||
@@ -393,10 +386,8 @@ let identityScale: d3Scale.ScaleIdentity;
|
||||
|
||||
identityScale = d3Scale.scaleIdentity();
|
||||
|
||||
|
||||
// ScaleIdentity Interface ========================================================
|
||||
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
|
||||
identityScale = identityScale.domain(domainNumeric);
|
||||
@@ -434,12 +425,10 @@ tickFormatNumberFn = identityScale.tickFormat(5, '+%');
|
||||
|
||||
outputNumber = identityScale(10);
|
||||
|
||||
|
||||
// copy(...) -----------------------------------------------------------------
|
||||
|
||||
const copiedIdentityScale: d3Scale.ScaleIdentity = identityScale.copy();
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Time Scale Factories
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -454,7 +443,6 @@ localTimeScaleNumber = d3Scale.scaleTime();
|
||||
localTimeScaleString = d3Scale.scaleTime<string>();
|
||||
localTimeScaleNumString = d3Scale.scaleTime<number, string>();
|
||||
|
||||
|
||||
let utcScaleNumber: d3Scale.ScaleTime<number, number>;
|
||||
let utcScaleString: d3Scale.ScaleTime<string, string>;
|
||||
let utcScaleNumString: d3Scale.ScaleTime<number, string>;
|
||||
@@ -475,7 +463,6 @@ domainDates = localTimeScaleString.domain();
|
||||
localTimeScaleNumString = localTimeScaleNumString.domain(domainDates);
|
||||
domainDates = localTimeScaleNumString.domain();
|
||||
|
||||
|
||||
// range(...) -----------------------------------------------------------------
|
||||
|
||||
localTimeScaleNumber = localTimeScaleNumber.range(rangeNumbers);
|
||||
@@ -534,7 +521,6 @@ if (timeInterval !== null) {
|
||||
ticksDates = localTimeScaleNumString.ticks(timeInterval);
|
||||
}
|
||||
|
||||
|
||||
// tickFormat(...) -----------------------------------------------------------------
|
||||
|
||||
tickFormatDateFn = localTimeScaleNumber.tickFormat();
|
||||
@@ -543,7 +529,6 @@ if (timeInterval !== null) {
|
||||
tickFormatDateFn = localTimeScaleNumber.tickFormat(timeInterval, '%I %p');
|
||||
}
|
||||
|
||||
|
||||
// (...) value mapping from domain to output -----------------------------------
|
||||
|
||||
outputNumber = localTimeScaleNumber(new Date(2016, 6, 4));
|
||||
@@ -595,8 +580,6 @@ outputString = sequentialScaleColorString(10);
|
||||
|
||||
const copiedSequentialScale: d3Scale.ScaleSequential<string> = sequentialScaleColorString.copy();
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Color Interpolators for Sequential Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -619,7 +602,6 @@ colorInterpolator = d3Scale.interpolateCool;
|
||||
|
||||
colorInterpolator = d3Scale.interpolateCubehelixDefault;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Quantize Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -632,7 +614,6 @@ let quantizeScaleString: d3Scale.ScaleQuantize<string>;
|
||||
quantizeScaleNumber = d3Scale.scaleQuantize();
|
||||
quantizeScaleString = d3Scale.scaleQuantize<string>();
|
||||
|
||||
|
||||
// ScaleQuantize Interface ========================================================
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
@@ -649,7 +630,6 @@ rangeNumbers = quantizeScaleNumber.range();
|
||||
quantizeScaleString = quantizeScaleString.range(['steelblue', 'brown']);
|
||||
rangeStrings = quantizeScaleString.range();
|
||||
|
||||
|
||||
// invertExtent(...) -----------------------------------------------------------------
|
||||
|
||||
numExtent = quantizeScaleNumber.invertExtent(500);
|
||||
@@ -681,12 +661,10 @@ outputNumber = quantizeScaleNumber(0.51);
|
||||
|
||||
const copiedQuantizeScale: d3Scale.ScaleQuantize<number> = quantizeScaleNumber.copy();
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Quantile Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// scaleQuantile() -----------------------------------------------------------------
|
||||
|
||||
let quantileScaleNumber: d3Scale.ScaleQuantile<number>;
|
||||
@@ -695,7 +673,6 @@ let quantileScaleString: d3Scale.ScaleQuantile<string>;
|
||||
quantileScaleNumber = d3Scale.scaleQuantile();
|
||||
quantileScaleString = d3Scale.scaleQuantile<string>();
|
||||
|
||||
|
||||
// ScaleQuantile Interface ========================================================
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
@@ -714,7 +691,6 @@ rangeNumbers = quantileScaleNumber.range();
|
||||
quantileScaleString = quantileScaleString.range(['q25', 'q50', 'q75']);
|
||||
rangeStrings = quantileScaleString.range();
|
||||
|
||||
|
||||
// invertExtent(...) -----------------------------------------------------------------
|
||||
|
||||
numExtent = quantileScaleNumber.invertExtent(2);
|
||||
@@ -733,7 +709,6 @@ outputNumber = quantileScaleNumber(0.51);
|
||||
|
||||
const copiedQuantileScale: d3Scale.ScaleQuantile<number> = quantileScaleNumber.copy();
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Threshold Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -746,7 +721,6 @@ let thresholdScaleNumberString: d3Scale.ScaleThreshold<number, string>;
|
||||
thresholdScaleNumberNumber = d3Scale.scaleThreshold();
|
||||
thresholdScaleNumberString = d3Scale.scaleThreshold<number, string>();
|
||||
|
||||
|
||||
// ScaleThreshold Interface ========================================================
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
@@ -764,7 +738,6 @@ rangeNumbers = thresholdScaleNumberNumber.range();
|
||||
thresholdScaleNumberString = thresholdScaleNumberString.range(['steelblue', 'seagreen', 'brown']);
|
||||
rangeStrings = thresholdScaleNumberString.range();
|
||||
|
||||
|
||||
// invertExtent(...) -----------------------------------------------------------------
|
||||
|
||||
numOrUndefinedExtent = thresholdScaleNumberNumber.invertExtent(100);
|
||||
@@ -781,7 +754,6 @@ outputString = thresholdScaleNumberString(0.9);
|
||||
|
||||
const copiedThresholdScale: d3Scale.ScaleThreshold<number, string> = thresholdScaleNumberString.copy();
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Ordinal Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -794,7 +766,6 @@ let ordinalScaleStringNumber: d3Scale.ScaleOrdinal<string, number>;
|
||||
ordinalScaleStringString = d3Scale.scaleOrdinal<string>();
|
||||
ordinalScaleStringNumber = d3Scale.scaleOrdinal<string, number>();
|
||||
|
||||
|
||||
// ScaleOrdinal Interface ========================================================
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
@@ -812,7 +783,6 @@ rangeStrings = ordinalScaleStringString.range();
|
||||
ordinalScaleStringNumber = ordinalScaleStringNumber.range([-1, 0, 1]);
|
||||
rangeNumbers = ordinalScaleStringNumber.range();
|
||||
|
||||
|
||||
// unknown(...) and d3Scale.scaleImplicit --------------------------------------
|
||||
|
||||
const implicit: { name: 'implicit' } = d3Scale.scaleImplicit;
|
||||
@@ -839,7 +809,6 @@ outputNumber = ordinalScaleStringNumber('negative');
|
||||
|
||||
const copiedOrdinalScale: d3Scale.ScaleOrdinal<string, number> = ordinalScaleStringNumber.copy();
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Band Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -852,7 +821,6 @@ let bandScaleCoercible: d3Scale.ScaleBand<StringCoercible>;
|
||||
bandScaleString = d3Scale.scaleBand();
|
||||
bandScaleCoercible = d3Scale.scaleBand<StringCoercible>();
|
||||
|
||||
|
||||
// ScaleBand Interface ========================================================
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
@@ -870,12 +838,10 @@ let rangeExtent: [number, number] = bandScaleString.range();
|
||||
bandScaleCoercible = bandScaleCoercible.range([0, 300]);
|
||||
rangeExtent = bandScaleCoercible.range();
|
||||
|
||||
|
||||
// rangeRound(...) -----------------------------------------------------------------
|
||||
|
||||
bandScaleString = bandScaleString.rangeRound([0, 300]);
|
||||
|
||||
|
||||
// round(...) -----------------------------------------------------------------
|
||||
|
||||
bandScaleCoercible = bandScaleCoercible.round(true);
|
||||
@@ -891,7 +857,6 @@ num = bandScaleString.paddingInner();
|
||||
bandScaleString = bandScaleString.paddingOuter(0.1);
|
||||
num = bandScaleString.paddingOuter();
|
||||
|
||||
|
||||
// padding(...) -----------------------------------------------------------------
|
||||
|
||||
bandScaleString = bandScaleString.padding(0.1);
|
||||
@@ -910,7 +875,6 @@ num = bandScaleString.bandwidth();
|
||||
|
||||
num = bandScaleString.step();
|
||||
|
||||
|
||||
// (...) value mapping from domain to output -----------------------------------
|
||||
|
||||
outputNumberMaybe = bandScaleString('neutral');
|
||||
@@ -921,7 +885,6 @@ outputNumberMaybe = bandScaleCoercible(new StringCoercible('negative'));
|
||||
|
||||
const copiedBandScale: d3Scale.ScaleBand<StringCoercible> = bandScaleCoercible.copy();
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Point Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -934,7 +897,6 @@ let pointScaleCoercible: d3Scale.ScalePoint<StringCoercible>;
|
||||
pointScaleString = d3Scale.scalePoint();
|
||||
pointScaleCoercible = d3Scale.scalePoint<StringCoercible>();
|
||||
|
||||
|
||||
// ScalePoint Interface ========================================================
|
||||
|
||||
// domain(...) -----------------------------------------------------------------
|
||||
@@ -952,18 +914,15 @@ rangeExtent = pointScaleString.range();
|
||||
pointScaleCoercible = pointScaleCoercible.range([0, 300]);
|
||||
rangeExtent = pointScaleCoercible.range();
|
||||
|
||||
|
||||
// rangeRound(...) -----------------------------------------------------------------
|
||||
|
||||
pointScaleString = pointScaleString.rangeRound([0, 300]);
|
||||
|
||||
|
||||
// round(...) -----------------------------------------------------------------
|
||||
|
||||
pointScaleCoercible = pointScaleCoercible.round(true);
|
||||
roundingFlag = pointScaleCoercible.round();
|
||||
|
||||
|
||||
// padding(...) -----------------------------------------------------------------
|
||||
|
||||
pointScaleString = pointScaleString.padding(0.1);
|
||||
|
||||
Vendored
+31
-44
@@ -33,16 +33,15 @@ export interface InterpolatorFactory<T, U> {
|
||||
* A helper interface for a continuous scale defined over a numeric domain.
|
||||
*/
|
||||
export interface ScaleContinuousNumeric<Range, Output> {
|
||||
|
||||
/**
|
||||
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
|
||||
*
|
||||
* @param value A numeric value from the domain.
|
||||
*/
|
||||
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
|
||||
*
|
||||
* @param value A numeric value from the domain.
|
||||
*/
|
||||
(value: number | { valueOf(): number }): Output;
|
||||
|
||||
/**
|
||||
@@ -163,7 +162,6 @@ export interface ScaleContinuousNumeric<Range, Output> {
|
||||
* Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.
|
||||
*/
|
||||
copy(): this;
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -188,7 +186,6 @@ export interface ScaleContinuousNumeric<Range, Output> {
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
|
||||
/**
|
||||
* Returns the scale’s current interpolator factory, which defaults to interpolate.
|
||||
*/
|
||||
@@ -222,7 +219,6 @@ export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range
|
||||
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
|
||||
*/
|
||||
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLinear<Range, NewOutput>;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -281,7 +277,6 @@ export function scaleLinear<Range, Output>(): ScaleLinear<Range, Output>;
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
|
||||
/**
|
||||
* Returns the scale’s current interpolator factory, which defaults to interpolate.
|
||||
*/
|
||||
@@ -428,7 +423,6 @@ export function scaleSqrt<Range, Output>(): ScalePower<Range, Output>;
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
|
||||
|
||||
/**
|
||||
* Returns a copy of the scale’s current domain.
|
||||
*/
|
||||
@@ -578,16 +572,15 @@ export function scaleLog<Range, Output>(): ScaleLogarithmic<Range, Output>;
|
||||
* These scales are occasionally useful when working with pixel coordinates, say in conjunction with an axis or brush.
|
||||
*/
|
||||
export interface ScaleIdentity {
|
||||
|
||||
/**
|
||||
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
|
||||
*
|
||||
* @param value A numeric value from the domain.
|
||||
*/
|
||||
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
|
||||
*
|
||||
* @param value A numeric value from the domain.
|
||||
*/
|
||||
(value: number | { valueOf(): number }): number;
|
||||
|
||||
/**
|
||||
@@ -688,7 +681,6 @@ export interface ScaleIdentity {
|
||||
*/
|
||||
export function scaleIdentity(): ScaleIdentity;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Time Scale Factories
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -710,16 +702,15 @@ export function scaleIdentity(): ScaleIdentity;
|
||||
* convert the interpolated range element to a corresponding output element.
|
||||
*/
|
||||
export interface ScaleTime<Range, Output> {
|
||||
|
||||
/**
|
||||
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
|
||||
*
|
||||
* @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date.
|
||||
*/
|
||||
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
|
||||
*
|
||||
* @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date.
|
||||
*/
|
||||
(value: Date | number | { valueOf(): number }): Output;
|
||||
|
||||
/**
|
||||
@@ -1022,14 +1013,13 @@ export function scaleUtc<Range, Output>(): ScaleTime<Range, Output>;
|
||||
* The generic corresponds to the data type of the output of the interpolator underlying the scale.
|
||||
*/
|
||||
export interface ScaleSequential<Output> {
|
||||
|
||||
/**
|
||||
* Given a value from the domain, returns the corresponding value from the output range, subject to interpolation.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* @param value A numeric value from the domain.
|
||||
*/
|
||||
* Given a value from the domain, returns the corresponding value from the output range, subject to interpolation.
|
||||
*
|
||||
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
|
||||
*
|
||||
* @param value A numeric value from the domain.
|
||||
*/
|
||||
(value: number | { valueOf(): number }): Output;
|
||||
|
||||
/**
|
||||
@@ -1209,7 +1199,7 @@ export interface ScaleQuantize<Range> {
|
||||
*/
|
||||
range(range: Range[]): this;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns approximately count representative values from the scale’s domain.
|
||||
*
|
||||
* If count is not specified, it defaults to 10.
|
||||
@@ -1282,7 +1272,6 @@ export function scaleQuantize<Range>(): ScaleQuantize<Range>;
|
||||
* The generic correponds to the data type of range elements.
|
||||
*/
|
||||
export interface ScaleQuantile<Range> {
|
||||
|
||||
/**
|
||||
* Given a value in the input domain, returns the corresponding value in the output range.
|
||||
*
|
||||
@@ -1542,7 +1531,6 @@ export function scaleOrdinal<Domain extends { toString(): string }, Range>(range
|
||||
*/
|
||||
export const scaleImplicit: { name: 'implicit' };
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Band Scale Factory
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -1828,7 +1816,6 @@ export function scalePoint(): ScalePoint<string>;
|
||||
*/
|
||||
export function scalePoint<Domain extends { toString(): string }>(): ScalePoint<Domain>;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
// Categorical Color Schemas for Ordinal Scales
|
||||
// -------------------------------------------------------------------------------
|
||||
|
||||
Vendored
+11
-11
@@ -552,17 +552,17 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
|
||||
*/
|
||||
filter(selector: string): Selection<GElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* Filters the selection, returning a new selection that contains only the elements for
|
||||
* which the specified filter is true.
|
||||
*
|
||||
* The returned filtered selection preserves the parents of this selection, but like array.filter,
|
||||
* it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
||||
*
|
||||
* The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
|
||||
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
|
||||
*
|
||||
* @param selector A CSS selector string to match when filtering.
|
||||
*/
|
||||
* Filters the selection, returning a new selection that contains only the elements for
|
||||
* which the specified filter is true.
|
||||
*
|
||||
* The returned filtered selection preserves the parents of this selection, but like array.filter,
|
||||
* it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
|
||||
*
|
||||
* The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
|
||||
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
|
||||
*
|
||||
* @param selector A CSS selector string to match when filtering.
|
||||
*/
|
||||
filter<FilteredElement extends BaseType>(selector: string): Selection<FilteredElement, Datum, PElement, PDatum>;
|
||||
/**
|
||||
* Filter the selection, returning a new selection that contains only the elements for
|
||||
|
||||
Vendored
+3
-3
@@ -1990,14 +1990,14 @@ export interface Symbol<This, Datum> {
|
||||
/**
|
||||
* Constructs a new symbol generator with the default settings.
|
||||
*/
|
||||
export function symbol(): Symbol<any, any>;
|
||||
export function symbol(): Symbol<any, any>; // tslint:disable-line ban-types
|
||||
|
||||
/**
|
||||
* Constructs a new symbol generator with the default settings.
|
||||
*
|
||||
* The generic corrsponds to the data type of the datum underlying the symbol.
|
||||
*/
|
||||
export function symbol<Datum>(): Symbol<any, Datum>;
|
||||
export function symbol<Datum>(): Symbol<any, Datum>; // tslint:disable-line ban-types
|
||||
|
||||
/**
|
||||
* Constructs a new symbol generator with the default settings.
|
||||
@@ -2005,7 +2005,7 @@ export function symbol<Datum>(): Symbol<any, Datum>;
|
||||
* The first generic corresponds to the "this" context within which the symbol generator is invoked.
|
||||
* The second generic corrsponds to the data type of the datum underlying the symbol.
|
||||
*/
|
||||
export function symbol<This, Datum>(): Symbol<This, Datum>;
|
||||
export function symbol<This, Datum>(): Symbol<This, Datum>; // tslint:disable-line ban-types
|
||||
|
||||
/**
|
||||
* An array containing the set of all built-in symbol types: circle, cross, diamond, square, star, triangle, and wye.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import del = require("del");
|
||||
|
||||
var paths = ["build", "dist/**/*.js"];
|
||||
let paths = ["build", "dist/**/*.js"];
|
||||
|
||||
del(["tmp/*.js", "!tmp/unicorn.js"]);
|
||||
|
||||
@@ -26,7 +26,6 @@ del("tmp/*.js", {force: true}).then((paths: string[]) => {
|
||||
console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||
});
|
||||
|
||||
var paths: string[];
|
||||
paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"]);
|
||||
|
||||
paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true});
|
||||
|
||||
@@ -55,4 +55,4 @@ docker.createContainer({ Tty: true }, (err, container) => {
|
||||
container.start((err, data) => {
|
||||
// NOOP
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
-1
@@ -8,7 +8,6 @@
|
||||
import * as stream from 'stream';
|
||||
import * as events from 'events';
|
||||
|
||||
|
||||
declare namespace Dockerode {
|
||||
interface Container {
|
||||
inspect(options: {}, callback: Callback<ContainerInspectInfo>): void;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Dragster = require("dragster");
|
||||
|
||||
var dropzone = document.getElementById("my-dropzone") as HTMLElement;
|
||||
var dragster = new Dragster(dropzone);
|
||||
const dropzone = document.getElementById("my-dropzone") as HTMLElement;
|
||||
const dragster = new Dragster(dropzone);
|
||||
|
||||
dragster.removeListeners();
|
||||
dragster.reset();
|
||||
dragster.reset();
|
||||
|
||||
Vendored
+1
-1
@@ -20,4 +20,4 @@ declare var Dragster: Dragster.DragsterStatic;
|
||||
export = Dragster;
|
||||
|
||||
// Support as a global
|
||||
export as namespace Dragster;
|
||||
export as namespace Dragster;
|
||||
|
||||
@@ -4,8 +4,7 @@ import crypto = require('crypto');
|
||||
import BigInteger = require('bigi');
|
||||
import cs = require('coinstring');
|
||||
|
||||
|
||||
var ecparams = ecurve.getCurveByName('secp256k1');
|
||||
let ecparams = ecurve.getCurveByName('secp256k1');
|
||||
console.log(ecparams.n.toString(16));
|
||||
// => fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141
|
||||
console.log(ecparams.G.getEncoded().toString('hex')); // getEncoded() returns type 'Buffer' instead of 'BigInteger'
|
||||
@@ -13,15 +12,14 @@ console.log(ecparams.G.getEncoded().toString('hex')); // getEncoded() returns ty
|
||||
console.log(ecparams.h.toString(16));
|
||||
// => 1
|
||||
|
||||
const privateKey = new Buffer("1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd", 'hex');
|
||||
|
||||
var privateKey = new Buffer("1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd", 'hex');
|
||||
ecparams = ecurve.getCurveByName('secp256k1');
|
||||
const curvePt = ecparams.G.multiply(BigInteger.fromBuffer(privateKey));
|
||||
const x = curvePt.affineX.toBuffer(32);
|
||||
const y = curvePt.affineY.toBuffer(32);
|
||||
|
||||
var ecparams = ecurve.getCurveByName('secp256k1');
|
||||
var curvePt = ecparams.G.multiply(BigInteger.fromBuffer(privateKey));
|
||||
var x = curvePt.affineX.toBuffer(32);
|
||||
var y = curvePt.affineY.toBuffer(32);
|
||||
|
||||
var publicKey = Buffer.concat([new Buffer([0x04]), x, y]);
|
||||
let publicKey = Buffer.concat([new Buffer([0x04]), x, y]);
|
||||
console.log(publicKey.toString('hex'));
|
||||
// => 04d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6fbdd594388756a7beaf73b4822bc22d36e9bda7db82df2b8b623673eefc0b7495
|
||||
|
||||
@@ -35,8 +33,8 @@ publicKey = curvePt.getEncoded(true); // true forces compressed public key
|
||||
console.log(publicKey.toString('hex'));
|
||||
// => 03d0988bfa799f7d7ef9ab3de97ef481cd0f75d2367ad456607647edde665d6f6f
|
||||
|
||||
var sha = crypto.createHash('sha256').update(publicKey).digest();
|
||||
var pubkeyHash = crypto.createHash('rmd160').update(sha).digest();
|
||||
const sha = crypto.createHash('sha256').update(publicKey).digest();
|
||||
const pubkeyHash = crypto.createHash('rmd160').update(sha).digest();
|
||||
|
||||
// pubkeyHash of compressed public key
|
||||
console.log(pubkeyHash.toString('hex'));
|
||||
@@ -50,4 +48,4 @@ console.log(cs.encode(privateKey, 0x80)); // <--- 0x80 is for private addresses
|
||||
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
|
||||
|
||||
console.log(cs.encode(Buffer.concat([privateKey, new Buffer([0])]), 0x80)); // <-- compressed private address
|
||||
// => KwomKti1X3tYJUUMb1TGSM2mrZk1wb1aHisUNHCQXTZq5aqzCxDY
|
||||
// => KwomKti1X3tYJUUMb1TGSM2mrZk1wb1aHisUNHCQXTZq5aqzCxDY
|
||||
|
||||
@@ -32,7 +32,8 @@ describe('createSpy', () => {
|
||||
});
|
||||
|
||||
describe('A spy', () => {
|
||||
let targetContext: any, targetArguments: any;
|
||||
let targetContext: any;
|
||||
let targetArguments: any;
|
||||
const target = {
|
||||
method() {
|
||||
targetContext = this;
|
||||
@@ -88,7 +89,8 @@ describe('A spy', () => {
|
||||
});
|
||||
|
||||
describe('that calls some other function', () => {
|
||||
let otherContext: any, otherArguments: any;
|
||||
let otherContext: any;
|
||||
let otherArguments: any;
|
||||
function otherFn() {
|
||||
otherContext = this;
|
||||
otherArguments = Array.prototype.slice.call(arguments, 0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import F1 = require("f1");
|
||||
var ui = F1();
|
||||
const ui = F1();
|
||||
|
||||
ui.states({
|
||||
out: {
|
||||
@@ -23,8 +23,6 @@ ui.states({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
ui.transitions( [
|
||||
{ from: 'idle', to: 'rollOver', animation: { duration: 0.25 } },
|
||||
{ from: 'rollOver', to: 'idle', animation: { duration: 0.1 } }
|
||||
|
||||
Vendored
+2
-2
@@ -6,8 +6,8 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
interface F1Options {
|
||||
onState?: (...args: any[]) => void;
|
||||
onUpdate?: (...args: any[]) => void;
|
||||
onState?(...args: any[]): void;
|
||||
onUpdate?(...args: any[]): void;
|
||||
|
||||
name: string;
|
||||
|
||||
|
||||
Vendored
+33
-33
@@ -39,21 +39,21 @@ export {
|
||||
* Every DataSource is associated with a single JSON Graph object.
|
||||
* Models execute JSON Graph operations (get, set, and call) to retrieve values from the DataSource’s JSON Graph object.
|
||||
* DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.
|
||||
**/
|
||||
*/
|
||||
export abstract class DataSource {
|
||||
/**
|
||||
* The get method retrieves values from the DataSource's associated JSONGraph object.
|
||||
**/
|
||||
*/
|
||||
get(pathSets: PathSet[]): Observable<JSONGraphEnvelope>;
|
||||
|
||||
/**
|
||||
* The set method accepts values to set in the DataSource's associated JSONGraph object.
|
||||
**/
|
||||
*/
|
||||
set(jsonGraphEnvelope: JSONGraphEnvelope): Observable<JSONGraphEnvelope>;
|
||||
|
||||
/**
|
||||
* Invokes a function in the DataSource's JSONGraph object.
|
||||
**/
|
||||
*/
|
||||
call(functionPath: Path, args?: any[], refSuffixes?: PathSet[], thisPaths?: PathSet[]): Observable<JSONGraphEnvelope>;
|
||||
}
|
||||
|
||||
@@ -73,30 +73,30 @@ interface ModelOptions {
|
||||
|
||||
/**
|
||||
* This callback is invoked when the Model's cache is changed.
|
||||
**/
|
||||
*/
|
||||
type ModelOnChange = () => void;
|
||||
|
||||
/**
|
||||
* This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects to be transformed before being stored in the Model's cache.
|
||||
**/
|
||||
*/
|
||||
type ModelErrorSelector = (jsonGraphError: any) => any;
|
||||
|
||||
/**
|
||||
* This function is invoked every time a value in the Model cache is about to be replaced with a new value.
|
||||
* If the function returns true, the existing value is replaced with a new value and the version flag on all of the value's ancestors in the tree are incremented.
|
||||
**/
|
||||
*/
|
||||
type ModelComparator = (existingValue: any, newValue: any) => boolean;
|
||||
|
||||
/**
|
||||
* A Model object is used to execute commands against a {@link JSONGraph} object
|
||||
* {@link Model}s can work with a local JSONGraph cache, or it can work with a remote {@link JSONGraph} object through a {@link DataSource}.
|
||||
**/
|
||||
*/
|
||||
export class Model {
|
||||
constructor(options?: ModelOptions);
|
||||
|
||||
/**
|
||||
* The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.
|
||||
**/
|
||||
*/
|
||||
get(...path: Array<string | PathSet>): ModelResponse<JSONEnvelope<any>>;
|
||||
get<T>(...path: Array<string | PathSet>): ModelResponse<JSONEnvelope<T>>;
|
||||
|
||||
@@ -104,7 +104,7 @@ export class Model {
|
||||
* Sets the value at one or more places in the JSONGraph model.
|
||||
* The set method accepts one or more {@link PathValue}s, each of which is a combination of a location in the document and the value to place there.
|
||||
* In addition to accepting {@link PathValue}s, the set method also returns the values after the set operation is complete.
|
||||
**/
|
||||
*/
|
||||
set(...args: PathValue[]): ModelResponse<JSONEnvelope<any>>;
|
||||
set<T>(...args: PathValue[]): ModelResponse<JSONEnvelope<T>>;
|
||||
set(jsonGraph: JSONGraph): ModelResponse<JSONEnvelope<any>>;
|
||||
@@ -112,12 +112,12 @@ export class Model {
|
||||
|
||||
/**
|
||||
* The preload method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model} and loads them into the Model cache.
|
||||
**/
|
||||
*/
|
||||
preload(...path: PathSet[]): void;
|
||||
|
||||
/**
|
||||
* Invokes a function in the JSON Graph.
|
||||
**/
|
||||
*/
|
||||
// NOTE: In http://netflix.github.io/falcor/doc/Model.html#call, it says that refPaths should be an PathSet[].
|
||||
// However, model implementation returns an error with setting refPaths as PathSet[] and it works with refPaths as PathSet.
|
||||
// So refPaths is defined as a PathSet in this .d.ts.
|
||||
@@ -126,7 +126,7 @@ export class Model {
|
||||
|
||||
/**
|
||||
* The invalidate method synchronously removes several {@link Path}s or {@link PathSet}s from a {@link Model} cache.
|
||||
**/
|
||||
*/
|
||||
invalidate(...path: PathSet[]): void;
|
||||
|
||||
/**
|
||||
@@ -136,78 +136,78 @@ export class Model {
|
||||
* - Expose only a fragment of the {@link JSONGraph} to components, rather than the entire graph
|
||||
* - Hide the location of a {@link JSONGraph} fragment from components
|
||||
* - Optimize for executing multiple operations and path looksup at/below the same location in the {@link JSONGraph}
|
||||
**/
|
||||
*/
|
||||
deref(responseObject: any): Model;
|
||||
|
||||
/**
|
||||
* Get data for a single {@link Path}.
|
||||
**/
|
||||
*/
|
||||
getValue(path: string | Path): ModelResponse<any>;
|
||||
getValue<T>(path: string | Path): ModelResponse<T>;
|
||||
|
||||
/**
|
||||
* Set value for a single {@link Path}.
|
||||
**/
|
||||
*/
|
||||
setValue(path: string | Path, value: any): ModelResponse<any>;
|
||||
setValue<T>(path: string | Path, value: any): ModelResponse<T>;
|
||||
|
||||
/**
|
||||
* Set the local cache to a {@link JSONGraph} fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.
|
||||
**/
|
||||
*/
|
||||
setCache(jsonGraph: JSONGraph): void;
|
||||
|
||||
/**
|
||||
* Get the local {@link JSONGraph} cache. This method can be a useful to store the state of the cache.
|
||||
**/
|
||||
*/
|
||||
getCache(...path: PathSet[]): JSONGraph;
|
||||
|
||||
/**
|
||||
* Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.
|
||||
**/
|
||||
*/
|
||||
getVersion(path?: Path): number;
|
||||
|
||||
/**
|
||||
* Returns a clone of the {@link Model} that enables batching. Within the configured time period, paths for get operations are collected and sent to the {@link DataSource} in a batch.
|
||||
* Batching can be more efficient if the {@link DataSource} access the network, potentially reducing the number of HTTP requests to the server.
|
||||
**/
|
||||
*/
|
||||
batch(schedulerOrDelay?: number | Scheduler): Model; // FIXME what's a valid type for scheduler?
|
||||
|
||||
/**
|
||||
* Returns a clone of the {@link Model} that disables batching. This is the default mode. Each get operation will be executed on the {@link DataSource} separately.
|
||||
**/
|
||||
*/
|
||||
unbatch(): Model;
|
||||
|
||||
/**
|
||||
* Returns a clone of the {@link Model} that treats errors as values. Errors will be reported in the same callback used to report data.
|
||||
* Errors will appear as objects in responses, rather than being sent to the {@link Observable~onErrorCallback} callback of the {@link ModelResponse}.
|
||||
**/
|
||||
*/
|
||||
treatErrorsAsValues(): Model;
|
||||
|
||||
/**
|
||||
* Adapts a Model to the {@link DataSource} interface.
|
||||
**/
|
||||
*/
|
||||
asDataSource(): DataSource;
|
||||
|
||||
/**
|
||||
* Returns a clone of the {@link Model} that boxes values returning the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the value inside it.
|
||||
* This allows any metadata attached to the wrapper to be inspected.
|
||||
**/
|
||||
*/
|
||||
boxValues(): Model;
|
||||
|
||||
/**
|
||||
* Returns a clone of the {@link Model} that unboxes values, returning the value inside of the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the wrapper itself.
|
||||
* This is the default mode.
|
||||
**/
|
||||
*/
|
||||
unboxValues(): Model;
|
||||
|
||||
/**
|
||||
* Returns a clone of the {@link Model} that only uses the local {@link JSONGraph} and never uses a {@link DataSource} to retrieve missing paths.
|
||||
**/
|
||||
*/
|
||||
withoutDataSource(): Model;
|
||||
|
||||
/**
|
||||
* Returns the {@link Path} to the object within the JSON Graph that this Model references.
|
||||
**/
|
||||
*/
|
||||
getPath(): Path;
|
||||
}
|
||||
|
||||
@@ -237,38 +237,38 @@ export class Observable<T>{
|
||||
* An Observable is like a pipe of water that is closed.
|
||||
* When forEach is called, we open the valve and the values within are pushed at us.
|
||||
* These values can be received using either callbacks or an {@link Observer} object.
|
||||
**/
|
||||
*/
|
||||
forEach(onNext?: ObservableOnNextCallback<T>, onError?: ObservableOnErrorCallback , onCompleted?: ObservableOnCompletedCallback ): Subscription;
|
||||
|
||||
/**
|
||||
* The subscribe method is a synonym for {@link Observable.prototype.forEach} and triggers the execution of the Observable, causing the values within to be pushed to a callback.
|
||||
* An Observable is like a pipe of water that is closed.
|
||||
* When forEach is called, we open the valve and the values within are pushed at us. These values can be received using either callbacks or an {@link Observer} object.
|
||||
**/
|
||||
*/
|
||||
subscribe(onNext?: ObservableOnNextCallback<T>, onError?: ObservableOnErrorCallback , onCompleted?: ObservableOnCompletedCallback ): Subscription;
|
||||
}
|
||||
|
||||
/**
|
||||
* This callback accepts a value that was emitted while evaluating the operation underlying the {@link Observable} stream.
|
||||
**/
|
||||
*/
|
||||
type ObservableOnNextCallback<T> = (value: T) => void;
|
||||
|
||||
/**
|
||||
* This callback accepts an error that occurred while evaluating the operation underlying the {@link Observable} stream.
|
||||
* When this callback is invoked, the {@link Observable} stream ends and no more values will be received by the {@link Observable~onNextCallback}.
|
||||
**/
|
||||
*/
|
||||
type ObservableOnErrorCallback = (error: Error) => void;
|
||||
|
||||
/**
|
||||
* This callback is invoked when the {@link Observable} stream ends.
|
||||
* When this callback is invoked the {@link Observable} stream has ended, and therefore the {@link Observable~onNextCallback} will not receive any more values.
|
||||
**/
|
||||
*/
|
||||
type ObservableOnCompletedCallback = () => void;
|
||||
|
||||
export class Subscription {
|
||||
/**
|
||||
* When this method is called on the Subscription, the Observable that created the Subscription will stop sending values to the callbacks passed when the Subscription was created.
|
||||
**/
|
||||
*/
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+12
-12
@@ -30,7 +30,7 @@ interface Options extends RequestInit {
|
||||
afterJSON?(body: any): void;
|
||||
}
|
||||
|
||||
declare class Request {
|
||||
export class Request {
|
||||
constructor(method: TMethod, url: TUrl, options: Options)
|
||||
|
||||
/**
|
||||
@@ -66,51 +66,51 @@ declare class Request {
|
||||
/**
|
||||
* Set Options
|
||||
*/
|
||||
config(key: string, value: any): this
|
||||
config(key: string, value: any): this;
|
||||
|
||||
config(opts: {[key: string]: any}): this
|
||||
config(opts: {[key: string]: any}): this;
|
||||
|
||||
/**
|
||||
* Set Header
|
||||
*/
|
||||
set(key: string, value: any): this
|
||||
set(key: string, value: any): this;
|
||||
|
||||
set(opts: {[key: string]: any}): this
|
||||
set(opts: {[key: string]: any}): this;
|
||||
|
||||
/**
|
||||
* Set Content-Type
|
||||
*/
|
||||
type(type: 'json' | 'form' | 'urlencoded'): this
|
||||
type(type: 'json' | 'form' | 'urlencoded'): this;
|
||||
|
||||
/**
|
||||
* Add query string
|
||||
*/
|
||||
query(object: {[key: string]: any}): this
|
||||
query(object: {[key: string]: any}): this;
|
||||
|
||||
/**
|
||||
* Send data
|
||||
*/
|
||||
send(data: {[key: string]: any}): this
|
||||
send(data: {[key: string]: any}): this;
|
||||
|
||||
/**
|
||||
* ppend formData
|
||||
*/
|
||||
append(key: string, value: string): this
|
||||
append(key: string, value: string): this;
|
||||
|
||||
/**
|
||||
* Get Response directly
|
||||
*/
|
||||
then(resolve: (value?: Response) => void, reject?: (reason?: any) => void): Promise<any>
|
||||
then(resolve: (value?: Response) => void, reject?: (reason?: any) => void): Promise<any>;
|
||||
|
||||
/**
|
||||
* Make Response to JSON
|
||||
*/
|
||||
json(strict?: boolean): Promise<any>
|
||||
json(strict?: boolean): Promise<any>;
|
||||
|
||||
/**
|
||||
* Make Response to string
|
||||
*/
|
||||
text(): Promise<string>
|
||||
text(): Promise<string>;
|
||||
}
|
||||
|
||||
export default class Fetch extends Request {
|
||||
|
||||
Vendored
+1
-1
@@ -21,7 +21,7 @@ interface MappingOptions extends FindOptions {
|
||||
ext?: string;
|
||||
extDot?: 'first' | 'last';
|
||||
flatten?: boolean;
|
||||
rename?: (p: string) => string;
|
||||
rename?(p: string): string;
|
||||
}
|
||||
|
||||
interface OneMapping {
|
||||
|
||||
@@ -3,4 +3,4 @@ import * as React from 'react';
|
||||
|
||||
const center = { lat: 0, lng: 0 };
|
||||
|
||||
<GoogleMapReact center={center} zoom={3}/>
|
||||
<GoogleMapReact center={center} zoom={3}/>;
|
||||
|
||||
Vendored
+12
-12
@@ -15,7 +15,7 @@ export interface Options {
|
||||
styles?: any[];
|
||||
scrollwheel?: boolean;
|
||||
panControl?: boolean;
|
||||
mapTypeControl?: boolean,
|
||||
mapTypeControl?: boolean;
|
||||
minZoomOverride?: boolean;
|
||||
minZoom?: number;
|
||||
gestureHandling?: string;
|
||||
@@ -59,18 +59,18 @@ export interface Props {
|
||||
margin?: any[];
|
||||
debounced?: boolean;
|
||||
layerTypes?: string[];
|
||||
onClick?: ({x, y, lat, lng, event}: { x: number, y: number, lat: number, lng: number, event: any }) => any;
|
||||
onChange?: ({ center, zoom, bounds, marginBounds }: { center: [number, number], zoom: number, bounds: [number, number, number, number], marginBounds: [number, number, number, number] }) => any;
|
||||
onClick?({x, y, lat, lng, event}: { x: number, y: number, lat: number, lng: number, event: any }): any;
|
||||
onChange?({ center, zoom, bounds, marginBounds }: { center: [number, number], zoom: number, bounds: [number, number, number, number], marginBounds: [number, number, number, number] }): any;
|
||||
resetBoundsOnResize?: boolean;
|
||||
onChildClick?: (hoverKey: any, childProps: any) => void;
|
||||
onChildMouseEnter?: (hoverKey: any, childProps: any) => void;
|
||||
onChildMouseLeave?: (hoverKey: any, childProps: any) => void;
|
||||
onZoomAnimationStart?: (args: any) => void;
|
||||
onZoomAnimationEnd?: (args: any) => void;
|
||||
onMapTypeIdChange?: (args: any) => void;
|
||||
distanceToMouse?: (pt: {x: number, y: number}, mousePos: {x: number, y: number}) => void;
|
||||
googleMapLoader?: (bootstrapURLKeys: any) => void;
|
||||
onGoogleApiLoaded?: ({map, maps}: { map: any, maps: any }) => void;
|
||||
onChildClick?(hoverKey: any, childProps: any): void;
|
||||
onChildMouseEnter?(hoverKey: any, childProps: any): void;
|
||||
onChildMouseLeave?(hoverKey: any, childProps: any): void;
|
||||
onZoomAnimationStart?(args: any): void;
|
||||
onZoomAnimationEnd?(args: any): void;
|
||||
onMapTypeIdChange?(args: any): void;
|
||||
distanceToMouse?(pt: {x: number, y: number}, mousePos: {x: number, y: number}): void;
|
||||
googleMapLoader?(bootstrapURLKeys: any): void;
|
||||
onGoogleApiLoaded?({map, maps}: { map: any, maps: any }): void;
|
||||
yesIWantToUseGoogleMapApiInternals?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
"extends": "../tslint.json",
|
||||
"rules": {
|
||||
"align": false,
|
||||
"array-type": false,
|
||||
"new-parens": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-redundant-modifiers": false,
|
||||
"interface-over-type-literal": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-var": false,
|
||||
"prefer-declare-function": false,
|
||||
"semicolon": false,
|
||||
"trim-file": false
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class CustomColumnComponentGrid extends React.Component<any, any> {
|
||||
sortDescendingComponent={<span className="fa fa-sort-alpha-desc"/>}
|
||||
customRowComponent={LinkComponent} />
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomColumnComponentGrid;
|
||||
|
||||
Vendored
+1
-1
@@ -84,5 +84,5 @@ declare namespace HtmlWebpackPlugin {
|
||||
/** @deprecated use MinifyOptions */
|
||||
type MinifyConfig = MinifyOptions;
|
||||
/** @deprecated use Options */
|
||||
type Config = Options;
|
||||
type Config = Options;
|
||||
}
|
||||
|
||||
@@ -56,3 +56,28 @@ h2('a', {href: '#',
|
||||
}, "Click this")
|
||||
|
||||
h2.cleanup()
|
||||
|
||||
/* Polymorphic type tests */
|
||||
|
||||
// fall back to Element when in doubt
|
||||
let fallbackTest = h('canvas#test3');
|
||||
|
||||
// determine proper Element type from tagName
|
||||
let htmlTest1: HTMLCanvasElement = h('canvas');
|
||||
|
||||
// allow coercion of decorated tagName to proper type
|
||||
let htmlTest2: HTMLCanvasElement = h<HTMLCanvasElement>('canvas#test2');
|
||||
|
||||
// if you need it to be an HTMLElement, you must coerce
|
||||
let htmlTest3 = h<HTMLElement>('canvas#test3');
|
||||
|
||||
// support SVG elements
|
||||
let svgTest1 = h('svg');
|
||||
|
||||
// allow coercions on SVG elements
|
||||
let svgTest2 = h<SVGSVGElement>('svg#test5');
|
||||
|
||||
// inline coercion if you were feeling pedantic
|
||||
h<HTMLDivElement>('div#page',
|
||||
h<HTMLDivElement>('div#header',
|
||||
h<HTMLHeadingElement>('h1.classy', 'h', { style: {'background-color': '#22f'} })));
|
||||
Vendored
+5
-3
@@ -1,13 +1,15 @@
|
||||
// Type definitions for hyperscript
|
||||
// Project: https://github.com/dominictarr/hyperscript
|
||||
// Definitions by: Mike Linkovich <https://github.com/spacejack>
|
||||
// Definitions by: Mike Linkovich <https://github.com/spacejack>, Justin Firth <https://github.com/jmfirth/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare module 'hyperscript' {
|
||||
|
||||
interface HyperScript {
|
||||
/** Creates an HTML element */
|
||||
(tagName: string, ...args: any[]): HTMLElement;
|
||||
/** Creates an Element */
|
||||
<T extends keyof ElementTagNameMap>(tagName: T, attrs?: Object, ...children: any[]): ElementTagNameMap[T];
|
||||
<T extends Element>(tagName: string, attrs?: Object, ...children: any[]): T;
|
||||
/** Cleans up any event handlers created by this hyperscript context */
|
||||
cleanup(): void;
|
||||
/** Creates a new hyperscript context */
|
||||
|
||||
Vendored
+1
-1
@@ -12,4 +12,4 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export var inert: any;
|
||||
export const inert: any;
|
||||
|
||||
@@ -7,4 +7,4 @@ isAbsoluteUrl('//sindresorhus.com');
|
||||
// => false
|
||||
|
||||
isAbsoluteUrl('foo/bar');
|
||||
// => false
|
||||
// => false
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
import isRoot = require('is-root');
|
||||
|
||||
isRoot();
|
||||
// => true
|
||||
// => true
|
||||
|
||||
Vendored
-1
@@ -3,7 +3,6 @@
|
||||
// Definitions by: Jørgen Elgaard Larsen <https://github.com/elhaard/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
type IGroups = any;
|
||||
|
||||
export class ISBNcodes {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as isbn from 'isbn-utils';
|
||||
|
||||
|
||||
const isbn10a: isbn.ISBN|null = isbn.parse('4873113369');
|
||||
let b: boolean;
|
||||
let s: string;
|
||||
|
||||
Vendored
+1
-1
@@ -12,4 +12,4 @@ export interface Configuration {
|
||||
|
||||
export function init(element: string, config: Configuration): void;
|
||||
|
||||
export as namespace ityped;
|
||||
export as namespace ityped;
|
||||
|
||||
@@ -15,4 +15,4 @@ init("#anotherSelector", {
|
||||
loop: false
|
||||
});
|
||||
|
||||
init("#anotherOne", {});
|
||||
init("#anotherOne", {});
|
||||
|
||||
Vendored
-1
@@ -50,7 +50,6 @@ declare namespace jimp {
|
||||
}
|
||||
} | PresetFont;
|
||||
|
||||
|
||||
class JimpImage {
|
||||
constructor(width: number, height: number, callback?: Callback<JimpImage>);
|
||||
constructor(width: number, height: number, initialColor: number, callback?: Callback<JimpImage>);
|
||||
|
||||
+38
-40
@@ -36,20 +36,20 @@ Jimp.read("http://www.example.com/path/to/lenna.jpg", (err, image) => {
|
||||
// do stuff with the image (if no exception)
|
||||
});
|
||||
|
||||
var image = new Jimp(1, 2);
|
||||
var w = 0;
|
||||
var h = 0;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var f = 0;
|
||||
var src = '';
|
||||
var horz = Jimp.HORIZONTAL_ALIGN_CENTER;
|
||||
var vert = Jimp.VERTICAL_ALIGN_BOTTOM;
|
||||
var deg = 90;
|
||||
var val = 0.5;
|
||||
var hex = 0xFFFFFFFF;
|
||||
var r = 0;
|
||||
var n = 1;
|
||||
let image = new Jimp(1, 2);
|
||||
const w = 0;
|
||||
const h = 0;
|
||||
const x = 0;
|
||||
const y = 0;
|
||||
const f = 0;
|
||||
const src = '';
|
||||
const horz = Jimp.HORIZONTAL_ALIGN_CENTER;
|
||||
const vert = Jimp.VERTICAL_ALIGN_BOTTOM;
|
||||
const deg = 90;
|
||||
const val = 0.5;
|
||||
const hex = 0xFFFFFFFF;
|
||||
const r = 0;
|
||||
const n = 1;
|
||||
/* Resize */
|
||||
image.contain(w, h); // scale the image to the given width and height, some parts of the image may be letter boxed
|
||||
image.cover(w, h); // scale the image to the given width and height, some parts of the image may be clipped
|
||||
@@ -112,15 +112,15 @@ image.resize(250, 250, Jimp.RESIZE_BEZIER);
|
||||
|
||||
image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP);
|
||||
|
||||
var path = '';
|
||||
var str = '';
|
||||
var width = 0;
|
||||
const path = '';
|
||||
const str = '';
|
||||
const width = 0;
|
||||
Jimp.loadFont(path).then(font => { // load font from .fnt file
|
||||
image.print(font, x, y, str); // print a message on an image
|
||||
image.print(font, x, y, str, width); // print a message on an image with text wrapped at width
|
||||
});
|
||||
|
||||
var cb = (err: Error, data: any) => {};
|
||||
const cb = (err: Error, data: any) => {};
|
||||
Jimp.loadFont(path, cb); // using a callback pattern
|
||||
|
||||
Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => {
|
||||
@@ -129,17 +129,16 @@ Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => {
|
||||
|
||||
image.write(path, cb); // Node-style callback will be fired when write is successful
|
||||
|
||||
var file = "new_name." + image.getExtension();
|
||||
const file = "new_name." + image.getExtension();
|
||||
image.write(file);
|
||||
|
||||
|
||||
var mime = 'image/png';
|
||||
const mime = 'image/png';
|
||||
image.getBuffer(mime, cb); // Node-style callback will be fired with result
|
||||
image.getBase64(mime, cb); // Node-style callback will be fired with result
|
||||
image.quality(n); // set the quality of saved JPEG, 0 - 100
|
||||
|
||||
var bool = true;
|
||||
var number = 0;
|
||||
const bool = true;
|
||||
const number = 0;
|
||||
image.rgba(bool); // set whether PNGs are saved as RGBA (true, default) or RGB (false)
|
||||
image.filterType(number); // set the filter type for the saved PNG
|
||||
image.deflateLevel(number); // set the deflate level for the saved PNG
|
||||
@@ -160,10 +159,10 @@ image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) {
|
||||
// idx is the position start position of this rgba tuple in the bitmap Buffer
|
||||
// this is the image
|
||||
|
||||
var red = this.bitmap.data[ idx + 0 ];
|
||||
var green = this.bitmap.data[ idx + 1 ];
|
||||
var blue = this.bitmap.data[ idx + 2 ];
|
||||
var alpha = this.bitmap.data[ idx + 3 ];
|
||||
const red = this.bitmap.data[ idx + 0 ];
|
||||
const green = this.bitmap.data[ idx + 1 ];
|
||||
const blue = this.bitmap.data[ idx + 2 ];
|
||||
const alpha = this.bitmap.data[ idx + 3 ];
|
||||
|
||||
// rgba values run from 0 - 255
|
||||
// e.g. this.bitmap.data[idx] = 0; // removes red from this pixel
|
||||
@@ -171,35 +170,34 @@ image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) {
|
||||
image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF
|
||||
image.setPixelColor(hex, x, y); // sets the colour of that pixel
|
||||
|
||||
var g = 0;
|
||||
var b = 0;
|
||||
var a = 0;
|
||||
const g = 0;
|
||||
const b = 0;
|
||||
const a = 0;
|
||||
Jimp.rgbaToInt(r, g, b, a); // e.g. converts 255, 255, 255, 255 to 0xFFFFFFFF
|
||||
Jimp.intToRGBA(hex); // e.g. converts 0xFFFFFFFF to {r: 255, g: 255, b: 255, a:255}
|
||||
|
||||
var image = new Jimp(256, 256, (err, image) => {
|
||||
image = new Jimp(256, 256, (err, image) => {
|
||||
// this image is 256 x 256, every pixel is set to 0x00000000
|
||||
});
|
||||
|
||||
var image = new Jimp(256, 256, 0xFF0000FF, (err, image) => {
|
||||
image = new Jimp(256, 256, 0xFF0000FF, (err, image) => {
|
||||
// this image is 256 x 256, every pixel is set to 0xFF0000FF
|
||||
});
|
||||
|
||||
image.hash(); // aHgG4GgoFjA
|
||||
image.hash(2); // 1010101011010000101010000100101010010000011001001001010011100100
|
||||
|
||||
var image1 = new Jimp(0, 1);
|
||||
var image2 = new Jimp(0, 1);
|
||||
const image1 = new Jimp(0, 1);
|
||||
const image2 = new Jimp(0, 1);
|
||||
Jimp.distance(image1, image2); // returns a number 0-1, where 0 means the two images are perceived to be identical
|
||||
|
||||
var threshold = 0;
|
||||
var diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1)
|
||||
const threshold = 0;
|
||||
let diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1)
|
||||
diff.image; // a Jimp image showing differences
|
||||
diff.percent; // the proportion of different pixels (0-1), where 0 means the images are pixel identical
|
||||
|
||||
|
||||
var distance = Jimp.distance(image, image2); // perceived distance
|
||||
var diff = Jimp.diff(image, image2); // pixel difference
|
||||
const distance = Jimp.distance(image, image2); // perceived distance
|
||||
diff = Jimp.diff(image, image2); // pixel difference
|
||||
|
||||
if (distance < 0.15 || diff.percent < 0.15) {
|
||||
// images match
|
||||
@@ -217,4 +215,4 @@ Jimp.read("lenna.png", (err, image) => {
|
||||
image.write("lena-half-bw.png");
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+14
-14
@@ -7,24 +7,24 @@ declare namespace md5 {
|
||||
type message = string | any[] | Uint8Array | ArrayBuffer;
|
||||
|
||||
interface Md5 {
|
||||
array: () => number[];
|
||||
arrayBuffer: () => ArrayBuffer;
|
||||
buffer: () => ArrayBuffer;
|
||||
digest: () => number[];
|
||||
hex: () => string;
|
||||
toString: () => string;
|
||||
update: (message: message) => Md5;
|
||||
array(): number[];
|
||||
arrayBuffer(): ArrayBuffer;
|
||||
buffer(): ArrayBuffer;
|
||||
digest(): number[];
|
||||
hex(): string;
|
||||
toString(): string;
|
||||
update(message: message): Md5;
|
||||
}
|
||||
|
||||
interface md5 {
|
||||
(message: message): string;
|
||||
hex: (message: message) => string;
|
||||
array: (message: message) => number[];
|
||||
digest: (message: message) => number[];
|
||||
arrayBuffer: (message: message) => ArrayBuffer;
|
||||
buffer: (message: message) => ArrayBuffer;
|
||||
create: () => Md5;
|
||||
update: (message: message) => Md5;
|
||||
hex(message: message): string;
|
||||
array(message: message): number[];
|
||||
digest(message: message): number[];
|
||||
arrayBuffer(message: message): ArrayBuffer;
|
||||
buffer(message: message): ArrayBuffer;
|
||||
create(): Md5;
|
||||
update(message: message): Md5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+13
-13
@@ -9,16 +9,16 @@
|
||||
// -------------------------------
|
||||
|
||||
/**
|
||||
* Copyright 2016 Mattijs Perdeck.
|
||||
*
|
||||
* This project is licensed under the MIT license.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
* Copyright 2016 Mattijs Perdeck.
|
||||
*
|
||||
* This project is licensed under the MIT license.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Declarations of all interfaces and ambient objects, except for JL itself.
|
||||
// Provides strong typing in both jsnlog.ts itself and in TypeScript programs that use
|
||||
@@ -31,8 +31,8 @@ declare namespace JL {
|
||||
defaultAjaxUrl?: string;
|
||||
clientIP?: string;
|
||||
requestId?: string;
|
||||
defaultBeforeSend?: (xhr: XMLHttpRequest) => void;
|
||||
serialize?: (obj: any) => string;
|
||||
defaultBeforeSend?(xhr: XMLHttpRequest): void;
|
||||
serialize?(obj: any): string;
|
||||
}
|
||||
|
||||
interface JSNLogFilterOptions {
|
||||
@@ -57,7 +57,7 @@ declare namespace JL {
|
||||
|
||||
interface JSNLogAjaxAppenderOptions extends JSNLogAppenderOptions {
|
||||
url?: string;
|
||||
beforeSend?: (xhr: XMLHttpRequest) => void;
|
||||
beforeSend?(xhr: XMLHttpRequest): void;
|
||||
}
|
||||
|
||||
interface JSNLogLogger {
|
||||
|
||||
Vendored
+8
-7
@@ -5,14 +5,15 @@
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
declare var jui: JuiStatic;
|
||||
export const jui: JuiStatic;
|
||||
|
||||
interface UtilBase {
|
||||
/**
|
||||
* @property browser check browser agent
|
||||
* @property {Boolean} browser.webkit Webkit 브라우저 체크
|
||||
* @property {Boolean} browser.mozilla Mozilla 브라우저 체크
|
||||
* @property {Boolean} browser.msie IE 브라우저 체크 */
|
||||
* @property {Boolean} browser.msie IE 브라우저 체크
|
||||
*/
|
||||
browser: {
|
||||
webkit: boolean,
|
||||
mozilla: boolean,
|
||||
@@ -389,11 +390,11 @@ interface JuiStatic {
|
||||
includeAll(): any[];
|
||||
|
||||
/**
|
||||
* @method add
|
||||
* Adds a component object created
|
||||
*
|
||||
* @param {Object} ui UI instance
|
||||
*/
|
||||
* @method add
|
||||
* Adds a component object created
|
||||
*
|
||||
* @param {Object} ui UI instance
|
||||
*/
|
||||
add(uiIns: any): void;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,9 +40,9 @@ jui.ready([ "grid.table" ], (table: GridTable) => {
|
||||
]);
|
||||
|
||||
const table_3_submit: Function = (index: number) => {
|
||||
const name = $(table_3.root).find(".name").val(),
|
||||
age = $(table_3.root).find(".age").val(),
|
||||
location = $(table_3.root).find(".location").val();
|
||||
const name = $(table_3.root).find(".name").val();
|
||||
const age = $(table_3.root).find(".age").val();
|
||||
const location = $(table_3.root).find(".location").val();
|
||||
|
||||
//noinspection TypeScriptValidateTypes
|
||||
table_3.update(index, { name, age, location });
|
||||
|
||||
Vendored
+3
-3
@@ -10,17 +10,17 @@ interface JSONErrorOptions {
|
||||
/**
|
||||
* Perform some task before calling `options.format`. Must be a function with the original err as its only argument.
|
||||
*/
|
||||
preFormat?: (err: Error) => any;
|
||||
preFormat?(err: Error): any;
|
||||
|
||||
/**
|
||||
* Runs inmediatly after `options.preFormat`. It receives two arguments: the original `err` and the output of `options.preFormat`. It should `return` a newly formatted error.
|
||||
*/
|
||||
format?: (err: Error, obj: any) => any;
|
||||
format?(err: Error, obj: any): any;
|
||||
|
||||
/**
|
||||
* Runs inmediatly after `options.format`. It receives two arguments: the original `err` and the output of `options.format`. It should `return` a newly formatted error.
|
||||
*/
|
||||
postFormat?: (err: Error, obj: any) => any;
|
||||
postFormat?(err: Error, obj: any): any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ declare namespace jwt {
|
||||
interface Options {
|
||||
secret: string | Buffer;
|
||||
key?: string;
|
||||
getToken?: (opts: jwt.Options) => string;
|
||||
getToken?(opts: jwt.Options): string;
|
||||
passthrough?: boolean;
|
||||
cookie?: string;
|
||||
debug?: boolean;
|
||||
|
||||
Vendored
+149
@@ -0,0 +1,149 @@
|
||||
// Type definitions for KSS 3.0.0-beta
|
||||
// Project: https://github.com/kss-node/kss-node
|
||||
// Definitions by: Gilad Gray <https://github.com/giladgray>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** Builds a styleguide given the proper options. */
|
||||
declare function kss(options?: kss.KssOptions): Promise<kss.KssStyleguide>;
|
||||
declare namespace kss {
|
||||
interface File {
|
||||
/** bath to source directory */
|
||||
base: string;
|
||||
/** file contents */
|
||||
contents: string;
|
||||
/** full path to file */
|
||||
path: string;
|
||||
}
|
||||
|
||||
interface Source {
|
||||
/** The name of the file. */
|
||||
filename: string;
|
||||
/** The full path of the file. */
|
||||
path: string;
|
||||
/** The line number where the KSS comment is found. */
|
||||
line: number;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Whether to automatically format Markdown using [marked](https://github.com/chjj/marked).
|
||||
* Enabled by default.
|
||||
* @default true
|
||||
*/
|
||||
markdown?: boolean;
|
||||
/**
|
||||
* Use a regex or string (e.g. `*.less|*.css`) to only parse files matching this value.
|
||||
* @default *.css|*.less|*.sass|*.scss|*.styl|*.stylus
|
||||
*/
|
||||
mask?: string | RegExp;
|
||||
/**
|
||||
* kss-node makes the header available separately from the description. To make kss-node
|
||||
* behave like the Ruby KSS, disable this option and the title will remain a part of the
|
||||
* description. Enabled by default.
|
||||
* @default true.
|
||||
*/
|
||||
header?: boolean;
|
||||
}
|
||||
|
||||
interface KssOptions extends Options {
|
||||
builder?: any;
|
||||
clone?: boolean;
|
||||
custom?: any;
|
||||
logErrorFunction?(...msg: string[]): void;
|
||||
json?: boolean;
|
||||
mask?: string | RegExp;
|
||||
source: string[];
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
type CallbackFn = (error: Error | null, styleguide: KssStyleguide) => void;
|
||||
|
||||
class KssStyleguide {
|
||||
constructor(data?: any);
|
||||
autoInit(autoInit: boolean): KssStyleguide;
|
||||
customPropertyNames(): string[];
|
||||
customPropertyNames(names: string | string[]): KssStyleguide;
|
||||
hasNumericReferences(): boolean;
|
||||
init(): KssStyleguide;
|
||||
referenceDelimiter(): string;
|
||||
sections(): KssSection[];
|
||||
sections(query: string | RegExp): false | KssSection | KssSection[];
|
||||
sections(sections: KssSection | KssSection[]): KssStyleguide;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
class KssSection {
|
||||
constructor(data?: any);
|
||||
custom(name: string): any;
|
||||
custom(name: string, value: any): KssSection;
|
||||
customPropertyNames(): string[];
|
||||
deprecated(): boolean;
|
||||
deprecated(deprecated: boolean): KssSection;
|
||||
depth(): number;
|
||||
depth(depth: number): KssSection;
|
||||
description(): string;
|
||||
description(description: string): KssSection;
|
||||
experimental(): boolean;
|
||||
experimental(experimental: boolean): KssSection;
|
||||
header(): string;
|
||||
header(header: string): KssSection;
|
||||
markup(): false | string;
|
||||
markup(markup: string): KssSection;
|
||||
modifiers(): KssModifier[];
|
||||
modifiers(query: number | string): false | KssModifier;
|
||||
modifiers(modifiers: KssModifier | KssModifier[]): KssSection;
|
||||
parameters(): KssParameter[];
|
||||
parameters(query: number | string): false | KssParameter;
|
||||
parameters(parameters: KssParameter | KssParameter[]): KssSection;
|
||||
reference(): string;
|
||||
reference(reference: string): KssSection;
|
||||
referenceNumber(): string;
|
||||
referenceNumber(referenceNumber: string): KssSection;
|
||||
referenceURI(): string;
|
||||
referenceURI(referenceURI: string): KssSection;
|
||||
source(): Source;
|
||||
source(source: Source): KssSection;
|
||||
sourceFileName(): string;
|
||||
sourceLine(): string;
|
||||
styleGuide(): KssStyleguide;
|
||||
styleGuide(styleguide: KssStyleguide): KssSection;
|
||||
toJSON(): any;
|
||||
weight(): number;
|
||||
weight(weight: number): KssSection;
|
||||
}
|
||||
|
||||
class KssModifier {
|
||||
constructor(data?: any);
|
||||
className(): string;
|
||||
className(className: string): KssModifier;
|
||||
description(): string;
|
||||
description(description: string): KssModifier;
|
||||
markup(): string;
|
||||
markup(markup: string): KssModifier;
|
||||
name(): string;
|
||||
name(name: string): KssModifier;
|
||||
section(): KssSection;
|
||||
section(section: KssSection): KssModifier;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
class KssParameter {
|
||||
constructor(data?: any);
|
||||
defaultValue(): string;
|
||||
description(): string;
|
||||
description(description: string): KssParameter;
|
||||
name(): string;
|
||||
name(name: string): KssParameter;
|
||||
section(): KssSection;
|
||||
section(section: KssSection): KssParameter;
|
||||
toJSON(): any;
|
||||
}
|
||||
|
||||
/** Parse a string of documented CSS, or an array of file anys with their content. */
|
||||
function parse(input: string | File[], options: Options): KssStyleguide;
|
||||
|
||||
/** Traverse a directory, parse its contents, and create a `KssStyleGuide`. */
|
||||
function traverse(directory: string | string[], options: Options): Promise<KssStyleguide>;
|
||||
}
|
||||
|
||||
export = kss;
|
||||
@@ -0,0 +1,10 @@
|
||||
import kss = require("kss");
|
||||
|
||||
kss.traverse("src", { markdown: false })
|
||||
.then((styleguide) => styleguide.sections())
|
||||
.then((sections) => sections.map((s) => s.toJSON()))
|
||||
.then((json) => console.log(json));
|
||||
|
||||
const json = kss.parse("file contents", { header: false }).sections().map((s) => s.toJSON());
|
||||
|
||||
// both json vars should be the same type
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"kss-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
Vendored
+37
-49
@@ -4,9 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace later {
|
||||
|
||||
interface ScheduleData {
|
||||
|
||||
/**
|
||||
* A list of recurrence information as a composite schedule.
|
||||
*/
|
||||
@@ -25,7 +23,6 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface Recurrence {
|
||||
|
||||
/** Time in seconds from midnight.
|
||||
*/
|
||||
t?: number[];
|
||||
@@ -142,11 +139,10 @@ declare namespace later {
|
||||
* For acces to custom time periods created as extension to the later static type
|
||||
* and modifiers created on the later modifier static type.
|
||||
*/
|
||||
[ timeperiodAndModifierName: string ]: number[] | undefined;
|
||||
[timeperiodAndModifierName: string]: number[] | undefined;
|
||||
}
|
||||
|
||||
interface ParseStatic {
|
||||
|
||||
/**
|
||||
* Create a recurrence builder for building schedule data.
|
||||
*/
|
||||
@@ -168,7 +164,6 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface Timer {
|
||||
|
||||
/**
|
||||
* Clear the timer and end execution.
|
||||
*/
|
||||
@@ -176,58 +171,56 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface Schedule {
|
||||
|
||||
/**
|
||||
* Finds the next valid instance or instances of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* smaller than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of instances to return
|
||||
* @param {Date} dateFrom: The earliest a valid instance can occur
|
||||
* @param {Date} dateTo: The latest a valid instance can occur
|
||||
*/
|
||||
* Finds the next valid instance or instances of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* smaller than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of instances to return
|
||||
* @param {Date} dateFrom: The earliest a valid instance can occur
|
||||
* @param {Date} dateTo: The latest a valid instance can occur
|
||||
*/
|
||||
next(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[];
|
||||
|
||||
/**
|
||||
* Finds the next valid range or ranges of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* greater than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of ranges to return
|
||||
* @param {Date} dateFrom: The earliest a valid range can occur
|
||||
* @param {Date} dateTo: The latest a valid range can occur
|
||||
*/
|
||||
* Finds the next valid range or ranges of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* greater than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of ranges to return
|
||||
* @param {Date} dateFrom: The earliest a valid range can occur
|
||||
* @param {Date} dateTo: The latest a valid range can occur
|
||||
*/
|
||||
nextRange(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[];
|
||||
|
||||
/**
|
||||
* Finds the previous valid instance or instances of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* greater than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of instances to return
|
||||
* @param {Date} dateFrom: The earliest a valid instance can occur
|
||||
* @param {Date} dateTo: The latest a valid instance can occur
|
||||
*/
|
||||
* Finds the previous valid instance or instances of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* greater than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of instances to return
|
||||
* @param {Date} dateFrom: The earliest a valid instance can occur
|
||||
* @param {Date} dateTo: The latest a valid instance can occur
|
||||
*/
|
||||
prev(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[];
|
||||
|
||||
/**
|
||||
* Finds the previous valid range or ranges of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* greater than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of ranges to return
|
||||
* @param {Date} dateFrom: The earliest a valid range can occur
|
||||
* @param {Date} dateTo: The latest a valid range can occur
|
||||
*/
|
||||
* Finds the previous valid range or ranges of the current schedule,
|
||||
* optionally between a specified start and end date. Start date is
|
||||
* Date.now() by default, end date is unspecified. Start date must be
|
||||
* greater than end date.
|
||||
*
|
||||
* @param {number} numberOfInst: The number of ranges to return
|
||||
* @param {Date} dateFrom: The earliest a valid range can occur
|
||||
* @param {Date} dateTo: The latest a valid range can occur
|
||||
*/
|
||||
prevRange(numberOfInst: number, dateFrom?: Date, dateTo?: Date): Date[];
|
||||
}
|
||||
|
||||
interface RecurrenceBuilder extends ScheduleData {
|
||||
|
||||
/** a time period
|
||||
*/
|
||||
second(): RecurrenceBuilder;
|
||||
@@ -268,7 +261,6 @@ declare namespace later {
|
||||
/** a time period
|
||||
*/
|
||||
fullDate(): RecurrenceBuilder;
|
||||
|
||||
/**
|
||||
* Specifies one or more specific vals of a time period information provider.
|
||||
* When used to specify a time, a string indicating the 24-hour time may be used.
|
||||
@@ -371,7 +363,6 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface DateProvider {
|
||||
|
||||
/**
|
||||
* Set later to use UTC time.
|
||||
*/
|
||||
@@ -434,7 +425,6 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface TimePeriod {
|
||||
|
||||
/**
|
||||
* The name of the time period information provider.
|
||||
*/
|
||||
@@ -515,7 +505,6 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface ModifierStatic {
|
||||
|
||||
/**
|
||||
* After Modifier
|
||||
*/
|
||||
@@ -528,7 +517,6 @@ declare namespace later {
|
||||
}
|
||||
|
||||
interface Static {
|
||||
|
||||
/**
|
||||
* Schedule
|
||||
* Generates instances from schedule data.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user