mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-13 05:20:25 +00:00
@@ -933,3 +933,19 @@ function NgModelControllerTyping() {
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function ngFilterTyping() {
|
||||
var $filter: angular.IFilterService;
|
||||
var items: string[];
|
||||
|
||||
$filter("name")(items, "test");
|
||||
$filter("name")(items, {name: "test"});
|
||||
$filter("name")(items, (val, index, array) => {
|
||||
return array;
|
||||
});
|
||||
$filter("name")(items, (val, index, array) => {
|
||||
return array;
|
||||
}, (actual, expected) => {
|
||||
return actual == expected;
|
||||
});
|
||||
}
|
||||
Vendored
+17
-1
@@ -782,7 +782,23 @@ declare module angular {
|
||||
*
|
||||
* @param name Name of the filter function to retrieve
|
||||
*/
|
||||
(name: string): Function;
|
||||
(name: string): IFilterFunc;
|
||||
}
|
||||
|
||||
interface IFilterFunc {
|
||||
<T>(array: T[], expression: string | IFilterPatternObject | IFilterPredicateFunc<T>, comparator?: IFilterComparatorFunc<T>|boolean): T[];
|
||||
}
|
||||
|
||||
interface IFilterPatternObject {
|
||||
[name: string]: string;
|
||||
}
|
||||
|
||||
interface IFilterPredicateFunc<T> {
|
||||
(value: T, index: number, array: T[]): T[];
|
||||
}
|
||||
|
||||
interface IFilterComparatorFunc<T> {
|
||||
(actual: T, expected: T): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
@@ -19,6 +19,7 @@ declare module Backbone {
|
||||
|
||||
interface NavigateOptions {
|
||||
trigger?: boolean;
|
||||
replace?: boolean;
|
||||
}
|
||||
|
||||
interface RouterOptions {
|
||||
|
||||
@@ -550,6 +550,13 @@ fooArrProm = fooArrProm.filter<Foo>((item: Foo) => {
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
fooArrProm = fooArrProm.each<Foo, Bar>((item: Foo): Bar => bar);
|
||||
fooArrProm = fooArrProm.each<Foo, Bar>((item: Foo, index: number): Bar => index ? bar : null);
|
||||
fooArrProm = fooArrProm.each<Foo, Bar>((item: Foo, index: number, arrayLength: number): Bar => bar);
|
||||
fooArrProm = fooArrProm.each<Foo, Bar>((item: Foo, index: number, arrayLength: number): Promise<Bar> => barProm);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
|
||||
fooProm = Promise.try(() => {
|
||||
return foo;
|
||||
@@ -1123,3 +1130,43 @@ fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: numb
|
||||
});
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// each()
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArrThen
|
||||
|
||||
fooArrThen = Promise.each(fooThenArrThen, (item: Foo) => bar);
|
||||
fooArrThen = Promise.each(fooThenArrThen, (item: Foo) => barThen);
|
||||
fooArrThen = Promise.each(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => bar);
|
||||
fooArrThen = Promise.each(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => barThen);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArrThen
|
||||
|
||||
fooArrThen = Promise.each(fooArrThen, (item: Foo) => bar);
|
||||
fooArrThen = Promise.each(fooArrThen, (item: Foo) => barThen);
|
||||
fooArrThen = Promise.each(fooArrThen, (item: Foo, index: number, arrayLength: number) => bar);
|
||||
fooArrThen = Promise.each(fooArrThen, (item: Foo, index: number, arrayLength: number) => barThen);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooThenArr
|
||||
|
||||
fooArrThen = Promise.each(fooThenArr, (item: Foo) => bar);
|
||||
fooArrThen = Promise.each(fooThenArr, (item: Foo) => barThen);
|
||||
fooArrThen = Promise.each(fooThenArr, (item: Foo, index: number, arrayLength: number) => bar);
|
||||
fooArrThen = Promise.each(fooThenArr, (item: Foo, index: number, arrayLength: number) => barThen);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// fooArr
|
||||
|
||||
fooArrThen = Promise.each(fooArr, (item: Foo) => bar);
|
||||
fooArrThen = Promise.each(fooArr, (item: Foo) => barThen);
|
||||
fooArrThen = Promise.each(fooArr, (item: Foo, index: number, arrayLength: number) => bar);
|
||||
fooArrThen = Promise.each(fooArr, (item: Foo, index: number, arrayLength: number) => barThen);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Vendored
+17
@@ -328,6 +328,11 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable<boolean>, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
filter<U>(filterer: (item: U, index: number, arrayLength: number) => boolean, options?: Promise.ConcurrencyOption): Promise<U[]>;
|
||||
|
||||
/**
|
||||
* Same as calling ``Promise.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
each<R, U>(iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable<U>): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise.
|
||||
*
|
||||
@@ -607,6 +612,18 @@ declare class Promise<R> implements Promise.Thenable<R>, Promise.Inspection<R> {
|
||||
// array with values
|
||||
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable<boolean>, option?: Promise.ConcurrencyOption): Promise<R[]>;
|
||||
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise<R[]>;
|
||||
|
||||
/**
|
||||
* Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well.
|
||||
*
|
||||
* Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
|
||||
*/
|
||||
// promise of array with promises of value
|
||||
static each<R, U>(values: Promise.Thenable<Promise.Thenable<R>[]>, iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable<U>): Promise<R[]>;
|
||||
// array with promises of value
|
||||
static each<R, U>(values: Promise.Thenable<R>[], iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable<U>): Promise<R[]>;
|
||||
// array with values OR promise of array with values
|
||||
static each<R, U>(values: R[] | Promise.Thenable<R[]>, iterator: (item: R, index: number, arrayLength: number) => U | Promise.Thenable<U>): Promise<R[]>;
|
||||
}
|
||||
|
||||
declare module Promise {
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@ interface LinearChartData {
|
||||
|
||||
interface CircularChartData {
|
||||
value: number;
|
||||
color: string;
|
||||
color?: string;
|
||||
highlight?: string;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
@@ -245,3 +245,12 @@ function contentSettings() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// https://developer.chrome.com/extensions/runtime#method-openOptionsPage
|
||||
function testOptionsPage() {
|
||||
chrome.runtime.openOptionsPage();
|
||||
chrome.runtime.openOptionsPage(function() {
|
||||
// Do a thing ...
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -1649,6 +1649,7 @@ declare module chrome.runtime {
|
||||
export function getPackageDirectoryEntry(callback: (directoryEntry: any) => void): void;
|
||||
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
||||
export function getURL(path: string): string;
|
||||
export function openOptionsPage(callback?: () => void): void;
|
||||
export function reload(): void;
|
||||
export function requestUpdateCheck(callback: (status: string, details?: UpdateCheckDetails) => void): void;
|
||||
export function restart(): void;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="../cordova/cordova.d.ts" />
|
||||
/// <reference path="./cordova-plugin-app-version.d.ts" />
|
||||
|
||||
cordova.getAppVersion.getAppName()
|
||||
.then(appName=> {
|
||||
console.log(appName)
|
||||
});
|
||||
cordova.getAppVersion.getPackageName()
|
||||
.then(packageName=> {
|
||||
console.log(packageName);
|
||||
});
|
||||
cordova.getAppVersion.getVersionCode()
|
||||
.then(versionCode=> {
|
||||
console.log(versionCode);
|
||||
});
|
||||
cordova.getAppVersion.getVersionNumber()
|
||||
.then(versionNumber=> {
|
||||
console.log(versionNumber);
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
// Type definitions for cordova-plugin-app-version v0.1.7
|
||||
// Project: https://github.com/whiteoctober/cordova-plugin-app-version
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
|
||||
interface Cordova {
|
||||
getAppVersion: {
|
||||
getAppName: () => Q.IPromise<string>;
|
||||
getPackageName: () => Q.IPromise<string>;
|
||||
getVersionCode: () => Q.IPromise<string>;
|
||||
getVersionNumber: () => Q.IPromise<string>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/// <reference path="../cordova/cordova.d.ts" />
|
||||
/// <reference path="./cordova-plugin-ibeacon.d.ts" />
|
||||
|
||||
function registerDelegates() {
|
||||
cordova.plugins.locationManager.enableDebugLogs();
|
||||
|
||||
cordova.plugins.locationManager.delegate.didRangeBeaconsInRegion = (pluginResult) => didRangeBeaconsInRegion(pluginResult);
|
||||
cordova.plugins.locationManager.delegate.didEnterRegion = (pluginResult) => didEnterRegion(pluginResult);
|
||||
cordova.plugins.locationManager.delegate.didExitRegion = (pluginResult) => didExitRegion(pluginResult);
|
||||
cordova.plugins.locationManager.delegate.didDetermineStateForRegion = (pluginResult) => didDetermineStateForRegion(pluginResult);
|
||||
cordova.plugins.locationManager.delegate.didChangeAuthorizationStatus = (authorizationStatus) => didChangeAuthorizationStatus(authorizationStatus);
|
||||
cordova.plugins.locationManager.delegate.didStartMonitoringForRegion = (pluginResult) => didStartMonitoringForRegion(pluginResult);
|
||||
cordova.plugins.locationManager.delegate.monitoringDidFailForRegionWithError = (pluginResult) => monitoringDidFailForRegionWithError(pluginResult);
|
||||
|
||||
cordova.plugins.locationManager.onDomDelegateReady();
|
||||
}
|
||||
|
||||
function didRangeBeaconsInRegion(pluginResult: BeaconPlugin.PluginResult): void {
|
||||
for (var beacon of pluginResult.beacons) {
|
||||
console.log(beacon.uuid, beacon.major, beacon.minor, beacon.accuracy, beacon.proximity, beacon.rssi, beacon.tx);
|
||||
}
|
||||
}
|
||||
|
||||
function didEnterRegion(pluginResult: BeaconPlugin.PluginResult): void {
|
||||
var region: BeaconPlugin.Region = new cordova.plugins.locationManager.BeaconRegion("identifier", "uuid", 1, 2);;
|
||||
cordova.plugins.locationManager.startRangingBeaconsInRegion(this.createBeaconRegionFromPluginResult(pluginResult))
|
||||
.then(() => {
|
||||
console.log("startRangingBeaconsInRegion succeeded");
|
||||
})
|
||||
.catch((reason: any) => {
|
||||
console.error("startRangingBeaconsInRegion failed: " + reason);
|
||||
});
|
||||
}
|
||||
|
||||
function didExitRegion(pluginResult: BeaconPlugin.PluginResult): void {
|
||||
var region: BeaconPlugin.Region;
|
||||
cordova.plugins.locationManager.stopRangingBeaconsInRegion(region)
|
||||
.then(() => {
|
||||
console.log("stopRangingBeaconsInRegion succeeded");
|
||||
})
|
||||
.catch((reason: any) => {
|
||||
console.error("stopRangingBeaconsInRegion failed: " + reason);
|
||||
});
|
||||
}
|
||||
|
||||
function didDetermineStateForRegion(pluginResult: BeaconPlugin.PluginResult): void {
|
||||
if (pluginResult.state === "CLRegionStateInside") {
|
||||
console.log(pluginResult.region.identifier);
|
||||
}
|
||||
}
|
||||
|
||||
function didChangeAuthorizationStatus(authorizationStatus: string): void {
|
||||
console.log(authorizationStatus);
|
||||
}
|
||||
|
||||
function didStartMonitoringForRegion(pluginResult: BeaconPlugin.PluginResult): void {
|
||||
console.log(pluginResult.region.identifier);
|
||||
}
|
||||
|
||||
function monitoringDidFailForRegionWithError(pluginResult: BeaconPlugin.PluginResult): void {
|
||||
console.log(pluginResult.region.identifier);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Type definitions for cordova-plugin-ibeacon v3.3.0
|
||||
// Project: https://github.com/petermetz/cordova-plugin-ibeacon
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
|
||||
interface CordovaPlugins {
|
||||
locationManager: BeaconPlugin.LocationManager;
|
||||
}
|
||||
|
||||
declare module BeaconPlugin {
|
||||
/**
|
||||
* Beacon Plugin.
|
||||
*/
|
||||
export interface LocationManager {
|
||||
delegate: Delegate;
|
||||
BeaconRegion: BeaconRegion;
|
||||
onDomDelegateReady(): void;
|
||||
startMonitoringForRegion(region: Region): Q.Promise<void>;
|
||||
stopMonitoringForRegion(region: Region): Q.Promise<void>;
|
||||
requestStateForRegion(region: Region): Q.Promise<void>;
|
||||
startRangingBeaconsInRegion(region: Region): Q.Promise<void>;
|
||||
stopRangingBeaconsInRegion(region: Region): Q.Promise<void>;
|
||||
getAuthorizationStatus(): Q.Promise<PluginResult>;
|
||||
requestWhenInUseAuthorization(): Q.Promise<void>;
|
||||
requestAlwaysAuthorization(): Q.Promise<void>;
|
||||
getMonitoredRegions(): Q.Promise<Region[]>;
|
||||
getRangedRegions(): Q.Promise<Region[]>;
|
||||
isRangingAvailable(): Q.Promise<boolean>;
|
||||
isMonitoringAvailableForClass(region: Region): Q.Promise<boolean>;
|
||||
startAdvertising(region: Region, measuredPower: boolean): Q.Promise<void>;
|
||||
stopAdvertising(): Q.Promise<void>;
|
||||
isAdvertisingAvailable(): Q.Promise<boolean>;
|
||||
isAdvertising(): Q.Promise<boolean>;
|
||||
disableDebugLogs(): Q.Promise<void>;
|
||||
enableDebugNotifications(): Q.Promise<void>;
|
||||
disableDebugNotifications(): Q.Promise<void>;
|
||||
enableDebugLogs(): Q.Promise<void>;
|
||||
isBluetoothEnabled(): Q.Promise<boolean>;
|
||||
enableBluetooth(): Q.Promise<void>;
|
||||
disableBluetooth(): Q.Promise<void>;
|
||||
appendToDeviceLog(message: string): Q.Promise<string>;
|
||||
}
|
||||
|
||||
export interface PluginResult {
|
||||
eventType: string;
|
||||
region: Region;
|
||||
beacons: Beacon[];
|
||||
authorizationStatus: string;
|
||||
state: string;
|
||||
}
|
||||
|
||||
export interface Delegate {
|
||||
didDetermineStateForRegion(pluginResult: PluginResult): void;
|
||||
didStartMonitoringForRegion(pluginResult: PluginResult): void;
|
||||
didExitRegion(pluginResult: PluginResult): void;
|
||||
didEnterRegion(pluginResult: PluginResult): void;
|
||||
didRangeBeaconsInRegion(pluginResult: PluginResult): void;
|
||||
peripheralManagerDidStartAdvertising(pluginResult: PluginResult): void;
|
||||
peripheralManagerDidUpdateState(pluginResult: PluginResult): void;
|
||||
didChangeAuthorizationStatus(authorizationStatus: string): void;
|
||||
monitoringDidFailForRegionWithError(pluginResult: PluginResult): void;
|
||||
}
|
||||
|
||||
export interface Region {
|
||||
identifier: string;
|
||||
new (identifier: string): Region;
|
||||
}
|
||||
|
||||
export interface BeaconRegion extends Region {
|
||||
uuid: string;
|
||||
major: string;
|
||||
minor: string;
|
||||
notifyEntryStateOnDisplay: boolean;
|
||||
new (identifier: string, uuid: string, major?: number, minor?: number, notifyEntryStateOnDisplay?: boolean): BeaconRegion;
|
||||
}
|
||||
|
||||
export interface CircularRegion extends Region {
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
radius: number;
|
||||
new (identifier: string, latitude: number, longitude: number, radius: number): CircularRegion;
|
||||
}
|
||||
|
||||
export interface Beacon {
|
||||
uuid: string;
|
||||
major: string;
|
||||
minor: string;
|
||||
proximity: string;
|
||||
tx: number;
|
||||
rssi: number;
|
||||
accuracy: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
/// <reference path="core-decorators.d.ts" />
|
||||
|
||||
//
|
||||
// @autobind
|
||||
//
|
||||
|
||||
import { autobind } from 'core-decorators';
|
||||
|
||||
class Person {
|
||||
@autobind
|
||||
getPerson() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
let person = new Person();
|
||||
let getPerson = person.getPerson;
|
||||
|
||||
getPerson() === person;
|
||||
|
||||
//
|
||||
// @readonly
|
||||
//
|
||||
|
||||
import { readonly } from 'core-decorators';
|
||||
|
||||
class Meal {
|
||||
@readonly
|
||||
entree: string = 'steak';
|
||||
}
|
||||
|
||||
var dinner = new Meal();
|
||||
dinner.entree = 'salmon';
|
||||
|
||||
//
|
||||
// @override
|
||||
//
|
||||
|
||||
import { override } from 'core-decorators';
|
||||
|
||||
class Parent {
|
||||
speak(first: string, second: string) {}
|
||||
}
|
||||
|
||||
class Child extends Parent {
|
||||
@override
|
||||
speak() {}
|
||||
// SyntaxError: Child#speak() does not properly override Parent#speak(first, second)
|
||||
}
|
||||
|
||||
// or
|
||||
|
||||
class Child2 extends Parent {
|
||||
@override
|
||||
speaks() {}
|
||||
// SyntaxError: No descriptor matching Child#speaks() was found on the prototype chain.
|
||||
//
|
||||
// Did you mean "speak"?
|
||||
}
|
||||
|
||||
//
|
||||
// @deprecate (alias: @deprecated)
|
||||
//
|
||||
|
||||
import { deprecate, deprecated } from 'core-decorators';
|
||||
|
||||
class Person2 {
|
||||
@deprecate
|
||||
facepalm() {}
|
||||
|
||||
@deprecate('We stopped facepalming')
|
||||
facepalmHard() {}
|
||||
|
||||
@deprecate('We stopped facepalming', { url: 'http://knowyourmeme.com/memes/facepalm' })
|
||||
facepalmHarder() {}
|
||||
}
|
||||
|
||||
let person2 = new Person2();
|
||||
|
||||
person2.facepalm();
|
||||
// DEPRECATION Person#facepalm: This function will be removed in future versions.
|
||||
|
||||
person2.facepalmHard();
|
||||
// DEPRECATION Person#facepalmHard: We stopped facepalming
|
||||
|
||||
person2.facepalmHarder();
|
||||
// DEPRECATION Person#facepalmHarder: We stopped facepalming
|
||||
//
|
||||
// See http://knowyourmeme.com/memes/facepalm for more details.
|
||||
//
|
||||
|
||||
//
|
||||
// @debounce
|
||||
//
|
||||
|
||||
import { debounce } from 'core-decorators';
|
||||
|
||||
class Editor {
|
||||
|
||||
content = '';
|
||||
|
||||
@debounce(500)
|
||||
updateContent(content: string) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// @suppressWarnings
|
||||
//
|
||||
|
||||
import { suppressWarnings } from 'core-decorators';
|
||||
|
||||
class Person3 {
|
||||
@deprecated
|
||||
facepalm() {}
|
||||
|
||||
@suppressWarnings
|
||||
facepalmWithoutWarning() {
|
||||
this.facepalm();
|
||||
}
|
||||
}
|
||||
|
||||
let person3 = new Person3();
|
||||
|
||||
person3.facepalmWithoutWarning();
|
||||
// no warning is logged
|
||||
|
||||
//
|
||||
// @nonenumerable
|
||||
//
|
||||
|
||||
import { nonenumerable } from 'core-decorators';
|
||||
|
||||
class Meal2 {
|
||||
entree = 'steak';
|
||||
|
||||
@nonenumerable
|
||||
cost: number = 4.44;
|
||||
}
|
||||
|
||||
var dinner2 = new Meal2();
|
||||
for (var key in dinner2) {
|
||||
key;
|
||||
// "entree" only, not "cost"
|
||||
}
|
||||
|
||||
Object.keys(dinner2);
|
||||
// ["entree"]
|
||||
|
||||
//
|
||||
// @nonconfigurable
|
||||
//
|
||||
|
||||
import { nonconfigurable } from 'core-decorators';
|
||||
|
||||
class Meal3 {
|
||||
@nonconfigurable
|
||||
entree: string = 'steak';
|
||||
}
|
||||
|
||||
var dinner3 = new Meal3();
|
||||
|
||||
Object.defineProperty(dinner3, 'entree', {
|
||||
enumerable: false
|
||||
});
|
||||
// Cannot redefine property: entree
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
--experimentalDecorators --noImplicitAny --target ES5
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
// Type definitions for core-decorators.js v0.1.5
|
||||
// Project: https://github.com/jayphelps/core-decorators.js
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "core-decorators" {
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target: TFunction): TFunction|void;
|
||||
}
|
||||
|
||||
export interface ParameterDecorator {
|
||||
(target: Object, propertyKey: string|symbol, parameterIndex: number): void;
|
||||
}
|
||||
|
||||
export interface PropertyDecorator {
|
||||
(target: Object, propertyKey: string|symbol): void;
|
||||
}
|
||||
|
||||
export interface MethodDecorator {
|
||||
<T>(target: Object, propertyKey: string|symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>|void;
|
||||
}
|
||||
|
||||
export interface PropertyOrMethodDecorator extends MethodDecorator, PropertyDecorator {
|
||||
(target: Object, propertyKey: string|symbol): void;
|
||||
}
|
||||
|
||||
export interface Deprecate extends MethodDecorator {
|
||||
(message?: string, option?: DeprecateOption): MethodDecorator;
|
||||
}
|
||||
|
||||
export interface DeprecateOption {
|
||||
url: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces invocations of this function to always have this refer to the class instance,
|
||||
* even if the function is passed around or would otherwise lose its this context. e.g. var fn = context.method;
|
||||
*/
|
||||
var autobind: MethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being writable.
|
||||
*/
|
||||
var readonly: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Checks that the marked method indeed overrides a function with the same signature somewhere on the prototype chain.
|
||||
*/
|
||||
var override: MethodDecorator;
|
||||
/**
|
||||
* Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading.
|
||||
*/
|
||||
var deprecate: Deprecate;
|
||||
/**
|
||||
* Calls console.warn() with a deprecation message. Provide a custom message to override the default one. You can also provide an options hash with a url, for further reading.
|
||||
*/
|
||||
var deprecated: Deprecate;
|
||||
/**
|
||||
* Creates a new debounced function which will be invoked after wait milliseconds since the time it was invoked. Default timeout is 300 ms.
|
||||
*/
|
||||
var debounce: (wait: number) => MethodDecorator;
|
||||
/**
|
||||
* Suppresses any JavaScript console.warn() call while the decorated function is called. (i.e. on the stack)
|
||||
*/
|
||||
var suppressWarnings: MethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being enumerable.
|
||||
*/
|
||||
var nonenumerable: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Marks a property or method as not being writable.
|
||||
*/
|
||||
var nonconfigurable: PropertyOrMethodDecorator;
|
||||
/**
|
||||
* Initial implementation included, likely slow. WIP.
|
||||
*/
|
||||
var memoize: MethodDecorator;
|
||||
|
||||
export {
|
||||
autobind,
|
||||
readonly,
|
||||
override,
|
||||
deprecate,
|
||||
deprecated,
|
||||
debounce,
|
||||
suppressWarnings,
|
||||
nonenumerable,
|
||||
nonconfigurable,
|
||||
memoize // WIP
|
||||
};
|
||||
}
|
||||
+44
-42
@@ -139,7 +139,7 @@ function groupedBarChart() {
|
||||
.style("text-anchor", "end")
|
||||
.text("Population");
|
||||
|
||||
var state = svg.selectAll(".state")
|
||||
var state = svg.selectAll(".state")
|
||||
.data(data)
|
||||
.enter().append("g")
|
||||
.attr("class", "g")
|
||||
@@ -672,8 +672,8 @@ function dragMultiples() {
|
||||
|
||||
function dragmove(d: { x: number; y: number }) {
|
||||
d3.select(this)
|
||||
.attr("cx", d.x = Math.max(radius, Math.min(width - radius, (<any> d3.event).x)))
|
||||
.attr("cy", d.y = Math.max(radius, Math.min(height - radius, (<any> d3.event).y)));
|
||||
.attr("cx", d.x = Math.max(radius, Math.min(width - radius, (<d3.DragEvent> d3.event).x)))
|
||||
.attr("cy", d.y = Math.max(radius, Math.min(height - radius, (<d3.DragEvent> d3.event).y)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -873,7 +873,7 @@ function populationPyramid() {
|
||||
// Allow the arrow keys to change the displayed year.
|
||||
window.focus();
|
||||
d3.select(window).on("keydown", function () {
|
||||
switch (d3.event.keyCode) {
|
||||
switch ((<KeyboardEvent> d3.event).keyCode) {
|
||||
case 37: year = Math.max(year0, year - 10); break;
|
||||
case 39: year = Math.min(year1, year + 10); break;
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@ function azimuthalEquidistant() {
|
||||
.translate([width / 2, height / 2])
|
||||
.clipAngle(180 - 1e-3)
|
||||
.precision(.1);
|
||||
|
||||
|
||||
var path = d3.geo.path()
|
||||
.projection(projection);
|
||||
|
||||
@@ -1209,7 +1209,7 @@ function azimuthalEquidistant() {
|
||||
|
||||
d3.select(self.frameElement).style("height", height + "px");
|
||||
}
|
||||
|
||||
|
||||
//Example from http://bl.ocks.org/mbostock/4060366
|
||||
function voronoiTesselation() {
|
||||
var width = 960,
|
||||
@@ -1237,7 +1237,7 @@ function voronoiTesselation() {
|
||||
.attr("r", 2);
|
||||
|
||||
redraw();
|
||||
|
||||
|
||||
function redraw() {
|
||||
path = path.data(voronoi(vertices).map(function (d) { return "M" + d.join("L") + "Z"; } ), String);
|
||||
path.exit().remove();
|
||||
@@ -1254,7 +1254,7 @@ function forceDirectedVoronoi() {
|
||||
simulate = true,
|
||||
zoomToAdd = true,
|
||||
color = d3.scale.quantize<string>().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"])
|
||||
|
||||
|
||||
var numVertices = (w*h) / 3000;
|
||||
var vertices = d3.range(numVertices).map(function(i) {
|
||||
var angle = radius * (i+10);
|
||||
@@ -1266,15 +1266,15 @@ function forceDirectedVoronoi() {
|
||||
var prevEventScale = 1;
|
||||
var zoom = d3.behavior.zoom().on("zoom", function(d,i) {
|
||||
if (zoomToAdd){
|
||||
if ((<any> d3.event).scale > prevEventScale) {
|
||||
var angle = radius * vertices.length;
|
||||
vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)})
|
||||
} else if (vertices.length > 2 && (<any> d3.event).scale != prevEventScale) {
|
||||
vertices.pop();
|
||||
}
|
||||
force.nodes(vertices).start()
|
||||
if ((<d3.ZoomEvent> d3.event).scale > prevEventScale) {
|
||||
var angle = radius * vertices.length;
|
||||
vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)})
|
||||
} else if (vertices.length > 2 && (<d3.ZoomEvent> d3.event).scale != prevEventScale) {
|
||||
vertices.pop();
|
||||
}
|
||||
force.nodes(vertices).start()
|
||||
} else {
|
||||
if ((<any> d3.event).scale > prevEventScale) {
|
||||
if ((<d3.ZoomEvent> d3.event).scale > prevEventScale) {
|
||||
radius+= .01
|
||||
} else {
|
||||
radius -= .01
|
||||
@@ -1285,18 +1285,18 @@ function forceDirectedVoronoi() {
|
||||
});
|
||||
force.nodes(vertices).start()
|
||||
}
|
||||
prevEventScale = (<any> d3.event).scale;
|
||||
prevEventScale = (<d3.ZoomEvent> d3.event).scale;
|
||||
});
|
||||
|
||||
|
||||
d3.select(window)
|
||||
.on("keydown", function() {
|
||||
// shift
|
||||
if(d3.event.keyCode == 16) {
|
||||
if((<KeyboardEvent> d3.event).keyCode == 16) {
|
||||
zoomToAdd = false
|
||||
}
|
||||
|
||||
|
||||
// s
|
||||
if(d3.event.keyCode == 83) {
|
||||
if((<KeyboardEvent> d3.event).keyCode == 83) {
|
||||
simulate = !simulate
|
||||
if(simulate) {
|
||||
force.start()
|
||||
@@ -1308,38 +1308,38 @@ function forceDirectedVoronoi() {
|
||||
.on("keyup", function() {
|
||||
zoomToAdd = true
|
||||
})
|
||||
|
||||
|
||||
var svg = d3.select("#chart")
|
||||
.append("svg")
|
||||
.attr("width", w)
|
||||
.attr("height", h)
|
||||
.call(zoom)
|
||||
|
||||
|
||||
var force = d3.layout.force()
|
||||
.charge(-300)
|
||||
.size([w, h])
|
||||
.on("tick", update);
|
||||
|
||||
|
||||
force.nodes(vertices).start();
|
||||
|
||||
|
||||
var circle = <d3.selection.Update<any>> svg.selectAll("circle");
|
||||
var path = <d3.selection.Update<any>> svg.selectAll("path");
|
||||
var link = <d3.selection.Update<any>> svg.selectAll("line");
|
||||
|
||||
|
||||
function update() {
|
||||
path = path.data(d3_geom_voronoi(vertices));
|
||||
path.enter().append("path")
|
||||
// drag node by dragging cell
|
||||
.call(d3.behavior.drag()
|
||||
.on("drag", function(d, i) {
|
||||
vertices[i] = {x: vertices[i].x + (<any> d3.event).dx, y: vertices[i].y + (<any> d3.event).dy}
|
||||
vertices[i] = {x: vertices[i].x + (<d3.DragEvent> d3.event).dx, y: vertices[i].y + (<d3.DragEvent> d3.event).dy}
|
||||
})
|
||||
)
|
||||
.style("fill", function(d, i) { return color(0) })
|
||||
path.attr("d", function(d) { return "M" + d.join("L") + "Z"; })
|
||||
.transition().duration(150).style("fill", function(d, i) { return color(d3.geom.polygon(d).area()) })
|
||||
path.exit().remove();
|
||||
|
||||
|
||||
circle = circle.data(vertices)
|
||||
circle.enter().append("circle")
|
||||
.attr("r", 0)
|
||||
@@ -1347,16 +1347,16 @@ function forceDirectedVoronoi() {
|
||||
circle.attr("cx", function(d) { return d.x; })
|
||||
.attr("cy", function(d) { return d.y; });
|
||||
circle.exit().transition().attr("r", 0).remove();
|
||||
|
||||
|
||||
link = link.data(d3_geom_voronoi.links(vertices))
|
||||
link.enter().append("line")
|
||||
link.attr("x1", function(d) { return d.source.x; })
|
||||
.attr("y1", function(d) { return d.source.y; })
|
||||
.attr("x2", function(d) { return d.target.x; })
|
||||
.attr("y2", function(d) { return d.target.y; })
|
||||
|
||||
|
||||
link.exit().remove()
|
||||
|
||||
|
||||
if(!simulate) force.stop()
|
||||
}
|
||||
}
|
||||
@@ -1521,7 +1521,7 @@ module hierarchicalEdgeBundling {
|
||||
.value(function (d) { return d.size; } );
|
||||
|
||||
var bundle = d3.layout.bundle<Result>();
|
||||
|
||||
|
||||
var line = d3.svg.line.radial<Result>()
|
||||
.interpolate("bundle")
|
||||
.tension(.85)
|
||||
@@ -1851,7 +1851,7 @@ function chordDiagram() {
|
||||
[8010, 16145, 8090, 8045],
|
||||
[1013, 990, 940, 6907]
|
||||
];
|
||||
|
||||
|
||||
var chord = d3.layout.chord()
|
||||
.padding(.05)
|
||||
.sortSubgroups(d3.descending)
|
||||
@@ -2031,7 +2031,7 @@ function irisParallel() {
|
||||
}
|
||||
|
||||
function drag(d: string) {
|
||||
x.range()[i] = (<any> d3.event).x;
|
||||
x.range()[i] = (<d3.DragEvent> d3.event).x;
|
||||
traits.sort(function (a, b) { return x(a) - x(b); } );
|
||||
g.attr("transform", function (d) { return "translate(" + x(d) + ")"; } );
|
||||
foreground.attr("d", path);
|
||||
@@ -2085,14 +2085,14 @@ function healthAndWealth() {
|
||||
// The x & y axes.
|
||||
var xAxis = d3.svg.axis().orient("bottom").scale(xScale).ticks(12, d3.format(",d")),
|
||||
yAxis = d3.svg.axis().scale(yScale).orient("left");
|
||||
|
||||
|
||||
// Create the SVG container and set the origin.
|
||||
var svg = d3.select("#chart").append("svg")
|
||||
.attr("width", width + margin.left + margin.right)
|
||||
.attr("height", height + margin.top + margin.bottom)
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
||||
|
||||
|
||||
// Add the x-axis.
|
||||
svg.append("g")
|
||||
.attr("class", "x axis")
|
||||
@@ -2152,7 +2152,7 @@ function healthAndWealth() {
|
||||
|
||||
// Add an overlay for the year label.
|
||||
var box = (<SVGTextElement>label.node()).getBBox();
|
||||
|
||||
|
||||
var overlay = svg.append("rect")
|
||||
.attr("class", "overlay")
|
||||
.attr("x", box.x)
|
||||
@@ -2669,12 +2669,14 @@ function multiTest() {
|
||||
function testD3Events () {
|
||||
d3.select('svg')
|
||||
.on('click', () => {
|
||||
var coords = [d3.event.pageX, d3.event.pageY];
|
||||
console.log("clicked", d3.event.target, "at " + coords);
|
||||
let e = <MouseEvent>d3.event;
|
||||
var coords = [e.pageX, e.pageY];
|
||||
console.log("clicked", e.target, "at " + coords);
|
||||
})
|
||||
.on('keypress', () => {
|
||||
if (d3.event.shiftKey) {
|
||||
console.log('shift + ' + d3.event.which);
|
||||
let e = <KeyboardEvent>d3.event;
|
||||
if (e.shiftKey) {
|
||||
console.log('shift + ' + e.which);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2690,4 +2692,4 @@ function testD3MutlieTimeFormat() {
|
||||
["%B", function(d) { return d.getMonth(); }],
|
||||
["%Y", function() { return true; }]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+24
-7
@@ -807,7 +807,7 @@ declare module d3 {
|
||||
interface Transition<Datum> {
|
||||
|
||||
transition(): Transition<Datum>;
|
||||
|
||||
|
||||
delay(): number;
|
||||
delay(delay: number): Transition<Datum>;
|
||||
delay(delay: (datum: Datum, index: number, outerIndex: number) => number): Transition<Datum>;
|
||||
@@ -920,16 +920,33 @@ declare module d3 {
|
||||
export function flush(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface for any and all d3 events.
|
||||
*/
|
||||
interface Event extends KeyboardEvent, MouseEvent {
|
||||
}
|
||||
interface BaseEvent {
|
||||
type: string;
|
||||
sourceEvent?: Event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a D3-specific ZoomEvent per https://github.com/mbostock/d3/wiki/Zoom-Behavior#event
|
||||
*/
|
||||
interface ZoomEvent extends BaseEvent {
|
||||
scale: number;
|
||||
translate: [number, number];
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a D3-specific DragEvent per https://github.com/mbostock/d3/wiki/Drag-Behavior#on
|
||||
*/
|
||||
interface DragEvent extends BaseEvent {
|
||||
x: number;
|
||||
y: number;
|
||||
dx: number;
|
||||
dy: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The current event's value. Use this variable in a handler registered with `selection.on`.
|
||||
*/
|
||||
export var event: Event;
|
||||
export var event: Event | BaseEvent;
|
||||
|
||||
/**
|
||||
* Returns the x and y coordinates of the mouse relative to the provided container element, using d3.event for the mouse's position on the page.
|
||||
|
||||
Vendored
+1
-1
@@ -107,7 +107,7 @@ declare module "express" {
|
||||
use(path: string, ...handler: RequestHandler[]): T;
|
||||
use(path: string, handler: ErrorRequestHandler): T;
|
||||
use(path: string[], ...handler: RequestHandler[]): T;
|
||||
use(path: string[], handler: ErrorRequestHandler[]): T;
|
||||
use(path: string[], handler: ErrorRequestHandler): T;
|
||||
}
|
||||
|
||||
export function Router(options?: any): Router;
|
||||
|
||||
@@ -11,3 +11,7 @@ str = findup(['foo', 'bar']);
|
||||
str = findup('foo', {
|
||||
debug: true
|
||||
});
|
||||
|
||||
str = findup('foo', {
|
||||
cwd: "c:\\"
|
||||
});
|
||||
|
||||
Vendored
+7
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for findup-sync v0.1.3
|
||||
// Type definitions for findup-sync v0.3.0
|
||||
// Project: https://github.com/cowboy/node-findup-sync
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Nathan Brown <https://github.com/ngbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../minimatch/minimatch.d.ts" />
|
||||
@@ -8,8 +8,11 @@
|
||||
declare module 'findup-sync' {
|
||||
import minimatch = require('minimatch');
|
||||
|
||||
function mod(pattern: string, opts?: minimatch.IOptions): string;
|
||||
function mod(pattern: string[], opts?: minimatch.IOptions): string;
|
||||
interface IOptions extends minimatch.IOptions {
|
||||
cwd?: string;
|
||||
}
|
||||
|
||||
function mod(pattern: string[] | string, opts?: IOptions): string;
|
||||
|
||||
export = mod;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/// <reference path="flowjs.d.ts" />
|
||||
|
||||
// flow object
|
||||
var flowObject: flowjs.IFlow;
|
||||
var bool: boolean = flowObject.support;
|
||||
bool = flowObject.supportDirectory;
|
||||
var obj: Object = flowObject.opts;
|
||||
var flowFileArray: flowjs.IFlowFile[] = flowObject.files;
|
||||
|
||||
flowObject.assignBrowse(<HTMLElement[]> [], false, false, {});
|
||||
flowObject.assignDrop(<HTMLElement[]> []);
|
||||
flowObject.unAssignDrop(<HTMLElement[]> []);
|
||||
flowObject.on("", () => {});
|
||||
flowObject.off("", () => {});
|
||||
flowObject.upload();
|
||||
flowObject.pause();
|
||||
flowObject.resume();
|
||||
flowObject.cancel();
|
||||
flowObject.progress();
|
||||
bool = flowObject.isUploading();
|
||||
flowObject.addFile(<File> {});
|
||||
flowObject.removeFile(<flowjs.IFlowFile> {});
|
||||
var flowFile: flowjs.IFlowFile = flowObject.getFromUniqueIdentifier("");
|
||||
var num: number = flowObject.getSize();
|
||||
num = flowObject.sizeUploaded();
|
||||
num = flowObject.timeRemaining();
|
||||
|
||||
// flow options
|
||||
var flowOptions: flowjs.IFlowOptions = {};
|
||||
flowOptions.target = "";
|
||||
flowOptions.singleFile = true;
|
||||
flowOptions.chunkSize= 0;
|
||||
flowOptions.forceChunkSize = true;
|
||||
flowOptions.simultaneousUploads= 0;
|
||||
flowOptions.fileParameterName = "";
|
||||
flowOptions.query = {};
|
||||
flowOptions.headers = {};
|
||||
flowOptions.withCredentials = true;
|
||||
flowOptions.method = "";
|
||||
flowOptions.testMethod = "";
|
||||
flowOptions.uploadMethod = "";
|
||||
flowOptions.allowDuplicateUploads = true;
|
||||
flowOptions.prioritizeFirstAndLastChunk = true;
|
||||
flowOptions.testchunks = true;
|
||||
flowOptions.preprocess = () => {};
|
||||
flowOptions.initFileFn = () => {};
|
||||
flowOptions.generateUniqueIdentifier = () => {};
|
||||
flowOptions.maxChunkRetries= 0;
|
||||
flowOptions.chunkRetryInterval= 0;
|
||||
flowOptions.progressCallbacksInterval= 0;
|
||||
flowOptions.speedSmoothingFactor= 0;
|
||||
flowOptions.successStatuses = [""];
|
||||
flowOptions.permanentErrors = [""];
|
||||
|
||||
// flow file
|
||||
flowObject = flowFile.flowObj;
|
||||
var htmlFile: File = flowFile.file;
|
||||
var str: string = flowFile.name;
|
||||
str = flowFile.relativePath;
|
||||
num = flowFile.size;
|
||||
str = flowFile.uniqueIdentifier;
|
||||
num = flowFile.averageSpeed;
|
||||
num = flowFile.currentSpeed;
|
||||
var anyArray: any[] = flowFile.chunks;
|
||||
bool = flowFile.paused;
|
||||
bool = flowFile.error;
|
||||
num = flowFile.progress(true);
|
||||
flowFile.pause();
|
||||
flowFile.resume();
|
||||
flowFile.cancel();
|
||||
flowFile.retry();
|
||||
flowFile.bootstrap();
|
||||
bool = flowFile.isUploading();
|
||||
bool = flowFile.isComplete;
|
||||
num = flowFile.sizeUploaded;
|
||||
num = flowFile.timeRemaining;
|
||||
str = flowFile.getExtension;
|
||||
str = flowFile.getType;
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
// Type definitions for flowjs
|
||||
// Project: https://github.com/flowjs/flow.js
|
||||
// Definitions by: Ryan McNamara <https://github.com/ryan10132>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module flowjs {
|
||||
interface IFlow {
|
||||
support: boolean;
|
||||
supportDirectory: boolean;
|
||||
opts: Object;
|
||||
files: IFlowFile[];
|
||||
|
||||
assignBrowse(domNodes: HTMLElement[], isDirectory: boolean, singleFile: boolean, attributes: Object): void;
|
||||
assignDrop(domNodes: HTMLElement[]): void;
|
||||
unAssignDrop(domNodes: HTMLElement[]): void;
|
||||
on(event: string, callback: Function): void;
|
||||
off(event?: string, callback?: Function): void;
|
||||
upload(): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
cancel(): void;
|
||||
progress(): number;
|
||||
isUploading(): boolean;
|
||||
addFile(file: File): void;
|
||||
removeFile(file: IFlowFile): void;
|
||||
getFromUniqueIdentifier(uniqueIdentifier: string): IFlowFile;
|
||||
getSize(): number;
|
||||
sizeUploaded(): number;
|
||||
timeRemaining(): number;
|
||||
}
|
||||
|
||||
interface IFlowOptions {
|
||||
target?: string;
|
||||
singleFile?: boolean;
|
||||
chunkSize?: number;
|
||||
forceChunkSize?: boolean;
|
||||
simultaneousUploads?: number;
|
||||
fileParameterName?: string;
|
||||
query?: Object;
|
||||
headers?: Object;
|
||||
withCredentials?: boolean;
|
||||
method?: string;
|
||||
testMethod?: string;
|
||||
uploadMethod?: string;
|
||||
allowDuplicateUploads?: boolean;
|
||||
prioritizeFirstAndLastChunk?: boolean;
|
||||
testchunks?: boolean;
|
||||
preprocess?: Function;
|
||||
initFileFn?: Function;
|
||||
generateUniqueIdentifier?: Function;
|
||||
maxChunkRetries?: number;
|
||||
chunkRetryInterval?: number;
|
||||
progressCallbacksInterval?: number;
|
||||
speedSmoothingFactor?: number;
|
||||
successStatuses?: string[];
|
||||
permanentErrors?: string[];
|
||||
}
|
||||
|
||||
interface IFlowFile {
|
||||
flowObj: IFlow;
|
||||
file: File;
|
||||
name: string;
|
||||
relativePath: string;
|
||||
size: number;
|
||||
uniqueIdentifier: string;
|
||||
averageSpeed: number;
|
||||
currentSpeed: number;
|
||||
chunks: any[];
|
||||
paused: boolean;
|
||||
error: boolean;
|
||||
|
||||
progress(relative: boolean): number;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
cancel(): void;
|
||||
retry(): void;
|
||||
bootstrap(): void;
|
||||
isUploading(): boolean;
|
||||
isComplete: boolean;
|
||||
sizeUploaded: number;
|
||||
timeRemaining: number;
|
||||
getExtension: string;
|
||||
getType: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
///<reference path="graphviz.d.ts"/>
|
||||
|
||||
import graphviz = require('graphviz');
|
||||
|
||||
// Create digraph G
|
||||
var g: graphviz.Graph = graphviz.digraph("G");
|
||||
|
||||
// Add node (ID: Hello)
|
||||
var n1: graphviz.Node = g.addNode( "Hello", {"color" : "blue"} );
|
||||
n1.set( "style", "filled" );
|
||||
|
||||
// Add node (ID: World)
|
||||
g.addNode( "World" );
|
||||
|
||||
// Add edge between the two nodes
|
||||
var e: graphviz.Edge = g.addEdge( n1, "World" );
|
||||
e.set( "color", "red" );
|
||||
|
||||
// Print the dot script
|
||||
console.log( g.to_dot() );
|
||||
|
||||
// Set GraphViz path (if not in your path)
|
||||
g.setGraphVizPath( "/usr/local/bin" );
|
||||
|
||||
// Generate a PNG output
|
||||
g.output( "png", "test01.png" );
|
||||
Vendored
+93
@@ -0,0 +1,93 @@
|
||||
// Type definitions for Graphviz 0.0.8
|
||||
// Project: git://github.com/glejeune/node-graphviz.git
|
||||
// Definitions by: Matt Frantz <https://github.com/mhfrantz/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// graphviz.d.ts
|
||||
|
||||
declare module 'graphviz' {
|
||||
|
||||
export interface HasAttributes {
|
||||
set(name: string, value: any): void;
|
||||
get(name: string): any;
|
||||
}
|
||||
|
||||
export interface Node extends HasAttributes {
|
||||
}
|
||||
|
||||
export interface Edge extends HasAttributes {
|
||||
}
|
||||
|
||||
export interface OutputCallback {
|
||||
(data: string): void;
|
||||
}
|
||||
|
||||
export interface ErrorCallback {
|
||||
(code: number, stdout: string, stderr: string): void;
|
||||
}
|
||||
|
||||
export interface RenderOptions {
|
||||
type: string; // output file type (png, jpeg, ps, ...)
|
||||
use: string; // Graphviz command to use (dot, neato, ...)
|
||||
path: string; // GraphViz path
|
||||
G: any; // graph options
|
||||
N: any; // node options
|
||||
E: any; // edge options
|
||||
}
|
||||
|
||||
export interface Graph extends HasAttributes {
|
||||
|
||||
addNode(id: string, attrs?: any): Node;
|
||||
nodeCount(): number;
|
||||
|
||||
// TODO: Use union types when we have TS 1.4
|
||||
addEdge(nodeOne: string, nodeTwo: string, attrs?: any): Edge;
|
||||
addEdge(nodeOne: string, nodeTwo: Node, attrs?: any): Edge;
|
||||
addEdge(nodeOne: Node, nodeTwo: string, attrs?: any): Edge;
|
||||
addEdge(nodeOne: Node, nodeTwo: Node, attrs?: any): Edge;
|
||||
|
||||
edgeCount(): number;
|
||||
|
||||
// Subgraph (cluster) API
|
||||
addCluster(id: string): Graph;
|
||||
getCluster(id: string): Graph;
|
||||
clusterCount(): number;
|
||||
|
||||
setNodeAttribut(name: string, value: any): void;
|
||||
getNodeAttribut(name: string): any;
|
||||
|
||||
setEdgeAttribut(name: string, value: any): void;
|
||||
getEdgeAttribut(name: string): any;
|
||||
|
||||
to_dot(): string;
|
||||
|
||||
// Graphviz command to use (dot, neato, ...)
|
||||
use: string;
|
||||
|
||||
// Path containing Graphviz binaries.
|
||||
setGraphVizPath(directoryPath: string): void;
|
||||
|
||||
// TODO: Use union types when we can have TS 1.4
|
||||
render(type: string, filename: string, errback?: ErrorCallback): void;
|
||||
render(options: RenderOptions, filename: string, errback?: ErrorCallback): void;
|
||||
render(type: string, callback: OutputCallback, errback?: ErrorCallback): void;
|
||||
render(options: RenderOptions, callback: OutputCallback, errback?: ErrorCallback): void;
|
||||
|
||||
// alias for render
|
||||
output(type: string, filename: string, errback?: ErrorCallback): void;
|
||||
output(options: RenderOptions, filename: string, errback?: ErrorCallback): void;
|
||||
output(type: string, callback: OutputCallback, errback?: ErrorCallback): void;
|
||||
output(options: RenderOptions, callback: OutputCallback, errback?: ErrorCallback): void;
|
||||
}
|
||||
|
||||
export function graph(id: string): Graph;
|
||||
|
||||
export function digraph(id: string): Graph;
|
||||
|
||||
interface ParseCallback {
|
||||
(graph: Graph): void;
|
||||
}
|
||||
|
||||
export function parse(path: string, callback: ParseCallback, errback?: ErrorCallback): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="gridstack.d.ts" />
|
||||
|
||||
|
||||
// Type definitions for Gridstack
|
||||
// Project: http://troolee.github.io/gridstack.js/
|
||||
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
var options = <IGridstackOptions> {
|
||||
float: true
|
||||
};
|
||||
var gridstack:GridStack = $(document).gridstack(options);
|
||||
|
||||
gridstack.add_widget("test", 1, 2, 3, 4, true);
|
||||
gridstack.batch_update();
|
||||
gridstack.cell_height();;
|
||||
gridstack.cell_height(2);
|
||||
gridstack.cell_width();
|
||||
gridstack.get_cell_from_pixel(<MousePosition>{ left:20, top: 20 });
|
||||
Vendored
+241
@@ -0,0 +1,241 @@
|
||||
// Type definitions for Gridstack
|
||||
// Project: http://troolee.github.io/gridstack.js/
|
||||
// Definitions by: Pascal Senn <https://github.com/PascalSenn/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface JQuery {
|
||||
gridstack (options: IGridstackOptions):GridStack
|
||||
}
|
||||
|
||||
interface GridStack {
|
||||
/**
|
||||
* Creates new widget and returns it.
|
||||
*
|
||||
* Widget will be always placed even if result height is more than actual grid height. You need to use will_it_fit method before calling add_widget for additional check.
|
||||
*
|
||||
* @param {string} el widget to add
|
||||
* @param {number} x widget position x
|
||||
* @param {number} y widget position y
|
||||
* @param {number} width widget dimension width
|
||||
* @param {number} height widget dimension height
|
||||
* @param {boolean} auto_position if true then x, y parameters will be ignored and widget will be places on the first available position
|
||||
*/
|
||||
add_widget(el: string, x: number, y: number, width: number, height: number, auto_position: boolean): JQuery
|
||||
/**
|
||||
* Initializes batch updates. You will see no changes until commit method is called.
|
||||
*/
|
||||
batch_update():void
|
||||
/**
|
||||
* Gets current cell height.
|
||||
*/
|
||||
cell_height():number
|
||||
/**
|
||||
* Update current cell height. This method rebuilds an internal CSS style sheet. Note: You can expect performance issues if call this method too often.
|
||||
* @param {number} val the cell height
|
||||
*/
|
||||
cell_height(val:number):void
|
||||
/**
|
||||
* Gets current cell width.
|
||||
*/
|
||||
cell_width():number
|
||||
/**
|
||||
* Finishes batch updates. Updates DOM nodes. You must call it after batch_update.
|
||||
*/
|
||||
commit():void
|
||||
/**
|
||||
* Destroys a grid instance.
|
||||
*/
|
||||
destroy(): void
|
||||
/*
|
||||
* Disables widgets moving/resizing.
|
||||
*/
|
||||
disable(): void
|
||||
/*
|
||||
* Enables widgets moving/resizing.
|
||||
*/
|
||||
enable(): void
|
||||
/*
|
||||
* Get the position of the cell under a pixel on screen.
|
||||
* @param {MousePosition} position the position of the pixel to resolve in absolute coordinates, as an object with top and leftproperties
|
||||
*/
|
||||
get_cell_from_pixel(position: MousePosition): CellPosition,
|
||||
/*
|
||||
* Checks if specified area is empty.
|
||||
* @param {number} x the position x.
|
||||
* @param {number} y the position y.
|
||||
* @param {number} width the width of to check
|
||||
* @param {number} height the height of to check
|
||||
*/
|
||||
is_area_empty(x: number, y: number, width: number, height: number): void
|
||||
/*
|
||||
* Locks/unlocks widget.
|
||||
* @param {HTMLElement} el widget to modify.
|
||||
* @param {boolean} val if true widget will be locked.
|
||||
*/
|
||||
locked(el: HTMLElement, val: boolean): void
|
||||
/*
|
||||
* Set the minWidth for a widget.
|
||||
* @param {HTMLElement} el widget to modify.
|
||||
* @param {number} val A numeric value of the number of columns
|
||||
*/
|
||||
min_width(el: HTMLElement, val: number): void
|
||||
/*
|
||||
* Set the minHeight for a widget.
|
||||
* @param {HTMLElement} el widget to modify.
|
||||
* @param {number} val A numeric value of the number of rows
|
||||
*/
|
||||
min_height(el: HTMLElement, val: number): void
|
||||
/*
|
||||
* Enables/Disables moving.
|
||||
* @param {HTMLElement} el widget to modify.
|
||||
* @param {number} val if true widget will be draggable.
|
||||
*/
|
||||
movable(el: HTMLElement, val: boolean): void
|
||||
/**
|
||||
* Changes widget position
|
||||
* @param {HTMLElement} el widget to modify
|
||||
* @param {number} x new position x. If value is null or undefined it will be ignored.
|
||||
* @param {number} y new position y. If value is null or undefined it will be ignored.
|
||||
*
|
||||
*/
|
||||
move(el: HTMLElement, x: number, y: number): void
|
||||
/**
|
||||
* Removes widget from the grid.
|
||||
* @param {HTMLElement} el widget to modify
|
||||
* @param {boolean} detach_node if false DOM node won't be removed from the tree (Optional. Default true).
|
||||
*/
|
||||
remove_widget(el: HTMLElement, detach_node?: boolean): void
|
||||
/**
|
||||
* Removes all widgets from the grid.
|
||||
*/
|
||||
remove_all(): void
|
||||
/**
|
||||
* Changes widget size
|
||||
* @param {HTMLElement} el widget to modify
|
||||
* @param {number} width new dimensions width. If value is null or undefined it will be ignored.
|
||||
* @param {number} height new dimensions height. If value is null or undefined it will be ignored.
|
||||
*/
|
||||
resize(el: HTMLElement, width: number, height: number): void
|
||||
/**
|
||||
* Enables/Disables resizing.
|
||||
* @param {HTMLElement} el widget to modify
|
||||
* @param {boolean} val if true widget will be resizable.
|
||||
*/
|
||||
resizable(el: HTMLElement, val: boolean): void
|
||||
/**
|
||||
* Toggle the grid static state. Also toggle the grid-stack-static class.
|
||||
* @param {boolean} static_value if true the grid become static.
|
||||
*/
|
||||
set_static(static_value: boolean): void
|
||||
/**
|
||||
* Updates widget position/size.
|
||||
* @param {HTMLElement} el widget to modify
|
||||
* @param {number} x new position x. If value is null or undefined it will be ignored.
|
||||
* @param {number} y new position y. If value is null or undefined it will be ignored.
|
||||
* @param {number} width new dimensions width. If value is null or undefined it will be ignored.
|
||||
* @param {number} height new dimensions height. If value is null or undefined it will be ignored.
|
||||
*/
|
||||
update(el: HTMLElement, x: number, y: number, width: number, height: number): void
|
||||
/**
|
||||
* Returns true if the height of the grid will be less the vertical constraint. Always returns true if grid doesn't have height constraint.
|
||||
* @param {number} x new position x. If value is null or undefined it will be ignored.
|
||||
* @param {number} y new position y. If value is null or undefined it will be ignored.
|
||||
* @param {number} width new dimensions width. If value is null or undefined it will be ignored.
|
||||
* @param {number} height new dimensions height. If value is null or undefined it will be ignored.
|
||||
* @param {boolean} auto_position if true then x, y parameters will be ignored and widget will be places on the first available position
|
||||
*/
|
||||
will_it_fit(x: number, y: number, width: number, height: number, auto_position:boolean):boolean
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Defines the coordiantes of a object
|
||||
*/
|
||||
interface MousePosition {
|
||||
top: number,
|
||||
left:number,
|
||||
}
|
||||
/**
|
||||
* Defines the position of a cell inside the grid
|
||||
*/
|
||||
interface CellPosition {
|
||||
x: number,
|
||||
y:number
|
||||
}
|
||||
declare module GridStackUI {
|
||||
interface Utils {
|
||||
/**
|
||||
* Sorts array of nodes
|
||||
*@param nodes array to sort
|
||||
*@param dir 1 for asc, -1 for desc (optional)
|
||||
*@param width width of the grid. If undefined the width will be calculated automatically (optional).
|
||||
**/
|
||||
sort(nodes: HTMLElement[], dir: number, width: number): void
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gridstack Options
|
||||
* Defines the options for a Gridstack
|
||||
*/
|
||||
interface IGridstackOptions {
|
||||
/**
|
||||
* if true the resizing handles are shown even if the user is not hovering over the widget (default: false)
|
||||
*/
|
||||
always_show_resize_handle: boolean;
|
||||
/**
|
||||
* turns animation on (default: true)
|
||||
*/
|
||||
animate: boolean;
|
||||
/**
|
||||
* if false gridstack will not initialize existing items (default: true)
|
||||
*/
|
||||
auto: boolean;
|
||||
/**
|
||||
* one cell height (default: 60)
|
||||
*/
|
||||
cell_height: number;
|
||||
/**
|
||||
* allows to override jQuery UI draggable options. (default: { handle: '.grid-stack-item-content', scroll: true, appendTo: 'body' })
|
||||
*/
|
||||
draggable: {};
|
||||
/**
|
||||
* draggable handle selector (default: '.grid-stack-item-content')
|
||||
*/
|
||||
handle: string;
|
||||
/**
|
||||
* maximum rows amount.Default is 0 which means no maximum rows
|
||||
*/
|
||||
height: number;
|
||||
/**
|
||||
* enable floating widgets (default: false) See example
|
||||
*/
|
||||
float: boolean;
|
||||
/**
|
||||
* widget class (default: 'grid-stack-item')
|
||||
*/
|
||||
item_class: string;
|
||||
/**
|
||||
* minimal width.If window width is less, grid will be shown in one - column mode (default: 768)
|
||||
*/
|
||||
min_width: number;
|
||||
/**
|
||||
* class for placeholder (default: 'grid-stack-placeholder')
|
||||
*/
|
||||
placeholder_class: string;
|
||||
/**
|
||||
* allows to override jQuery UI resizable options. (default: { autoHide: true, handles: 'se' })
|
||||
*/
|
||||
resizable: {};
|
||||
/**
|
||||
* makes grid static (default false).If true widgets are not movable/ resizable.You don't even need jQueryUI draggable/resizable. A CSS class grid-stack-static is also added to the container.
|
||||
*/
|
||||
static_grid: boolean;
|
||||
/**
|
||||
* vertical gap size (default: 20)
|
||||
*/
|
||||
vertical_margin: number;
|
||||
/**
|
||||
* amount of columns (default: 12)
|
||||
*/
|
||||
width: number;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/// <reference path="gulp-svg-sprite.d.ts" />
|
||||
/// <reference path="../gulp/gulp.d.ts" />
|
||||
/// <reference path="../svg-sprite/svg-sprite.d.ts" />
|
||||
|
||||
import svgSprite = require('gulp-svg-sprite');
|
||||
import spriter = require('svg-sprite');
|
||||
import gulp = require('gulp')
|
||||
|
||||
let config: spriter.Config;
|
||||
|
||||
// Basic configuration example
|
||||
config = {
|
||||
mode : {
|
||||
css : { // Activate the «css» mode
|
||||
render : {
|
||||
css : true // Activate CSS output (with default options)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
gulp.src('**/*.svg', {cwd: 'path/to/assets'})
|
||||
.pipe(svgSprite(config))
|
||||
.pipe(gulp.dest('out'));
|
||||
|
||||
|
||||
config = {
|
||||
shape : {
|
||||
dimension : { // Set maximum dimensions
|
||||
maxWidth : 32,
|
||||
maxHeight : 32
|
||||
},
|
||||
spacing : { // Add padding
|
||||
padding : 10
|
||||
},
|
||||
dest : 'out/intermediate-svg' // Keep the intermediate files
|
||||
},
|
||||
mode : {
|
||||
view : { // Activate the «view» mode
|
||||
bust : false,
|
||||
render : {
|
||||
scss : true // Activate Sass output (with default options)
|
||||
}
|
||||
},
|
||||
symbol : true // Activate the «symbol» mode
|
||||
}
|
||||
};
|
||||
|
||||
gulp.src('**/*.svg', {cwd: 'path/to/assets'})
|
||||
.pipe(svgSprite(config))
|
||||
.pipe(gulp.dest('out'));
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for gulp-svg-sprite 1.2.9
|
||||
// Project: https://github.com/jkphl/gulp-svg-sprite
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../svg-sprite/svg-sprite.d.ts" />
|
||||
|
||||
declare module "gulp-svg-sprite" {
|
||||
import spriter = require('svg-sprite');
|
||||
|
||||
namespace svgSprite {
|
||||
interface SvgSprite {
|
||||
(options?: spriter.Config): NodeJS.ReadWriteStream;
|
||||
}
|
||||
}
|
||||
|
||||
var svgSprite: svgSprite.SvgSprite;
|
||||
|
||||
export = svgSprite;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -23,6 +23,7 @@ declare module "gulp-typescript" {
|
||||
sourceRoot?: string;
|
||||
sortOutput?: boolean;
|
||||
target?: string;
|
||||
typescript?: any;
|
||||
}
|
||||
|
||||
interface Project {
|
||||
|
||||
Vendored
+1
-1
@@ -302,7 +302,7 @@ interface SwipeRecognizerStatic
|
||||
new( options?:any ):SwipeRecognizer;
|
||||
}
|
||||
|
||||
interface SwipeRecognizer
|
||||
interface SwipeRecognizer extends AttrRecognizer
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
@@ -122,6 +122,11 @@ declare module jake{
|
||||
* stop execution on error, default true
|
||||
*/
|
||||
breakOnError?:boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
windowsVerbatimArguments?: boolean
|
||||
}
|
||||
export function exec(cmds:string[], callback?:()=>void, opts?:ExecOptions):void;
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="jasmine-es6-promise-matchers.d.ts" />
|
||||
|
||||
describe('specs', () => {
|
||||
beforeEach(() => {
|
||||
JasminePromiseMatchers.install
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
JasminePromiseMatchers.uninstall
|
||||
});
|
||||
|
||||
it('should have correct syntax', (done) => {
|
||||
var foo = {};
|
||||
var bar = {};
|
||||
|
||||
expect(foo).toBeResolvedWith(bar, done);
|
||||
expect(foo).toBeRejectedWith(bar, done);
|
||||
expect(foo).toBeResolved(done);
|
||||
expect(foo).toBeRejected(done);
|
||||
});
|
||||
})
|
||||
@@ -0,0 +1,36 @@
|
||||
// Type definitions for jasmine-es6-promise-matchers
|
||||
// Project: https://github.com/bvaughn/jasmine-es6-promise-matchers
|
||||
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
declare module JasminePromiseMatchers {
|
||||
export function install():void;
|
||||
export function uninstall():void;
|
||||
}
|
||||
|
||||
declare module jasmine {
|
||||
|
||||
interface Matchers {
|
||||
/**
|
||||
* Verifies that a Promise is (or has been) rejected.
|
||||
*/
|
||||
toBeRejected(done?: () => void): boolean;
|
||||
|
||||
/**
|
||||
* Verifies that a Promise is (or has been) rejected with the specified parameter.
|
||||
*/
|
||||
toBeRejectedWith(value: any, done?: () => void): boolean;
|
||||
|
||||
/**
|
||||
* Verifies that a Promise is (or has been) resolved.
|
||||
*/
|
||||
toBeResolved(done?: () => void): boolean;
|
||||
|
||||
/**
|
||||
* Verifies that a Promise is (or has been) resolved with the specified parameter.
|
||||
*/
|
||||
toBeResolvedWith(value: any, done?: () => void): boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
///<reference path="java.d.ts"/>
|
||||
///<reference path="../bluebird/bluebird.d.ts"/>
|
||||
|
||||
import java = require('java');
|
||||
import BluePromise = require('bluebird');
|
||||
|
||||
java.asyncOptions = {
|
||||
syncSuffix: 'Sync',
|
||||
asyncSuffix: '',
|
||||
promiseSuffix: 'P',
|
||||
promisify: BluePromise.promisify
|
||||
};
|
||||
|
||||
java.registerClientP((): Promise<void> => {
|
||||
return BluePromise.resolve();
|
||||
});
|
||||
|
||||
interface ProxyFunctions {
|
||||
[index: string]: Function;
|
||||
}
|
||||
|
||||
java.ensureJvm()
|
||||
.then(() => {
|
||||
|
||||
// java.d.ts does not declare any Java types.
|
||||
// We can import a java class, but we don't know the shape of the class here, so must use any
|
||||
var Boolean: any = java.import('java.lang.Boolean');
|
||||
|
||||
var functions: ProxyFunctions = {
|
||||
accept: function(t: any): void { },
|
||||
andThen: function(after: any): any {}
|
||||
};
|
||||
var proxy: any = java.newProxy('java.util.function.Consumer', functions);
|
||||
});
|
||||
Vendored
+64
@@ -0,0 +1,64 @@
|
||||
// Type definitions for java 0.5.4
|
||||
// Project: https://github.com/joeferner/java
|
||||
// Definitions by: Jim Lloyd <https://github.com/jimlloyd>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
// This is the core API exposed by https://github.com/joeferner/java.
|
||||
// To get the full power of Typescript with Java, see https://github.com/RedSeal-co/ts-java.
|
||||
|
||||
declare module 'java' {
|
||||
var NodeJavaCore: NodeJavaCore.NodeAPI;
|
||||
export = NodeJavaCore;
|
||||
}
|
||||
|
||||
declare module NodeJavaCore {
|
||||
export interface Callback<T> {
|
||||
(err?: Error, result?: T): void;
|
||||
}
|
||||
|
||||
interface Promisify {
|
||||
(funct: Function, receiver?: any): Function;
|
||||
}
|
||||
|
||||
interface AsyncOptions {
|
||||
syncSuffix: string;
|
||||
asyncSuffix?: string;
|
||||
promiseSuffix?: string;
|
||||
promisify?: Promisify;
|
||||
}
|
||||
|
||||
interface ProxyFunctions {
|
||||
[index: string]: Function;
|
||||
}
|
||||
|
||||
// *NodeAPI* declares methods & members exported by the node java module.
|
||||
interface NodeAPI {
|
||||
classpath: string[];
|
||||
asyncOptions: AsyncOptions;
|
||||
callMethod(instance: any, className: string, methodName: string, args: any[], callback: Callback<any>): void;
|
||||
callMethodSync(instance: any, className: string, methodName: string, ...args: any[]): any;
|
||||
callStaticMethodSync(className: string, methodName: string, ...args: any[]): any;
|
||||
instanceOf(javaObject: any, className: string): boolean;
|
||||
registerClient(before: (cb: Callback<void>) => void, after?: (cb: Callback<void>) => void): void;
|
||||
registerClientP(beforeP: () => Promise<void>, afterP?: () => Promise<void>): void;
|
||||
ensureJvm(done: Callback<void>): void;
|
||||
ensureJvm(): Promise<void>;
|
||||
|
||||
newShort(val: number): any;
|
||||
newLong(val: number): any;
|
||||
newFloat(val: number): any;
|
||||
newDouble(val: number): any;
|
||||
|
||||
import(className: string): any;
|
||||
newInstance(className: string, ...args: any[]): void;
|
||||
newInstanceSync(className: string, ...args: any[]): any;
|
||||
newInstanceP(className: string, ...args: any[]): Promise<any>;
|
||||
newArray<T>(className: string, arg: any[]): any;
|
||||
getClassLoader(): any;
|
||||
|
||||
newProxy(interfaceName: string, functions: ProxyFunctions): any;
|
||||
}
|
||||
}
|
||||
@@ -35,3 +35,5 @@ $.cookie("test", testObject, cookieOptions);
|
||||
var result = <TestObject>$.cookie("test");
|
||||
|
||||
console.log(result.text);
|
||||
|
||||
$.cookie.defaults = cookieOptions;
|
||||
|
||||
Vendored
+78
-6
@@ -1,34 +1,106 @@
|
||||
// Type definitions for jQuery Cookie Plugin 1.3
|
||||
// Type definitions for jQuery Cookie Plugin 1.4.1
|
||||
// Project: https://github.com/carhartl/jquery-cookie
|
||||
// Definitions by: Roy Goode <https://github.com/RoyGoode/>
|
||||
// Definitions by: Roy Goode <https://github.com/RoyGoode/>, Ben Lorantfy <https://github.com/BenLorantfy/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
|
||||
interface JQueryCookieOptions {
|
||||
/**
|
||||
* Define lifetime of the cookie. Value can be a Number which will be interpreted as days from time of creation or a Date object. If omitted, the cookie becomes a session cookie.
|
||||
*/
|
||||
expires?: any;
|
||||
/**
|
||||
* Define the path where the cookie is valid. By default the path of the cookie is the path of the page where the cookie was created (standard browser behavior). If you want to make it available for instance across the entire domain use path: '/'. Default: path of page where the cookie was created.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* Define the domain where the cookie is valid. Default: domain of page where the cookie was created.
|
||||
*/
|
||||
domain?: string;
|
||||
/**
|
||||
* If true, the cookie transmission requires a secure protocol (https). Default: false.
|
||||
*/
|
||||
secure?: boolean;
|
||||
}
|
||||
|
||||
//
|
||||
// The following jsdoc comments are used to add intellisense to editors that support it. Uses snippets
|
||||
// of documentation from the Github repo when possible.
|
||||
//
|
||||
// The ordering here matters. For example, the read function with the converter parameter is purposefully after
|
||||
// the set function. This is because the intellisense that shows up after you press comma should be the set first,
|
||||
// since that is more common, then the conversion function if user starts typing a parameter with a function type
|
||||
interface JQueryCookieStatic {
|
||||
/**
|
||||
* By default the cookie value is encoded/decoded when writing/reading, using encodeURIComponent/decodeURIComponent. Bypass this by setting raw to true:
|
||||
*/
|
||||
raw?: boolean;
|
||||
/**
|
||||
* Turn on automatic storage of JSON objects passed as the cookie value. Assumes JSON.stringify and JSON.parse
|
||||
*/
|
||||
json?: boolean;
|
||||
|
||||
/**
|
||||
* Cookie attributes can be set globally by setting properties of the $.cookie.defaults object or individually for each call to $.cookie() by passing a plain object to the options argument. Per-call options override the default options.
|
||||
*/
|
||||
defaults?: JQueryCookieOptions;
|
||||
/**
|
||||
* Gets an object of cookies as key-value pairs
|
||||
*/
|
||||
(): {[key:string]:string};
|
||||
/**
|
||||
* Gets a cookie by name
|
||||
* @param name The name of the cookie to get
|
||||
*/
|
||||
(name: string): any;
|
||||
(name: string, converter: (value: string) => any): any;
|
||||
/**
|
||||
* Sets a cookie
|
||||
* @param name The name of the cookie to set
|
||||
* @param value The value to set the cookie to
|
||||
*/
|
||||
(name: string, value: string): void;
|
||||
/**
|
||||
* Gets a cookie by name after applying a conversion function to the value
|
||||
* @param name The name of the cookie to get
|
||||
* @param converter A conversion function to change the cookie's value to a different representation on the fly
|
||||
*/
|
||||
(name: string, converter: (value: string) => any): any;
|
||||
/**
|
||||
* Sets a cookie with some options
|
||||
* @param name The name of the cookie to set
|
||||
* @param value The value to set the cookie to
|
||||
* @param options An object of options that change how the cookie is set
|
||||
*/
|
||||
(name: string, value: string, options: JQueryCookieOptions): void;
|
||||
/**
|
||||
* Sets a cookie using .toString(), or if $.cookie.json is set to true using JSON.stringify()
|
||||
* @param name The name of the cookie to set
|
||||
* @param value The value to set the cookie to
|
||||
*/
|
||||
(name: string, value: any): void;
|
||||
/**
|
||||
* Sets a cookie using .toString(), or if $.cookie.json is set to true using JSON.stringify()
|
||||
* @param name The name of the cookie to set
|
||||
* @param value The value to set the cookie to
|
||||
* @param options An object of options that change how the cookie is set
|
||||
*/
|
||||
(name: string, value: any, options: JQueryCookieOptions): void;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
/**
|
||||
* A simple, lightweight jQuery plugin for reading, writing and deleting cookies.
|
||||
*/
|
||||
cookie?: JQueryCookieStatic;
|
||||
|
||||
/**
|
||||
* Deletes a cookie
|
||||
* @param name Name of cookie to delete
|
||||
*/
|
||||
removeCookie(name: string): boolean;
|
||||
/**
|
||||
* Deletes a cookie
|
||||
* @param name Name of cookie to delete
|
||||
* @param options The same attributes (path, domain) as what the cookie was written with
|
||||
*/
|
||||
removeCookie(name: string, options: JQueryCookieOptions): boolean;
|
||||
}
|
||||
|
||||
@@ -3359,7 +3359,7 @@ function test_promise_then_change_type() {
|
||||
var def = $.Deferred<any>();
|
||||
var promise = def.promise(null);
|
||||
|
||||
def.rejectWith(this, new Error());
|
||||
def.rejectWith(this, [new Error()]);
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
Vendored
+4
-4
@@ -241,7 +241,7 @@ interface JQueryCallback {
|
||||
* @param context A reference to the context in which the callbacks in the list should be fired.
|
||||
* @param arguments An argument, or array of arguments, to pass to the callbacks in the list.
|
||||
*/
|
||||
fireWith(context?: any, ...args: any[]): JQueryCallback;
|
||||
fireWith(context?: any, args?: any[]): JQueryCallback;
|
||||
|
||||
/**
|
||||
* Determine whether a supplied callback is in a list
|
||||
@@ -395,7 +395,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
|
||||
* @param context Context passed to the progressCallbacks as the this object.
|
||||
* @param args Optional arguments that are passed to the progressCallbacks.
|
||||
*/
|
||||
notifyWith(context: any, value?: any, ...args: any[]): JQueryDeferred<T>;
|
||||
notifyWith(context: any, value?: any[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Reject a Deferred object and call any failCallbacks with the given args.
|
||||
@@ -409,7 +409,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
|
||||
* @param context Context passed to the failCallbacks as the this object.
|
||||
* @param args An optional array of arguments that are passed to the failCallbacks.
|
||||
*/
|
||||
rejectWith(context: any, value?: any, ...args: any[]): JQueryDeferred<T>;
|
||||
rejectWith(context: any, value?: any[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Resolve a Deferred object and call any doneCallbacks with the given args.
|
||||
@@ -425,7 +425,7 @@ interface JQueryDeferred<T> extends JQueryGenericPromise<T> {
|
||||
* @param context Context passed to the doneCallbacks as the this object.
|
||||
* @param args An optional array of arguments that are passed to the doneCallbacks.
|
||||
*/
|
||||
resolveWith(context: any, value?: T, ...args: any[]): JQueryDeferred<T>;
|
||||
resolveWith(context: any, value?: T[]): JQueryDeferred<T>;
|
||||
|
||||
/**
|
||||
* Return a Deferred's Promise object.
|
||||
|
||||
Vendored
+16
-7
@@ -9,7 +9,7 @@
|
||||
declare module JQueryUI {
|
||||
// Accordion //////////////////////////////////////////////////
|
||||
|
||||
interface AccordionOptions {
|
||||
interface AccordionOptions extends AccordionEvents {
|
||||
active?: any; // boolean or number
|
||||
animate?: any; // boolean, number, string or object
|
||||
collapsible?: boolean;
|
||||
@@ -37,7 +37,7 @@ declare module JQueryUI {
|
||||
create?: AccordionEvent;
|
||||
}
|
||||
|
||||
interface Accordion extends Widget, AccordionOptions, AccordionEvents {
|
||||
interface Accordion extends Widget, AccordionOptions {
|
||||
}
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ declare module JQueryUI {
|
||||
|
||||
interface DialogOptions extends DialogEvents {
|
||||
autoOpen?: boolean;
|
||||
buttons?: { [buttonText: string]: (event?: Event) => void } | ButtonOptions[];
|
||||
buttons?: { [buttonText: string]: (event?: Event) => void } | DialogButtonOptions[];
|
||||
closeOnEscape?: boolean;
|
||||
closeText?: string;
|
||||
dialogClass?: string;
|
||||
@@ -366,6 +366,14 @@ declare module JQueryUI {
|
||||
close?: DialogEvent;
|
||||
}
|
||||
|
||||
interface DialogButtonOptions {
|
||||
icons?: any;
|
||||
showText?: string | boolean;
|
||||
text?: string;
|
||||
click?: (eventObject: JQueryEventObject) => any;
|
||||
[attr: string]: any; // attributes for the <button> element
|
||||
}
|
||||
|
||||
interface DialogShowHideOptions {
|
||||
effect: string;
|
||||
delay?: number;
|
||||
@@ -517,9 +525,10 @@ declare module JQueryUI {
|
||||
|
||||
// Progressbar //////////////////////////////////////////////////
|
||||
|
||||
interface ProgressbarOptions {
|
||||
interface ProgressbarOptions extends ProgressbarEvents {
|
||||
disabled?: boolean;
|
||||
value?: number | boolean;
|
||||
max?: number;
|
||||
}
|
||||
|
||||
interface ProgressbarUIParams {
|
||||
@@ -535,7 +544,7 @@ declare module JQueryUI {
|
||||
create?: ProgressbarEvent;
|
||||
}
|
||||
|
||||
interface Progressbar extends Widget, ProgressbarOptions, ProgressbarEvents {
|
||||
interface Progressbar extends Widget, ProgressbarOptions {
|
||||
}
|
||||
|
||||
|
||||
@@ -793,7 +802,7 @@ declare module JQueryUI {
|
||||
|
||||
// Tooltip //////////////////////////////////////////////////
|
||||
|
||||
interface TooltipOptions {
|
||||
interface TooltipOptions extends TooltipEvents {
|
||||
content?: any; // () or string
|
||||
disabled?: boolean;
|
||||
hide?: any; // boolean, number, string or object
|
||||
@@ -816,7 +825,7 @@ declare module JQueryUI {
|
||||
open?: TooltipEvent;
|
||||
}
|
||||
|
||||
interface Tooltip extends Widget, TooltipOptions, TooltipEvents {
|
||||
interface Tooltip extends Widget, TooltipOptions {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
///<reference path="json-stable-stringify.d.ts"/>
|
||||
|
||||
import stringify = require('json-stable-stringify');
|
||||
|
||||
var obj = { c: 8, b: [{z:6,y:5,x:4},7], a: 3 };
|
||||
|
||||
{
|
||||
console.log(stringify(obj));
|
||||
}
|
||||
|
||||
{
|
||||
// Second arg can be a stringify.Comparator function.
|
||||
var s: string = stringify(obj, (a: stringify.Element, b: stringify.Element): number => a.key < b.key ? 1 : -1);
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
{
|
||||
// Can specify Comparator in an Options object.
|
||||
function reverse(a: stringify.Element, b: stringify.Element): number {
|
||||
return a.value < b.value ? 1 : -1;
|
||||
}
|
||||
var opts: stringify.Options = { cmp: reverse };
|
||||
var s: string = stringify(obj, opts);
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
{
|
||||
// Space can be a string.
|
||||
var s: string = stringify(obj, { space: ' ' });
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
{
|
||||
// Space can be an integer.
|
||||
var s: string = stringify(obj, { space: 2 });
|
||||
console.log(s);
|
||||
}
|
||||
|
||||
{
|
||||
// The replacer option can remove or modify values.
|
||||
function removeStrings(key: string, value: any): any {
|
||||
if (typeof value === "string") {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
var s: string = stringify(obj, { replacer: removeStrings });
|
||||
console.log(s);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Type definitions for json-stable-stringify 1.0.0
|
||||
// Project: https://github.com/substack/json-stable-stringify
|
||||
// Definitions by: Matt Frantz <https://github.com/mhfrantz/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'json-stable-stringify' {
|
||||
|
||||
function stringify(obj: any, opts?: stringify.Comparator | stringify.Options): string;
|
||||
|
||||
module stringify {
|
||||
|
||||
interface Element {
|
||||
key: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
interface Comparator {
|
||||
(a: Element, b: Element): number;
|
||||
}
|
||||
|
||||
interface Replacer {
|
||||
(key: string, value: any): any;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
cmp?: Comparator;
|
||||
space?: number | string;
|
||||
replacer?: Replacer;
|
||||
}
|
||||
}
|
||||
|
||||
export = stringify;
|
||||
}
|
||||
Vendored
+1
@@ -27,6 +27,7 @@ declare module "jsonwebtoken" {
|
||||
audience?: string;
|
||||
subject?: string;
|
||||
issuer?: string;
|
||||
noTimestamp?: boolean;
|
||||
}
|
||||
|
||||
export interface VerifyOptions {
|
||||
|
||||
+141
-135
@@ -6,38 +6,38 @@ var div = document.getElementById('map');
|
||||
|
||||
var map : L.Map = L.map(div, {
|
||||
center: L.latLng([51.505, -0.09]),
|
||||
zoom: 13,
|
||||
minZoom: 3,
|
||||
maxZoom: 8,
|
||||
maxBounds: L.latLngBounds([L.latLng(-60, -60), L.latLng(60, 60)]),
|
||||
dragging: true,
|
||||
touchZoom: true,
|
||||
scrollWheelZoom: true,
|
||||
boxZoom: true,
|
||||
tap: true,
|
||||
zoom: 13,
|
||||
minZoom: 3,
|
||||
maxZoom: 8,
|
||||
maxBounds: L.latLngBounds([L.latLng(-60, -60), L.latLng(60, 60)]),
|
||||
dragging: true,
|
||||
touchZoom: true,
|
||||
scrollWheelZoom: true,
|
||||
boxZoom: true,
|
||||
tap: true,
|
||||
|
||||
tapTolerance: 30,
|
||||
trackResize: true,
|
||||
worldCopyJump: false,
|
||||
closePopupOnClick: true,
|
||||
bounceAtZoomLimits: true,
|
||||
tapTolerance: 30,
|
||||
trackResize: true,
|
||||
worldCopyJump: false,
|
||||
closePopupOnClick: true,
|
||||
bounceAtZoomLimits: true,
|
||||
|
||||
keyboard: true,
|
||||
keyboardPanOffset: 80,
|
||||
keyboardZoomOffset: 1,
|
||||
keyboard: true,
|
||||
keyboardPanOffset: 80,
|
||||
keyboardZoomOffset: 1,
|
||||
|
||||
inertia: true,
|
||||
inertiaDeceleration: 3000,
|
||||
inertiaMaxSpeed: 1500,
|
||||
inertiaThreshold: 32,
|
||||
inertia: true,
|
||||
inertiaDeceleration: 3000,
|
||||
inertiaMaxSpeed: 1500,
|
||||
inertiaThreshold: 32,
|
||||
|
||||
zoomControl: true,
|
||||
attributionControl: true,
|
||||
zoomControl: true,
|
||||
attributionControl: true,
|
||||
|
||||
fadeAnimation: true,
|
||||
zoomAnimation: true,
|
||||
zoomAnimationThreshold: 4,
|
||||
markerZoomAnimation: true
|
||||
fadeAnimation: true,
|
||||
zoomAnimation: true,
|
||||
zoomAnimationThreshold: 4,
|
||||
markerZoomAnimation: true
|
||||
|
||||
});
|
||||
|
||||
@@ -53,16 +53,16 @@ map.setView(L.latLng(42, 51));
|
||||
|
||||
map.setView(L.latLng(42, 51), 12);
|
||||
map.setView(L.latLng(42, 51), 12, {
|
||||
reset: true,
|
||||
pan: {
|
||||
animate: true,
|
||||
duration: 0.25,
|
||||
easeLinearity: 0.25,
|
||||
noMoveStart: false
|
||||
},
|
||||
zoom: {
|
||||
animate: true
|
||||
}
|
||||
reset: true,
|
||||
pan: {
|
||||
animate: true,
|
||||
duration: 0.25,
|
||||
easeLinearity: 0.25,
|
||||
noMoveStart: false
|
||||
},
|
||||
zoom: {
|
||||
animate: true
|
||||
}
|
||||
});
|
||||
|
||||
map.setZoom(50);
|
||||
@@ -81,21 +81,21 @@ map.setZoomAround(L.latLng(42, 51), 8, { animate: false });
|
||||
|
||||
map.fitBounds(L.latLngBounds(L.latLng(10, 10), L.latLng(20, 20)));
|
||||
map.fitBounds(L.latLngBounds(L.latLng(10, 10), L.latLng(20, 20)), {
|
||||
paddingTopLeft: L.point(20, 20),
|
||||
paddingBottomRight: L.point(20, 20),
|
||||
padding: L.point(0, 0),
|
||||
maxZoom: null
|
||||
paddingTopLeft: L.point(20, 20),
|
||||
paddingBottomRight: L.point(20, 20),
|
||||
padding: L.point(0, 0),
|
||||
maxZoom: null
|
||||
});
|
||||
|
||||
map.fitWorld();
|
||||
|
||||
map.fitWorld({
|
||||
animate: false
|
||||
animate: false
|
||||
});
|
||||
|
||||
map.panTo(L.latLng(42, 42));
|
||||
map.panTo(L.latLng(42, 42), {
|
||||
animate: true
|
||||
animate: true
|
||||
});
|
||||
|
||||
map.invalidateSize(true);
|
||||
@@ -105,12 +105,12 @@ map.setMaxBounds(L.latLngBounds(L.latLng(10, 10), L.latLng(20, 20)));
|
||||
|
||||
map.locate();
|
||||
map.locate({
|
||||
watch: false,
|
||||
setView: false,
|
||||
maxZoom: 18,
|
||||
timeout: 10000,
|
||||
maximumAge: 0,
|
||||
enableHighAccuracy: false
|
||||
watch: false,
|
||||
setView: false,
|
||||
maxZoom: 18,
|
||||
timeout: 10000,
|
||||
maximumAge: 0,
|
||||
enableHighAccuracy: false
|
||||
});
|
||||
|
||||
map.stopLocate();
|
||||
@@ -138,7 +138,7 @@ map.hasLayer(layer);
|
||||
map.openPopup("canard", L.latLng(42, 51));
|
||||
|
||||
var popup = L.popup({
|
||||
autoPan: true
|
||||
autoPan: true
|
||||
});
|
||||
|
||||
map.openPopup(popup);
|
||||
@@ -171,51 +171,51 @@ map.getPanes().shadowPane.classList.add('roger');
|
||||
map.getPanes().tilePane.classList.add('roger');
|
||||
|
||||
map.whenReady((m: L.Map) => {
|
||||
m.zoomOut();
|
||||
m.zoomOut();
|
||||
});
|
||||
|
||||
map.on('click', () => {
|
||||
map.zoomOut();
|
||||
map.zoomOut();
|
||||
});
|
||||
|
||||
map.off('dblclick', L.Util.falseFn);
|
||||
|
||||
map.once('contextmenu', (e: L.LeafletMouseEvent) => {
|
||||
map.openPopup('contextmenu', e.latlng);
|
||||
map.openPopup('contextmenu', e.latlng);
|
||||
});
|
||||
|
||||
var marker = L.marker(L.latLng(42, 51), {
|
||||
icon: L.icon({
|
||||
iconUrl: 'roger.png',
|
||||
iconRetinaUrl: 'roger-retina.png',
|
||||
iconSize: L.point(40, 40),
|
||||
iconAnchor: L.point(20, 0),
|
||||
shadowUrl: 'roger-shadow.png',
|
||||
shadowRetinaUrl: 'roger-shadow-retina.png',
|
||||
shadowSize: L.point(44, 44),
|
||||
shadowAnchor: L.point(22, 0),
|
||||
popupAnchor: L.point(0, 0),
|
||||
className: 'roger-icon'
|
||||
}),
|
||||
clickable: true,
|
||||
draggable: false,
|
||||
keyboard: true,
|
||||
title: 'this is an icon',
|
||||
alt: '',
|
||||
zIndexOffset: 0,
|
||||
opacity: 1.0,
|
||||
riseOnHover: false,
|
||||
riseOffset: 250
|
||||
icon: L.icon({
|
||||
iconUrl: 'roger.png',
|
||||
iconRetinaUrl: 'roger-retina.png',
|
||||
iconSize: L.point(40, 40),
|
||||
iconAnchor: L.point(20, 0),
|
||||
shadowUrl: 'roger-shadow.png',
|
||||
shadowRetinaUrl: 'roger-shadow-retina.png',
|
||||
shadowSize: L.point(44, 44),
|
||||
shadowAnchor: L.point(22, 0),
|
||||
popupAnchor: L.point(0, 0),
|
||||
className: 'roger-icon'
|
||||
}),
|
||||
clickable: true,
|
||||
draggable: false,
|
||||
keyboard: true,
|
||||
title: 'this is an icon',
|
||||
alt: '',
|
||||
zIndexOffset: 0,
|
||||
opacity: 1.0,
|
||||
riseOnHover: false,
|
||||
riseOffset: 250
|
||||
});
|
||||
|
||||
marker.addTo(map);
|
||||
|
||||
marker.on('click', (e: L.LeafletMouseEvent) => {
|
||||
map.setView(e.latlng);
|
||||
map.setView(e.latlng);
|
||||
});
|
||||
|
||||
marker.once('mouseover', () => {
|
||||
marker.openPopup();
|
||||
marker.openPopup();
|
||||
})
|
||||
|
||||
marker.setLatLng(marker.getLatLng());
|
||||
@@ -228,7 +228,7 @@ marker.setOpacity(0.8);
|
||||
marker.bindPopup(popup);
|
||||
marker.unbindPopup();
|
||||
marker.bindPopup('hello', {
|
||||
closeOnClick: true
|
||||
closeOnClick: true
|
||||
});
|
||||
|
||||
marker.openPopup();
|
||||
@@ -244,19 +244,19 @@ marker.toGeoJSON();
|
||||
marker.dragging.enable();
|
||||
|
||||
popup = L.popup({
|
||||
maxWidth: 300,
|
||||
minWidth: 50,
|
||||
maxHeight: null,
|
||||
autoPan: true,
|
||||
keepInView: false,
|
||||
closeButton: true,
|
||||
offset: L.point(0, 6),
|
||||
autoPanPaddingTopLeft: null,
|
||||
autoPanPaddingBottomRight: L.point(20, 20),
|
||||
autoPanPadding: L.point(5, 5),
|
||||
zoomAnimation: true,
|
||||
closeOnClick: null,
|
||||
className: 'roger'
|
||||
maxWidth: 300,
|
||||
minWidth: 50,
|
||||
maxHeight: null,
|
||||
autoPan: true,
|
||||
keepInView: false,
|
||||
closeButton: true,
|
||||
offset: L.point(0, 6),
|
||||
autoPanPaddingTopLeft: null,
|
||||
autoPanPaddingBottomRight: L.point(20, 20),
|
||||
autoPanPadding: L.point(5, 5),
|
||||
zoomAnimation: true,
|
||||
closeOnClick: null,
|
||||
className: 'roger'
|
||||
});
|
||||
|
||||
popup.setLatLng(L.latLng(12, 54)).setContent('this is nice popup').openOn(map);
|
||||
@@ -264,65 +264,65 @@ popup.setLatLng(L.latLng(12, 54)).setContent('this is nice popup').openOn(map);
|
||||
popup.update();
|
||||
|
||||
var tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}', {
|
||||
minZoom: 0,
|
||||
maxZoom: 18,
|
||||
maxNativeZoom: 17,
|
||||
tileSize: 256,
|
||||
subdomains: ['a','b','c'],
|
||||
errorTileUrl: '',
|
||||
attribution: '',
|
||||
tms: false,
|
||||
continuousWorld: false,
|
||||
noWrap: false,
|
||||
zoomOffset: 0,
|
||||
zoomReverse: false,
|
||||
opacity: 1.0,
|
||||
zIndex: null,
|
||||
unloadInvisibleTiles: false,
|
||||
updateWhenIdle: false,
|
||||
detectRetina: true,
|
||||
reuseTiles: true,
|
||||
bounds: null
|
||||
minZoom: 0,
|
||||
maxZoom: 18,
|
||||
maxNativeZoom: 17,
|
||||
tileSize: 256,
|
||||
subdomains: ['a','b','c'],
|
||||
errorTileUrl: '',
|
||||
attribution: '',
|
||||
tms: false,
|
||||
continuousWorld: false,
|
||||
noWrap: false,
|
||||
zoomOffset: 0,
|
||||
zoomReverse: false,
|
||||
opacity: 1.0,
|
||||
zIndex: null,
|
||||
unloadInvisibleTiles: false,
|
||||
updateWhenIdle: false,
|
||||
detectRetina: true,
|
||||
reuseTiles: true,
|
||||
bounds: null
|
||||
});
|
||||
|
||||
tileLayer.on('loading', L.Util.falseFn)
|
||||
.off('loading', L.Util.falseFn)
|
||||
.once('tileload', L.Util.falseFn);
|
||||
.off('loading', L.Util.falseFn)
|
||||
.once('tileload', L.Util.falseFn);
|
||||
|
||||
tileLayer.addTo(map);
|
||||
|
||||
tileLayer.bringToBack()
|
||||
.bringToFront()
|
||||
.setOpacity(0.7)
|
||||
.setZIndex(9)
|
||||
.redraw()
|
||||
.setUrl('http://perdu.com')
|
||||
.getContainer();
|
||||
.bringToFront()
|
||||
.setOpacity(0.7)
|
||||
.setZIndex(9)
|
||||
.redraw()
|
||||
.setUrl('http://perdu.com')
|
||||
.getContainer();
|
||||
|
||||
module CustomControl {
|
||||
export interface Options {
|
||||
title: string;
|
||||
position?: string;
|
||||
}
|
||||
export interface Options {
|
||||
title: string;
|
||||
position?: string;
|
||||
}
|
||||
}
|
||||
interface CustomControl extends L.Control {
|
||||
getTitle(): string;
|
||||
setTitle(title: string): CustomControl;
|
||||
getTitle(): string;
|
||||
setTitle(title: string): CustomControl;
|
||||
}
|
||||
var CustomControl: { new(options: CustomControl.Options): CustomControl };
|
||||
CustomControl = L.Control.extend<CustomControl.Options, CustomControl>({
|
||||
initialize: function(options: CustomControl.Options) {
|
||||
L.Control.prototype.initialize.call(this, {
|
||||
position: options.position || 'bottomleft',
|
||||
});
|
||||
this.title = options.title;
|
||||
},
|
||||
getTitle: function() {
|
||||
return this.title;
|
||||
},
|
||||
setTitle: function(title: string) {
|
||||
this.title = title;
|
||||
},
|
||||
initialize: function(options: CustomControl.Options) {
|
||||
L.Control.prototype.initialize.call(this, {
|
||||
position: options.position || 'bottomleft',
|
||||
});
|
||||
this.title = options.title;
|
||||
},
|
||||
getTitle: function() {
|
||||
return this.title;
|
||||
},
|
||||
setTitle: function(title: string) {
|
||||
this.title = title;
|
||||
},
|
||||
});
|
||||
|
||||
// Different latLng and latLngBounds expressions
|
||||
@@ -413,3 +413,9 @@ polyline.addLatLng(latLngObjectLiteral);
|
||||
var popup: L.Popup = L.popup();
|
||||
popup.setLatLng(latLngLiteral);
|
||||
popup.setLatLng(latLngObjectLiteral);
|
||||
|
||||
var zoomCtrl = L.control.zoom({
|
||||
position: "topleft",
|
||||
zoomInText: '+',
|
||||
zoomOutText: '-'
|
||||
});
|
||||
|
||||
Vendored
+203
-175
@@ -382,17 +382,55 @@ declare module L {
|
||||
onRemove(map: Map): void;
|
||||
}
|
||||
|
||||
module Control {
|
||||
namespace Control {
|
||||
export interface ZoomStatic extends ClassStatic {
|
||||
/**
|
||||
* Creates a zoom control.
|
||||
*/
|
||||
new(options?: ZoomOptions): Zoom;
|
||||
new (options?: ZoomOptions): Zoom;
|
||||
}
|
||||
|
||||
export interface Zoom extends L.Control {
|
||||
}
|
||||
|
||||
export interface ZoomOptions {
|
||||
/**
|
||||
* The position of the control (one of the map corners).
|
||||
* Can be 'topleft', 'topright', 'bottomleft', or 'bottomright'.
|
||||
*
|
||||
* Default value: 'topright'.
|
||||
*/
|
||||
position?: string; // 'topleft' | 'topright' | 'bottomleft' | 'bottomright'
|
||||
|
||||
/**
|
||||
* The text set on the zoom in button.
|
||||
*
|
||||
* Default value: '+'
|
||||
*/
|
||||
zoomInText?: string;
|
||||
|
||||
/**
|
||||
* The text set on the zoom out button.
|
||||
*
|
||||
* Default value: '-'
|
||||
*/
|
||||
zoomOutText?: string;
|
||||
|
||||
/**
|
||||
* The title set on the zoom in button.
|
||||
*
|
||||
* Default value: 'Zoom in'
|
||||
*/
|
||||
zoomInTitle?: string;
|
||||
|
||||
/**
|
||||
* The title set on the zoom out button.
|
||||
*
|
||||
* Default value: 'Zoom out'
|
||||
*/
|
||||
zoomOutTitle?: string;
|
||||
}
|
||||
|
||||
export interface AttributionStatic extends ClassStatic {
|
||||
/**
|
||||
* Creates an attribution control.
|
||||
@@ -478,12 +516,12 @@ declare module L {
|
||||
function (options?: ControlOptions): Control;
|
||||
}
|
||||
|
||||
module control {
|
||||
namespace control {
|
||||
|
||||
/**
|
||||
* Creates a zoom control.
|
||||
*/
|
||||
export function zoom(options?: ZoomOptions): L.Control.Zoom;
|
||||
export function zoom(options?: Control.ZoomOptions): L.Control.Zoom;
|
||||
|
||||
/**
|
||||
* Creates an attribution control.
|
||||
@@ -503,7 +541,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface ControlOptions {
|
||||
|
||||
@@ -517,9 +555,9 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
module CRS {
|
||||
namespace CRS {
|
||||
|
||||
/**
|
||||
* The most common CRS for online maps, used by almost all free and commercial
|
||||
@@ -549,7 +587,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Creates a div icon instance with the given options.
|
||||
@@ -568,7 +606,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface DivIconOptions {
|
||||
|
||||
@@ -602,7 +640,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface DomEvent {
|
||||
|
||||
@@ -663,9 +701,9 @@ declare module L {
|
||||
export var DomEvent: DomEvent;
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
module DomUtil {
|
||||
namespace DomUtil {
|
||||
|
||||
/**
|
||||
* Returns an element with the given id if a string was passed, or just returns
|
||||
@@ -766,7 +804,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Creates a Draggable object for moving the given element when you start dragging
|
||||
@@ -816,7 +854,7 @@ declare module L {
|
||||
|
||||
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Create a layer group, optionally given an initial set of layers.
|
||||
@@ -894,44 +932,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
|
||||
export interface FitBoundsOptions extends ZoomPanOptions {
|
||||
|
||||
/**
|
||||
* Sets the amount of padding in the top left corner of a map container that
|
||||
* shouldn't be accounted for when setting the view to fit bounds. Useful if
|
||||
* you have some control overlays on the map like a sidebar and you don't
|
||||
* want them to obscure objects you're zooming to.
|
||||
*
|
||||
* Default value: [0, 0].
|
||||
*/
|
||||
paddingTopLeft?: Point;
|
||||
|
||||
/**
|
||||
* The same for bottom right corner of the map.
|
||||
*
|
||||
* Default value: [0, 0].
|
||||
*/
|
||||
paddingBottomRight?: Point;
|
||||
|
||||
/**
|
||||
* Equivalent of setting both top left and bottom right padding to the same value.
|
||||
*
|
||||
* Default value: [0, 0].
|
||||
*/
|
||||
padding?: Point;
|
||||
|
||||
/**
|
||||
* The maximum possible zoom to use.
|
||||
*
|
||||
* Default value: null
|
||||
*/
|
||||
maxZoom?: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
|
||||
@@ -994,7 +995,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
export interface GeoJSONOptions {
|
||||
/**
|
||||
* Function that will be used for creating layers for GeoJSON points (if not
|
||||
@@ -1031,7 +1032,7 @@ declare module L {
|
||||
|
||||
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Creates an icon instance with the given options.
|
||||
@@ -1058,7 +1059,7 @@ declare module L {
|
||||
export interface Icon {
|
||||
}
|
||||
|
||||
module Icon {
|
||||
namespace Icon {
|
||||
/**
|
||||
* L.Icon.Default extends L.Icon and is the blue icon Leaflet uses
|
||||
* for markers by default.
|
||||
@@ -1068,7 +1069,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface IconOptions {
|
||||
|
||||
@@ -1133,7 +1134,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface IControl {
|
||||
|
||||
@@ -1153,7 +1154,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface ICRS {
|
||||
|
||||
@@ -1205,7 +1206,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface IEventPowered<T> {
|
||||
|
||||
@@ -1285,7 +1286,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface IHandler {
|
||||
|
||||
@@ -1310,7 +1311,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface ILayer {
|
||||
|
||||
@@ -1329,8 +1330,8 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
module Mixin {
|
||||
declare namespace L {
|
||||
namespace Mixin {
|
||||
export interface LeafletMixinEvents extends IEventPowered<LeafletMixinEvents> {
|
||||
}
|
||||
|
||||
@@ -1338,7 +1339,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates an image overlay object given the URL of the image and the geographical
|
||||
@@ -1398,7 +1399,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface ImageOverlayOptions {
|
||||
|
||||
@@ -1409,7 +1410,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface IProjection {
|
||||
|
||||
@@ -1425,7 +1426,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* A constant that represents the Leaflet version in use.
|
||||
@@ -1439,7 +1440,7 @@ declare module L {
|
||||
export function noConflict(): typeof L;
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
/**
|
||||
* Creates an object representing a geographical point with the given latitude
|
||||
* and longitude.
|
||||
@@ -1524,7 +1525,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Creates a LatLngBounds object by defining south-west and north-east corners
|
||||
@@ -1650,7 +1651,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Create a layer group, optionally given an initial set of layers.
|
||||
@@ -1736,7 +1737,7 @@ declare module L {
|
||||
}
|
||||
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LayersOptions {
|
||||
|
||||
@@ -1766,7 +1767,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletErrorEvent extends LeafletEvent {
|
||||
|
||||
@@ -1782,7 +1783,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletEvent {
|
||||
|
||||
@@ -1798,7 +1799,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletGeoJSONEvent extends LeafletEvent {
|
||||
|
||||
@@ -1824,7 +1825,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletLayerEvent extends LeafletEvent {
|
||||
|
||||
@@ -1835,7 +1836,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletLocationEvent extends LeafletEvent {
|
||||
|
||||
@@ -1883,7 +1884,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletMouseEvent extends LeafletEvent {
|
||||
|
||||
@@ -1911,7 +1912,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletPopupEvent extends LeafletEvent {
|
||||
|
||||
@@ -1922,7 +1923,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletDragEndEvent extends LeafletEvent {
|
||||
|
||||
@@ -1933,7 +1934,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletResizeEvent extends LeafletEvent {
|
||||
|
||||
@@ -1949,7 +1950,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LeafletTileEvent extends LeafletEvent {
|
||||
|
||||
@@ -1965,9 +1966,9 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
module LineUtil {
|
||||
namespace LineUtil {
|
||||
|
||||
/**
|
||||
* Dramatically reduces the number of points in a polyline while retaining
|
||||
@@ -1999,7 +2000,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface LocateOptions {
|
||||
|
||||
@@ -2052,19 +2053,19 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a map object given a div element and optionally an
|
||||
* object literal with map options described below.
|
||||
*/
|
||||
function map(id: HTMLElement, options?: MapOptions): Map;
|
||||
function map(id: HTMLElement, options?: Map.MapOptions): Map;
|
||||
|
||||
/**
|
||||
* Instantiates a map object given a div element id and optionally an
|
||||
* object literal with map options described below.
|
||||
*/
|
||||
function map(id: string, options?: MapOptions): Map;
|
||||
function map(id: string, options?: Map.MapOptions): Map;
|
||||
|
||||
|
||||
export interface MapStatic extends ClassStatic {
|
||||
@@ -2074,7 +2075,7 @@ declare module L {
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
new(id: HTMLElement, options?: MapOptions): Map;
|
||||
new(id: HTMLElement, options?: Map.MapOptions): Map;
|
||||
|
||||
/**
|
||||
* Instantiates a map object given a div element id and optionally an
|
||||
@@ -2082,7 +2083,7 @@ declare module L {
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
new(id: string, options?: MapOptions): Map;
|
||||
new(id: string, options?: Map.MapOptions): Map;
|
||||
}
|
||||
export var Map: MapStatic;
|
||||
|
||||
@@ -2093,40 +2094,40 @@ declare module L {
|
||||
* Sets the view of the map (geographical center and zoom) with the given
|
||||
* animation options.
|
||||
*/
|
||||
setView(center: LatLngExpression, zoom?: number, options?: ZoomPanOptions): Map;
|
||||
setView(center: LatLngExpression, zoom?: number, options?: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Sets the zoom of the map.
|
||||
*/
|
||||
setZoom(zoom: number, options?: ZoomOptions): Map;
|
||||
setZoom(zoom: number, options?: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Increases the zoom of the map by delta (1 by default).
|
||||
*/
|
||||
zoomIn(delta?: number, options?: ZoomOptions): Map;
|
||||
zoomIn(delta?: number, options?: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Decreases the zoom of the map by delta (1 by default).
|
||||
*/
|
||||
zoomOut(delta?: number, options?: ZoomOptions): Map;
|
||||
zoomOut(delta?: number, options?: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Zooms the map while keeping a specified point on the map stationary
|
||||
* (e.g. used internally for scroll zoom and double-click zoom).
|
||||
*/
|
||||
setZoomAround(latlng: LatLngExpression, zoom: number, options?: ZoomOptions): Map;
|
||||
setZoomAround(latlng: LatLngExpression, zoom: number, options?: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Sets a map view that contains the given geographical bounds with the maximum
|
||||
* zoom level possible.
|
||||
*/
|
||||
fitBounds(bounds: LatLngBounds, options?: FitBoundsOptions): Map;
|
||||
fitBounds(bounds: LatLngBounds, options?: Map.FitBoundsOptions): Map;
|
||||
|
||||
/**
|
||||
* Sets a map view that mostly contains the whole world with the maximum zoom
|
||||
* level possible.
|
||||
*/
|
||||
fitWorld(options?: FitBoundsOptions): Map;
|
||||
fitWorld(options?: Map.FitBoundsOptions): Map;
|
||||
|
||||
/**
|
||||
* Pans the map to a given center. Makes an animated pan if new center is not more
|
||||
@@ -2150,7 +2151,7 @@ declare module L {
|
||||
* after you've changed the map size dynamically, also animating pan by default.
|
||||
* If options.pan is false, panning will not occur.
|
||||
*/
|
||||
invalidateSize(options: ZoomPanOptions): Map;
|
||||
invalidateSize(options: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Checks if the map container size changed and updates the map if so — call it
|
||||
@@ -2162,7 +2163,7 @@ declare module L {
|
||||
* Restricts the map view to the given bounds (see map maxBounds option),
|
||||
* passing the given animation options through to `setView`, if required.
|
||||
*/
|
||||
setMaxBounds(bounds: LatLngBounds, options?: ZoomPanOptions): Map;
|
||||
setMaxBounds(bounds: LatLngBounds, options?: Map.ZoomPanOptions): Map;
|
||||
|
||||
/**
|
||||
* Tries to locate the user using Geolocation API, firing locationfound event
|
||||
@@ -2422,7 +2423,7 @@ declare module L {
|
||||
/**
|
||||
* Map state options
|
||||
*/
|
||||
options: MapOptions;
|
||||
options: Map.MapOptions;
|
||||
|
||||
////////////////
|
||||
////////////////
|
||||
@@ -2442,7 +2443,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L.Map {
|
||||
|
||||
export interface MapOptions {
|
||||
|
||||
@@ -2680,9 +2681,82 @@ declare module L {
|
||||
*/
|
||||
bounceAtZoomLimits?: boolean;
|
||||
}
|
||||
|
||||
export interface ZoomOptions {
|
||||
/**
|
||||
* If not specified, zoom animation will happen if the zoom origin is inside the current view.
|
||||
* If true, the map will attempt animating zoom disregarding where zoom origin is.
|
||||
* Setting false will make it always reset the view completely without animation.
|
||||
*/
|
||||
animate?: boolean;
|
||||
}
|
||||
|
||||
export interface ZoomPanOptions {
|
||||
|
||||
/**
|
||||
* If true, the map view will be completely reset (without any animations).
|
||||
*
|
||||
* Default value: false.
|
||||
*/
|
||||
reset?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the options for the panning (without the zoom change) if it occurs.
|
||||
*/
|
||||
pan?: PanOptions;
|
||||
|
||||
/**
|
||||
* Sets the options for the zoom change if it occurs.
|
||||
*/
|
||||
zoom?: ZoomOptions;
|
||||
|
||||
/**
|
||||
* An equivalent of passing animate to both zoom and pan options (see below).
|
||||
*/
|
||||
animate?: boolean;
|
||||
|
||||
/**
|
||||
* If true, it will delay moveend event so that it doesn't happen many times in a row.
|
||||
*/
|
||||
debounceMoveend?: boolean;
|
||||
}
|
||||
|
||||
export interface FitBoundsOptions extends ZoomPanOptions {
|
||||
|
||||
/**
|
||||
* Sets the amount of padding in the top left corner of a map container that
|
||||
* shouldn't be accounted for when setting the view to fit bounds. Useful if
|
||||
* you have some control overlays on the map like a sidebar and you don't
|
||||
* want them to obscure objects you're zooming to.
|
||||
*
|
||||
* Default value: [0, 0].
|
||||
*/
|
||||
paddingTopLeft?: Point;
|
||||
|
||||
/**
|
||||
* The same for bottom right corner of the map.
|
||||
*
|
||||
* Default value: [0, 0].
|
||||
*/
|
||||
paddingBottomRight?: Point;
|
||||
|
||||
/**
|
||||
* Equivalent of setting both top left and bottom right padding to the same value.
|
||||
*
|
||||
* Default value: [0, 0].
|
||||
*/
|
||||
padding?: Point;
|
||||
|
||||
/**
|
||||
* The maximum possible zoom to use.
|
||||
*
|
||||
* Default value: null
|
||||
*/
|
||||
maxZoom?: number;
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface MapPanes {
|
||||
|
||||
@@ -2723,7 +2797,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a Marker object given a geographical point and optionally
|
||||
@@ -2873,7 +2947,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface MarkerOptions {
|
||||
|
||||
@@ -2953,7 +3027,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a multi-polyline object given an array of latlngs arrays (one
|
||||
@@ -2996,7 +3070,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a multi-polyline object given an array of arrays of geographical
|
||||
@@ -3037,7 +3111,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface PanOptions {
|
||||
|
||||
@@ -3073,7 +3147,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface Path extends ILayer, IEventPowered<Path> {
|
||||
|
||||
@@ -3171,7 +3245,7 @@ declare module L {
|
||||
off(eventMap?: any, context?: any): Path;
|
||||
}
|
||||
|
||||
module Path {
|
||||
namespace Path {
|
||||
/**
|
||||
* True if SVG is used for vector rendering (true for most modern browsers).
|
||||
*/
|
||||
@@ -3201,7 +3275,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface PathOptions {
|
||||
|
||||
@@ -3297,7 +3371,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Creates a Point object with the given x and y coordinates. If optional round
|
||||
@@ -3373,7 +3447,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a polygon object given an array of geographical points and
|
||||
@@ -3401,7 +3475,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a polyline object given an array of geographical points and
|
||||
@@ -3453,7 +3527,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface PolylineOptions extends PathOptions {
|
||||
|
||||
@@ -3474,9 +3548,9 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
module PolyUtil {
|
||||
namespace PolyUtil {
|
||||
|
||||
/**
|
||||
* Clips the polygon geometry defined by the given points by rectangular bounds.
|
||||
@@ -3488,7 +3562,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a Popup object given an optional options object that describes
|
||||
@@ -3567,7 +3641,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface PopupOptions {
|
||||
|
||||
@@ -3665,7 +3739,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface PosAnimationStatic extends ClassStatic {
|
||||
/**
|
||||
@@ -3702,9 +3776,9 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
module Projection {
|
||||
namespace Projection {
|
||||
|
||||
/**
|
||||
* Spherical Mercator projection — the most common projection for online maps,
|
||||
@@ -3730,7 +3804,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
/**
|
||||
* Instantiates a rectangle object with the given geographical bounds and
|
||||
@@ -3756,7 +3830,7 @@ declare module L {
|
||||
}
|
||||
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface ScaleOptions {
|
||||
|
||||
@@ -3794,7 +3868,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface TileLayerStatic extends ClassStatic {
|
||||
/**
|
||||
@@ -3894,7 +3968,7 @@ declare module L {
|
||||
off(eventMap?: any, context?: any): TileLayer;
|
||||
}
|
||||
|
||||
module TileLayer {
|
||||
namespace TileLayer {
|
||||
export interface WMS extends TileLayer {
|
||||
/**
|
||||
* Merges an object with the new parameters and re-requests tiles on the current
|
||||
@@ -3942,7 +4016,7 @@ declare module L {
|
||||
export var tileLayer: TileLayerFactory;
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface TileLayerOptions {
|
||||
|
||||
@@ -4089,7 +4163,7 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
export interface TransformationStatic extends ClassStatic {
|
||||
/**
|
||||
* Creates a transformation object with the given coefficients.
|
||||
@@ -4113,9 +4187,9 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
module Util {
|
||||
namespace Util {
|
||||
|
||||
/**
|
||||
* Merges the properties of the src object (or multiple objects) into dest object
|
||||
@@ -4197,7 +4271,7 @@ declare module L {
|
||||
}
|
||||
|
||||
|
||||
declare module L {
|
||||
declare namespace L {
|
||||
|
||||
export interface WMSOptions {
|
||||
|
||||
@@ -4237,52 +4311,6 @@ declare module L {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare module L {
|
||||
|
||||
export interface ZoomOptions {
|
||||
/**
|
||||
* If not specified, zoom animation will happen if the zoom origin is inside the current view.
|
||||
* If true, the map will attempt animating zoom disregarding where zoom origin is.
|
||||
* Setting false will make it always reset the view completely without animation.
|
||||
*/
|
||||
animate?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module L {
|
||||
|
||||
export interface ZoomPanOptions {
|
||||
|
||||
/**
|
||||
* If true, the map view will be completely reset (without any animations).
|
||||
*
|
||||
* Default value: false.
|
||||
*/
|
||||
reset?: boolean;
|
||||
|
||||
/**
|
||||
* Sets the options for the panning (without the zoom change) if it occurs.
|
||||
*/
|
||||
pan?: PanOptions;
|
||||
|
||||
/**
|
||||
* Sets the options for the zoom change if it occurs.
|
||||
*/
|
||||
zoom?: ZoomOptions;
|
||||
|
||||
/**
|
||||
* An equivalent of passing animate to both zoom and pan options (see below).
|
||||
*/
|
||||
animate?: boolean;
|
||||
|
||||
/**
|
||||
* If true, it will delay moveend event so that it doesn't happen many times in a row.
|
||||
*/
|
||||
debounceMoveend?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces Leaflet to use the Canvas back-end (if available) for vector layers
|
||||
* instead of SVG. This can increase performance considerably in some cases
|
||||
|
||||
+211
-25
@@ -135,8 +135,6 @@ result = <number>_([1, 2, 3, 4]).pop();
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).push(5, 6, 7);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).reverse();
|
||||
result = <number>_([1, 2, 3, 4]).shift();
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(1, 2);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(2);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
|
||||
@@ -172,8 +170,43 @@ result = <_.LoDashArrayWrapper<number[]>>_([1, 2, 3, 4]).chunk(2);
|
||||
result = <any[]>_.compact([0, 1, false, 2, '', 3]);
|
||||
result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
|
||||
result = <number[]>_.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).difference([5, 2, 10]);
|
||||
// _.difference
|
||||
{
|
||||
let testDifferenceArray: TResult[];
|
||||
let testDifferenceList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.difference<TResult>(testDifferenceArray);
|
||||
result = _.difference<TResult>(testDifferenceArray, testDifferenceArray);
|
||||
result = _.difference<TResult>(testDifferenceArray, testDifferenceList, testDifferenceArray);
|
||||
result = _.difference<TResult>(testDifferenceArray, testDifferenceArray, testDifferenceList, testDifferenceArray);
|
||||
result = _.difference<TResult>(testDifferenceList);
|
||||
result = _.difference<TResult>(testDifferenceList, testDifferenceList);
|
||||
result = _.difference<TResult>(testDifferenceList, testDifferenceArray, testDifferenceList);
|
||||
result = _.difference<TResult>(testDifferenceList, testDifferenceList, testDifferenceArray, testDifferenceList);
|
||||
result = _(testDifferenceArray).difference().value();
|
||||
result = _(testDifferenceArray).difference(testDifferenceArray).value();
|
||||
result = _(testDifferenceArray).difference(testDifferenceList, testDifferenceArray).value();
|
||||
result = _(testDifferenceArray).difference(testDifferenceArray, testDifferenceList, testDifferenceArray).value();
|
||||
result = _(testDifferenceList).difference<TResult>().value();
|
||||
result = _(testDifferenceList).difference<TResult>(testDifferenceList).value();
|
||||
result = _(testDifferenceList).difference<TResult>(testDifferenceArray, testDifferenceList).value();
|
||||
result = _(testDifferenceList).difference<TResult>(testDifferenceList, testDifferenceArray, testDifferenceList).value();
|
||||
}
|
||||
|
||||
// _.drop
|
||||
{
|
||||
let testDropArray: TResult[];
|
||||
let testDropList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.drop<TResult>(testDropArray);
|
||||
result = _.drop<TResult>(testDropArray, 42);
|
||||
result = _.drop<TResult>(testDropList);
|
||||
result = _.drop<TResult>(testDropList, 42);
|
||||
result = _(testDropArray).drop().value();
|
||||
result = _(testDropArray).drop(42).value();
|
||||
result = _(testDropList).drop<TResult>().value();
|
||||
result = _(testDropList).drop<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.rest([1, 2, 3]);
|
||||
result = <number[]>_.rest([1, 2, 3], 2);
|
||||
@@ -181,12 +214,6 @@ result = <number[]>_.rest([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.rest(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.rest(foodsType, { 'type': 'value' });
|
||||
|
||||
result = <number[]>_.drop([1, 2, 3]);
|
||||
result = <number[]>_.drop([1, 2, 3], 2);
|
||||
result = <number[]>_.drop([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.drop(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.drop(foodsType, { 'type': 'value' });
|
||||
|
||||
result = <number[]>_.tail([1, 2, 3])
|
||||
result = <number[]>_.tail([1, 2, 3], 2)
|
||||
result = <number[]>_.tail([1, 2, 3], (num) => num < 3)
|
||||
@@ -282,15 +309,29 @@ result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = <number>_.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
||||
|
||||
result = <number[]>_.initial([1, 2, 3]);
|
||||
result = <number[]>_.initial([1, 2, 3], 2);
|
||||
result = <number[]>_.initial([1, 2, 3], function (num) {
|
||||
return num > 1;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.initial(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.initial(foodsType, { 'type': 'vegetable' });
|
||||
//_.initial
|
||||
{
|
||||
let testInitalArray: TResult[];
|
||||
let testInitalList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.initial<TResult>(testInitalArray);
|
||||
result = _.initial<TResult>(testInitalList);
|
||||
result = _(testInitalArray).initial().value();
|
||||
result = _(testInitalList).initial<TResult>().value();
|
||||
}
|
||||
|
||||
result = <number[]>_.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
// _.intersection
|
||||
{
|
||||
let testIntersectionArray: TResult[];
|
||||
let testIntersectionList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.intersection<TResult>(testIntersectionArray, testIntersectionList);
|
||||
result = _.intersection<TResult>(testIntersectionList, testIntersectionArray, testIntersectionList);
|
||||
result = _(testIntersectionArray).intersection<TResult>(testIntersectionArray).value();
|
||||
result = _(testIntersectionArray).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionArray).value();
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
}
|
||||
|
||||
result = <number>_.last([1, 2, 3]);
|
||||
result = <number>_([1, 2, 3]).last();
|
||||
@@ -298,6 +339,57 @@ result = <number>_([1, 2, 3]).last();
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
// _.pull
|
||||
{
|
||||
let testPullArray: TResult[];
|
||||
let testPullValue: TResult;
|
||||
let result: TResult[];
|
||||
result = _.pull<TResult>(testPullArray);
|
||||
result = _.pull<TResult>(testPullArray, testPullValue);
|
||||
result = _.pull<TResult>(testPullArray, testPullValue, testPullValue);
|
||||
result = _.pull<TResult>(testPullArray, testPullValue, testPullValue, testPullValue);
|
||||
result = _(testPullArray).pull().value();
|
||||
result = _(testPullArray).pull(testPullValue).value();
|
||||
result = _(testPullArray).pull(testPullValue, testPullValue).value();
|
||||
result = _(testPullArray).pull(testPullValue, testPullValue, testPullValue).value();
|
||||
}
|
||||
{
|
||||
let testPullList: _.List<TResult>;
|
||||
let testPullValue: TResult;
|
||||
let result: _.List<TResult>;
|
||||
result = _.pull<TResult>(testPullList);
|
||||
result = _.pull<TResult>(testPullList, testPullValue);
|
||||
result = _.pull<TResult>(testPullList, testPullValue, testPullValue);
|
||||
result = _.pull<TResult>(testPullList, testPullValue, testPullValue, testPullValue);
|
||||
result = _(testPullList).pull<TResult>().value();
|
||||
result = _(testPullList).pull<TResult>(testPullValue).value();
|
||||
result = _(testPullList).pull<TResult>(testPullValue, testPullValue).value();
|
||||
result = _(testPullList).pull<TResult>(testPullValue, testPullValue, testPullValue).value();
|
||||
}
|
||||
|
||||
// _.pullAt
|
||||
{
|
||||
let testPullAtArray: TResult[];
|
||||
let testPullAtList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.pullAt<TResult>(testPullAtArray);
|
||||
result = _.pullAt<TResult>(testPullAtArray, 1);
|
||||
result = _.pullAt<TResult>(testPullAtArray, [2, 3], 1);
|
||||
result = _.pullAt<TResult>(testPullAtArray, 4, [2, 3], 1);
|
||||
result = _.pullAt<TResult>(testPullAtList);
|
||||
result = _.pullAt<TResult>(testPullAtList, 1);
|
||||
result = _.pullAt<TResult>(testPullAtList, [2, 3], 1);
|
||||
result = _.pullAt<TResult>(testPullAtList, 4, [2, 3], 1);
|
||||
result = _(testPullAtArray).pullAt().value();
|
||||
result = _(testPullAtArray).pullAt(1).value();
|
||||
result = _(testPullAtArray).pullAt([2, 3], 1).value();
|
||||
result = _(testPullAtArray).pullAt(4, [2, 3], 1).value();
|
||||
result = _(testPullAtList).pullAt<TResult>().value();
|
||||
result = _(testPullAtList).pullAt<TResult>(1).value();
|
||||
result = _(testPullAtList).pullAt<TResult>([2, 3], 1).value();
|
||||
result = _(testPullAtList).pullAt<TResult>(4, [2, 3], 1).value();
|
||||
}
|
||||
|
||||
result = <_.Dictionary<any>>_.zipObject(['moe', 'larry'], [30, 40]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_(['moe', 'larry']).zipObject([30, 40]);
|
||||
result = <_.Dictionary<any>>_.object(['moe', 'larry'], [30, 40]);
|
||||
@@ -307,14 +399,23 @@ result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]
|
||||
result = <_.Dictionary<any>>_.object([['moe', 30], ['larry', 40]]);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<any>>>_([['moe', 30], ['larry', 40]]).object();
|
||||
|
||||
result = <number[]>_.pull([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = <number[]>_.pullAt([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
result = <number[]>_.remove([1, 2, 3, 4, 5, 6], function (num: number) { return num % 2 == 0; });
|
||||
result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.remove(foodsType, { 'type': 'vegetable' });
|
||||
var typedResult: IFoodType[] = _.remove([ <IFoodType>{ name: 'apple' }, <IFoodType>{ name: 'orange' }], <IFoodType>{ name: 'orange' });
|
||||
|
||||
// _.slice
|
||||
{
|
||||
let testSliceArray: TResult[];
|
||||
let result: TResult[];
|
||||
result = _.slice(testSliceArray);
|
||||
result = _.slice(testSliceArray, 42);
|
||||
result = _.slice(testSliceArray, 42, 42);
|
||||
result = _(testSliceArray).slice().value();
|
||||
result = _(testSliceArray).slice(42).value();
|
||||
result = _(testSliceArray).slice(42, 42).value();
|
||||
}
|
||||
|
||||
result = <number>_.sortedIndex([20, 30, 50], 40);
|
||||
result = <number>_.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
|
||||
var sortedIndexDict: { wordToNumber: { [idx: string]: number } } = {
|
||||
@@ -327,6 +428,21 @@ result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
|
||||
// _.takeRight
|
||||
{
|
||||
let testTakeRightArray: TResult[];
|
||||
let testTakeRightList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.takeRight<TResult>(testTakeRightArray);
|
||||
result = _.takeRight<TResult>(testTakeRightArray, 42);
|
||||
result = _.takeRight<TResult>(testTakeRightList);
|
||||
result = _.takeRight<TResult>(testTakeRightList, 42);
|
||||
result = _(testTakeRightArray).takeRight().value();
|
||||
result = _(testTakeRightArray).takeRight(42).value();
|
||||
result = _(testTakeRightList).takeRight<TResult>().value();
|
||||
result = _(testTakeRightList).takeRight<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
|
||||
result = <number[]>_([1, 2, 3]).union([101, 2, 1, 10], [2, 1]).value();
|
||||
@@ -363,7 +479,46 @@ result = <string[]>_(['A', 'b', 'C', 'a', 'B', 'c']).unique(function (letter) {
|
||||
result = <number[]>_([1, 2.5, 3, 1.5, 2, 3.5]).unique(function (num) { return this.floor(num); }, Math).value();
|
||||
result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').value();
|
||||
|
||||
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
||||
// _.unzipWith
|
||||
{
|
||||
let testUnzipWithArray: (number[]|_.List<number>)[];
|
||||
let testUnzipWithList: _.List<number[]|_.List<number>>;
|
||||
let testUnzipWithIterator: {(prev: TResult, curr: number, index?: number, list?: number[]): TResult};
|
||||
let result: TResult[];
|
||||
result = _.unzipWith<number, TResult>(testUnzipWithArray);
|
||||
result = _.unzipWith<number, TResult>(testUnzipWithArray, testUnzipWithIterator);
|
||||
result = _.unzipWith<number, TResult>(testUnzipWithArray, testUnzipWithIterator, any);
|
||||
result = _.unzipWith<number, TResult>(testUnzipWithList);
|
||||
result = _.unzipWith<number, TResult>(testUnzipWithList, testUnzipWithIterator);
|
||||
result = _.unzipWith<number, TResult>(testUnzipWithList, testUnzipWithIterator, any);
|
||||
result = _(testUnzipWithArray).unzipWith<number, TResult>(testUnzipWithIterator).value();
|
||||
result = _(testUnzipWithArray).unzipWith<number, TResult>(testUnzipWithIterator, any).value();
|
||||
result = _(testUnzipWithList).unzipWith<number, TResult>(testUnzipWithIterator).value();
|
||||
result = _(testUnzipWithList).unzipWith<number, TResult>(testUnzipWithIterator, any).value();
|
||||
}
|
||||
|
||||
// _.without
|
||||
{
|
||||
let testWithoutArray: number[];
|
||||
let testWithoutList: _.List<number>;
|
||||
let result: number[];
|
||||
result = _.without<number>(testWithoutArray);
|
||||
result = _.without<number>(testWithoutArray, 1);
|
||||
result = _.without<number>(testWithoutArray, 1, 2);
|
||||
result = _.without<number>(testWithoutArray, 1, 2, 3);
|
||||
result = _.without<number>(testWithoutList);
|
||||
result = _.without<number>(testWithoutList, 1);
|
||||
result = _.without<number>(testWithoutList, 1, 2);
|
||||
result = _.without<number>(testWithoutList, 1, 2, 3);
|
||||
result = _(testWithoutArray).without().value();
|
||||
result = _(testWithoutArray).without(1).value();
|
||||
result = _(testWithoutArray).without(1, 2).value();
|
||||
result = _(testWithoutArray).without(1, 2, 3).value();
|
||||
result = _(testWithoutList).without<number>().value();
|
||||
result = _(testWithoutList).without<number>(1).value();
|
||||
result = _(testWithoutList).without<number>(1, 2).value();
|
||||
result = _(testWithoutList).without<number>(1, 2, 3).value();
|
||||
}
|
||||
|
||||
// _.xor
|
||||
var testXorArray: number[];
|
||||
@@ -453,6 +608,32 @@ result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1,
|
||||
result = _({}).commit();
|
||||
}
|
||||
|
||||
// _.prototype.plant
|
||||
{
|
||||
let result: _.LoDashWrapper<number>;
|
||||
result = _(any).plant(42);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashStringWrapper;
|
||||
result = _(any).plant('');
|
||||
}
|
||||
{
|
||||
let result: _.LoDashWrapper<boolean>;
|
||||
result = _(any).plant(true);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashNumberArrayWrapper;
|
||||
result = _(any).plant([42]);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashArrayWrapper<any>;
|
||||
result = _(any).plant<any>([]);
|
||||
}
|
||||
{
|
||||
let result: _.LoDashObjectWrapper<{}>;
|
||||
result = _(any).plant<{}>({});
|
||||
}
|
||||
|
||||
/**************
|
||||
* Collection *
|
||||
**************/
|
||||
@@ -1768,9 +1949,6 @@ result = <void>_<string>([]).noop(true, 'a', 1);
|
||||
result = <void>_({}).noop(true, 'a', 1);
|
||||
result = <void>_(any).noop(true, 'a', 1);
|
||||
|
||||
var tempObject = {};
|
||||
result = <typeof _>_.runInContext(tempObject);
|
||||
|
||||
// _.property
|
||||
interface TestPropertyObject {
|
||||
a: {
|
||||
@@ -2084,6 +2262,14 @@ result = <number>(_(TestMethodOfObject).methodOf<number>(1, 2).value())(['a', '0
|
||||
result = _({}).noConflict();
|
||||
}
|
||||
|
||||
// _.runInContext
|
||||
{
|
||||
let result: typeof _;
|
||||
result = _.runInContext();
|
||||
result = _.runInContext({});
|
||||
result = _({}).runInContext();
|
||||
}
|
||||
|
||||
// _.uniqueId
|
||||
result = <string>_.uniqueId();
|
||||
result = <string>_.uniqueId('');
|
||||
|
||||
Vendored
+312
-232
@@ -258,7 +258,6 @@ declare module _ {
|
||||
push(...items: T[]): LoDashArrayWrapper<T>;
|
||||
reverse(): LoDashArrayWrapper<T>;
|
||||
shift(): T;
|
||||
slice(start: number, end?: number): LoDashArrayWrapper<T>;
|
||||
sort(compareFn?: (a: T, b: T) => number): LoDashArrayWrapper<T>;
|
||||
splice(start: number): LoDashArrayWrapper<T>;
|
||||
splice(start: number, deleteCount: number, ...items: any[]): LoDashArrayWrapper<T>;
|
||||
@@ -367,34 +366,57 @@ declare module _ {
|
||||
//_.difference
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array excluding all values of the provided arrays using strict equality for comparisons
|
||||
* , i.e. ===.
|
||||
* @param array The array to process
|
||||
* @param others The arrays of values to exclude.
|
||||
* @return Returns a new array of filtered values.
|
||||
**/
|
||||
* Creates an array of unique array values not included in the other provided arrays using SameValueZero for
|
||||
* equality comparisons.
|
||||
*
|
||||
* @param array The array to inspect.
|
||||
* @param values The arrays of values to exclude.
|
||||
* @return Returns the new array of filtered values.
|
||||
*/
|
||||
difference<T>(
|
||||
array?: Array<T>,
|
||||
...others: Array<T>[]): T[];
|
||||
/**
|
||||
* @see _.difference
|
||||
**/
|
||||
difference<T>(
|
||||
array?: List<T>,
|
||||
...others: List<T>[]): T[];
|
||||
array: T[]|List<T>,
|
||||
...values: (T[]|List<T>)[]
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.difference
|
||||
**/
|
||||
difference(
|
||||
...others: Array<T>[]): LoDashArrayWrapper<T>;
|
||||
* @see _.difference
|
||||
*/
|
||||
difference(...values: (T[]|List<T>)[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.difference
|
||||
**/
|
||||
difference(
|
||||
...others: List<T>[]): LoDashArrayWrapper<T>;
|
||||
* @see _.difference
|
||||
*/
|
||||
difference<TValue>(...values: (TValue[]|List<TValue>)[]): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.drop
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array with n elements dropped from the beginning.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @param n The number of elements to drop.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
drop<T>(array: T[]|List<T>, n?: number): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.drop
|
||||
*/
|
||||
drop(n?: number): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.drop
|
||||
*/
|
||||
drop<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.findIndex
|
||||
@@ -937,108 +959,52 @@ declare module _ {
|
||||
//_.initial
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Gets all but the last element or last n elements of an array. If a callback is provided
|
||||
* elements at the end of the array are excluded from the result as long as the callback
|
||||
* returns truey. The callback is bound to thisArg and invoked with three arguments;
|
||||
* (value, index, array).
|
||||
*
|
||||
* If a property name is provided for callback the created "_.pluck" style callback will
|
||||
* return the property value of the given element.
|
||||
*
|
||||
* If an object is provided for callback the created "_.where" style callback will return
|
||||
* true for elements that have the properties of the given object, else false.
|
||||
* @param array The array to query.
|
||||
* @param n Leaves this many elements behind, optional.
|
||||
* @return Returns everything but the last `n` elements of `array`.
|
||||
**/
|
||||
initial<T>(
|
||||
array: Array<T>): T[];
|
||||
* Gets all but the last element of array.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
initial<T>(array: T[]|List<T>): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.initial
|
||||
**/
|
||||
initial<T>(
|
||||
array: List<T>): T[];
|
||||
* @see _.initial
|
||||
*/
|
||||
initial(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param n The number of elements to exclude.
|
||||
**/
|
||||
initial<T>(
|
||||
array: Array<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param n The number of elements to exclude.
|
||||
**/
|
||||
initial<T>(
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param callback The function called per element
|
||||
**/
|
||||
initial<T>(
|
||||
array: Array<T>,
|
||||
callback: ListIterator<T, boolean>): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param callback The function called per element
|
||||
**/
|
||||
initial<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
initial<T>(
|
||||
array: Array<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
initial<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
initial<W, T>(
|
||||
array: Array<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.initial
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
initial<W, T>(
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
* @see _.initial
|
||||
*/
|
||||
initial<TResult>(): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.intersection
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array of unique values present in all provided arrays using strict
|
||||
* equality for comparisons, i.e. ===.
|
||||
* @param arrays The arrays to inspect.
|
||||
* @return Returns an array of composite values.
|
||||
**/
|
||||
intersection<T>(...arrays: Array<T>[]): T[];
|
||||
* Creates an array of unique values that are included in all of the provided arrays using SameValueZero for
|
||||
* equality comparisons.
|
||||
*
|
||||
* @param arrays The arrays to inspect.
|
||||
* @return Returns the new array of shared values.
|
||||
*/
|
||||
intersection<T>(...arrays: (T[]|List<T>)[]): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.intersection
|
||||
**/
|
||||
intersection<T>(...arrays: List<T>[]): T[];
|
||||
* @see _.intersection
|
||||
*/
|
||||
intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.intersection
|
||||
*/
|
||||
intersection<TResult>(...arrays: (TResult[]|List<TResult>)[]): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.last
|
||||
@@ -1086,42 +1052,72 @@ declare module _ {
|
||||
//_.pull
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Removes all provided values from the given array using strict equality for comparisons,
|
||||
* i.e. ===.
|
||||
* @param array The array to modify.
|
||||
* @param values The values to remove.
|
||||
* @return array.
|
||||
**/
|
||||
pull<T>(
|
||||
array: Array<T>,
|
||||
...values: T[]): T[];
|
||||
|
||||
/**
|
||||
* @see _.pull
|
||||
**/
|
||||
pull<T>(
|
||||
array: List<T>,
|
||||
...values: T[]): T[];
|
||||
}
|
||||
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Removes all provided values from the given array using strict equality for comparisons,
|
||||
* i.e. ===.
|
||||
* Removes all provided values from array using SameValueZero for equality comparisons.
|
||||
*
|
||||
* Note: Unlike _.without, this method mutates array.
|
||||
*
|
||||
* @param array The array to modify.
|
||||
* @param values The values to remove.
|
||||
* @return array.
|
||||
**/
|
||||
pullAt(
|
||||
array: Array<any>,
|
||||
...values: any[]): any[];
|
||||
* @return Returns array.
|
||||
*/
|
||||
pull<T>(
|
||||
array: T[],
|
||||
...values: T[]
|
||||
): T[];
|
||||
|
||||
/**
|
||||
* @see _.pull
|
||||
**/
|
||||
pullAt(
|
||||
array: List<any>,
|
||||
...values: any[]): any[];
|
||||
*/
|
||||
pull<T>(
|
||||
array: List<T>,
|
||||
...values: T[]
|
||||
): List<T>;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.pull
|
||||
*/
|
||||
pull(...values: T[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.pull
|
||||
*/
|
||||
pull<TValue>(...values: TValue[]): LoDashObjectWrapper<List<TValue>>;
|
||||
}
|
||||
|
||||
//_.pullAt
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Removes elements from array corresponding to the given indexes and returns an array of the removed elements.
|
||||
* Indexes may be specified as an array of indexes or as individual arguments.
|
||||
*
|
||||
* Note: Unlike _.at, this method mutates array.
|
||||
*
|
||||
* @param array The array to modify.
|
||||
* @param indexes The indexes of elements to remove, specified as individual indexes or arrays of indexes.
|
||||
* @return Returns the new array of removed elements.
|
||||
*/
|
||||
pullAt<T>(
|
||||
array: T[]|List<T>,
|
||||
...indexes: (number|number[])[]
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.pullAt
|
||||
*/
|
||||
pullAt(...indexes: (number|number[])[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.pullAt
|
||||
*/
|
||||
pullAt<TValue>(...indexes: (number|number[])[]): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.remove
|
||||
@@ -1280,74 +1276,6 @@ declare module _ {
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(array: Array<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(array: List<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: Array<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: Array<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: Array<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<W, T>(
|
||||
array: Array<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<W, T>(
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
@@ -1417,6 +1345,33 @@ declare module _ {
|
||||
whereValue: W): T[];
|
||||
}
|
||||
|
||||
//_.slice
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array from start up to, but not including, end.
|
||||
*
|
||||
* @param array The array to slice.
|
||||
* @param start The start position.
|
||||
* @param end The end position.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
slice<T>(
|
||||
array: T[],
|
||||
start?: number,
|
||||
end?: number
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.slice
|
||||
*/
|
||||
slice(
|
||||
start?: number,
|
||||
end?: number
|
||||
): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.sortedIndex
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -1487,6 +1442,35 @@ declare module _ {
|
||||
whereValue: W): number;
|
||||
}
|
||||
|
||||
//_.takeRight
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array with n elements taken from the end.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @param n The number of elements to take.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
takeRight<T>(
|
||||
array: T[]|List<T>,
|
||||
n?: number
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.takeRight
|
||||
*/
|
||||
takeRight(n?: number): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.takeRight
|
||||
*/
|
||||
takeRight<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.union
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -1852,24 +1836,72 @@ declare module _ {
|
||||
whereValue: W): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.unzipWith
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* This method is like _.unzip except that it accepts an iteratee to specify how regrouped values should be
|
||||
* combined. The iteratee is bound to thisArg and invoked with four arguments: (accumulator, value, index,
|
||||
* group).
|
||||
*
|
||||
* @param array The array of grouped elements to process.
|
||||
* @param iteratee The function to combine regrouped values.
|
||||
* @param thisArg The this binding of iteratee.
|
||||
* @return Returns the new array of regrouped elements.
|
||||
*/
|
||||
unzipWith<TArray, TResult>(
|
||||
array: List<List<TArray>>,
|
||||
iteratee?: MemoIterator<TArray, TResult>,
|
||||
thisArg?: any
|
||||
): TResult[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.unzipWith
|
||||
*/
|
||||
unzipWith<TArr, TResult>(
|
||||
iteratee?: MemoIterator<TArr, TResult>,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.unzipWith
|
||||
*/
|
||||
unzipWith<TArr, TResult>(
|
||||
iteratee?: MemoIterator<TArr, TResult>,
|
||||
thisArg?: any
|
||||
): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.without
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates an array excluding all provided values using strict equality for comparisons, i.e. ===.
|
||||
* @param array The array to filter.
|
||||
* @param values The value(s) to exclude.
|
||||
* @return A new array of filtered values.
|
||||
**/
|
||||
* Creates an array excluding all provided values using SameValueZero for equality comparisons.
|
||||
*
|
||||
* @param array The array to filter.
|
||||
* @param values The values to exclude.
|
||||
* @return Returns the new array of filtered values.
|
||||
*/
|
||||
without<T>(
|
||||
array: Array<T>,
|
||||
...values: T[]): T[];
|
||||
array: T[]|List<T>,
|
||||
...values: T[]
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.without
|
||||
**/
|
||||
without<T>(
|
||||
array: List<T>,
|
||||
...values: T[]): T[];
|
||||
* @see _.without
|
||||
*/
|
||||
without(...values: T[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.without
|
||||
*/
|
||||
without<TValue>(...values: TValue[]): LoDashArrayWrapper<TValue>;
|
||||
}
|
||||
|
||||
//_.xor
|
||||
@@ -2066,6 +2098,46 @@ declare module _ {
|
||||
commit(): TWrapper;
|
||||
}
|
||||
|
||||
//_.prototype.plant
|
||||
interface LoDashWrapperBase<T, TWrapper> {
|
||||
/**
|
||||
* Creates a clone of the chained sequence planting value as the wrapped value.
|
||||
* @param value The value to plant as the wrapped value.
|
||||
* @return Returns the new lodash wrapper instance.
|
||||
*/
|
||||
plant(value: number): LoDashWrapper<number>;
|
||||
|
||||
/**
|
||||
* @see _.plant
|
||||
*/
|
||||
plant(value: string): LoDashStringWrapper;
|
||||
|
||||
/**
|
||||
* @see _.plant
|
||||
*/
|
||||
plant(value: boolean): LoDashWrapper<boolean>;
|
||||
|
||||
/**
|
||||
* @see _.plant
|
||||
*/
|
||||
plant(value: number[]): LoDashNumberArrayWrapper;
|
||||
|
||||
/**
|
||||
* @see _.plant
|
||||
*/
|
||||
plant<T>(value: T[]): LoDashArrayWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.plant
|
||||
*/
|
||||
plant<T extends {}>(value: T): LoDashObjectWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.plant
|
||||
*/
|
||||
plant(value: any): LoDashWrapper<any>;
|
||||
}
|
||||
|
||||
/**************
|
||||
* Collection *
|
||||
**************/
|
||||
@@ -8552,11 +8624,19 @@ declare module _ {
|
||||
//_.runInContext
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Create a new lodash function using the given context object.
|
||||
* @param context The context object
|
||||
* @returns The lodash function.
|
||||
**/
|
||||
runInContext(context: any): typeof _;
|
||||
* Create a new pristine lodash function using the given context object.
|
||||
*
|
||||
* @param context The context object.
|
||||
* @return Returns a new lodash function.
|
||||
*/
|
||||
runInContext(context?: Object): typeof _;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.runInContext
|
||||
*/
|
||||
runInContext(): typeof _;
|
||||
}
|
||||
|
||||
//_.times
|
||||
@@ -8644,10 +8724,10 @@ declare module _ {
|
||||
}
|
||||
|
||||
interface MemoVoidIterator<T, TResult> {
|
||||
(prev: TResult, curr: T, indexOrKey: any, list?: T[]): void;
|
||||
(prev: TResult, curr: T, indexOrKey?: any, list?: T[]): void;
|
||||
}
|
||||
interface MemoIterator<T, TResult> {
|
||||
(prev: TResult, curr: T, indexOrKey: any, list?: T[]): TResult;
|
||||
(prev: TResult, curr: T, indexOrKey?: any, list?: T[]): TResult;
|
||||
}
|
||||
/*
|
||||
interface MemoListIterator<T, TResult> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="log4javascript.d.ts" />
|
||||
/// <reference path="./log4javascript.d.ts" />
|
||||
|
||||
function aSimpleLoggingMessageString() {
|
||||
var log = log4javascript.getDefaultLogger();
|
||||
@@ -47,4 +47,8 @@ function changingTheFormatOfLogMessages() {
|
||||
var popUpAppender = new log4javascript.PopUpAppender();
|
||||
var layout = new log4javascript.PatternLayout("[%-5p] %m");
|
||||
popUpAppender.setLayout(layout);
|
||||
}
|
||||
|
||||
function configureLogLog() {
|
||||
log4javascript.logLog.setQuietMode(true);
|
||||
}
|
||||
Vendored
+34
-26
@@ -1051,38 +1051,46 @@ declare module log4javascript {
|
||||
// #region log4javascript error handling
|
||||
|
||||
/**
|
||||
* Sets whether LogLog is in quiet mode or not. In quiet mode, no messages sent to LogLog have any visible effect. By default,
|
||||
* quiet mode is switched off.
|
||||
* @param quietMode Whether to turn quiet mode on or off.
|
||||
* log4javascript has a single rudimentary logger-like object of its own to handle messages generated by log4javascript itself.
|
||||
* This logger is called logLog and is accessed via log4javascript.logLog.
|
||||
*/
|
||||
export function setQuietMode(quietMode: boolean): void;
|
||||
export namespace logLog {
|
||||
|
||||
/**
|
||||
* Sets how many errors LogLog will display alerts for. By default, only the first error encountered generates an alert to the
|
||||
* user. If you turn all errors on by supplying true to this method then all errors will generate alerts.
|
||||
* @param showAllErrors Whether to show all errors or just the first.
|
||||
*/
|
||||
export function setAlertAllErrors(alertAllErrors: boolean): void;
|
||||
/**
|
||||
* Sets whether logLog is in quiet mode or not. In quiet mode, no messages sent to logLog have any visible effect. By default,
|
||||
* quiet mode is switched off.
|
||||
* @param quietMode Whether to turn quiet mode on or off.
|
||||
*/
|
||||
export function setQuietMode(quietMode: boolean): void;
|
||||
|
||||
/**
|
||||
* Logs a debugging message to an in-memory list.
|
||||
*/
|
||||
export function debug(message: string, exception?: Error): void;
|
||||
/**
|
||||
* Sets how many errors logLog will display alerts for. By default, only the first error encountered generates an alert to the
|
||||
* user. If you turn all errors on by supplying true to this method then all errors will generate alerts.
|
||||
* @param showAllErrors Whether to show all errors or just the first.
|
||||
*/
|
||||
export function setAlertAllErrors(alertAllErrors: boolean): void;
|
||||
|
||||
/**
|
||||
* Displays an alert of all debugging messages.
|
||||
*/
|
||||
export function displayDebug(): void;
|
||||
/**
|
||||
* Logs a debugging message to an in-memory list.
|
||||
*/
|
||||
export function debug(message: string, exception?: Error): void;
|
||||
|
||||
/**
|
||||
* Currently has no effect.
|
||||
*/
|
||||
export function warn(message: string, exception?: Error): void;
|
||||
/**
|
||||
* Displays an alert of all debugging messages.
|
||||
*/
|
||||
export function displayDebug(): void;
|
||||
|
||||
/**
|
||||
* Generates an alert to the user if and only if the error is the first one encountered and setAlertAllErrors(true) has not been called.
|
||||
*/
|
||||
export function error(message: string, exception?: Error): void;
|
||||
/**
|
||||
* Currently has no effect.
|
||||
*/
|
||||
export function warn(message: string, exception?: Error): void;
|
||||
|
||||
/**
|
||||
* Generates an alert to the user if and only if the error is the first one encountered and setAlertAllErrors(true) has not been called.
|
||||
*/
|
||||
export function error(message: string, exception?: Error): void;
|
||||
|
||||
}
|
||||
|
||||
// #endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/// <reference path="meshblu.d.ts" />
|
||||
|
||||
import Meshblu = require('meshblu');
|
||||
|
||||
var UUID = "26de691f-8068-4cdc-907a-4cb5961a1aba";
|
||||
var TOKEN = "4cb5961a1aba26de691f80684cdc907a";
|
||||
|
||||
var meshblu = Meshblu.createConnection({
|
||||
uuid: UUID,
|
||||
token: TOKEN
|
||||
});
|
||||
|
||||
meshblu.data({
|
||||
uuid: UUID,
|
||||
online: true,
|
||||
x: -53,
|
||||
y: 234
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.device({
|
||||
uuid: UUID
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.devices({
|
||||
color: "green"
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.generateAndStoreToken({
|
||||
uuid: UUID
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.getdata({
|
||||
uuid: UUID,
|
||||
start: "2015-04-23T18:25:43.511Z",
|
||||
finish: "2015-04-24T18:25:43.511Z",
|
||||
limit: 10
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.identify();
|
||||
|
||||
meshblu.message({
|
||||
devices: [UUID],
|
||||
topic: "status",
|
||||
payload: {
|
||||
online: true
|
||||
}
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.register({
|
||||
type: "drone"
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.revokeToken({
|
||||
uuid: UUID,
|
||||
token: TOKEN
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.subscribe({
|
||||
uuid: UUID
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.subscribe({
|
||||
uuid: UUID,
|
||||
types: ["sent", "received"]
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.subscribe({
|
||||
uuid: UUID,
|
||||
types: ["sent", "received"],
|
||||
topics: ["device*", "-*status"]
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.unsubscribe({
|
||||
uuid: UUID
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.unsubscribe({
|
||||
uuid: UUID,
|
||||
types: ["sent", "broadcast"]
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.update({
|
||||
uuid: UUID,
|
||||
color: "blue"
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.whoami({}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
|
||||
meshblu.unregister({
|
||||
uuid: UUID
|
||||
}, function(result) {
|
||||
console.log(result);
|
||||
});
|
||||
Vendored
+281
@@ -0,0 +1,281 @@
|
||||
// Type definitions for meshblu.js 1.30.1
|
||||
// Project: https://github.com/octoblu/meshblu-npm
|
||||
// Definitions by: Felipe Nipo <https://github.com/fnipo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path='../node/node.d.ts' />
|
||||
|
||||
declare module 'meshblu' {
|
||||
var Meshblu: MeshbluStatic;
|
||||
|
||||
export = Meshblu;
|
||||
}
|
||||
|
||||
interface MeshbluStatic {
|
||||
|
||||
/**
|
||||
* Establish a secure socket.io connection to Meshblu.
|
||||
* @param opt
|
||||
* @returns A Meshblu Connection.
|
||||
*/
|
||||
createConnection(opt: Meshblu.ConnectionOptions): Meshblu.Connection;
|
||||
|
||||
}
|
||||
|
||||
declare module Meshblu {
|
||||
|
||||
interface Connection {
|
||||
|
||||
/**
|
||||
* Authenticate with Meshblu.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
identify(): Connection;
|
||||
|
||||
/**
|
||||
* @param data {string|number|object|array|Buffer} - data for signing.
|
||||
*/
|
||||
sign(data: any): string;
|
||||
|
||||
/**
|
||||
* @param message {string|number|object|array|Buffer} - signed data.
|
||||
* @param signature
|
||||
* @returns {*}
|
||||
*/
|
||||
verify(message: any, signature: any): any;
|
||||
|
||||
/**
|
||||
* @param uuid
|
||||
* @param message {string|number|object|array|Buffer} - data for encrypting.
|
||||
* @param options
|
||||
* @param fn The callback to be called. It should take one parameter, result,
|
||||
* which is an object containing a property "error".
|
||||
* @returns This Connection.
|
||||
*/
|
||||
encryptMessage(uuid: string, message: any, options: Meshblu.ConnectionOptions, fn:(result: any) => void): Connection;
|
||||
|
||||
/**
|
||||
* Send a meshblu message.
|
||||
* @param payload An array of devices UUIDs.
|
||||
* @param fn The callback to be called. It should take one parameter, result,
|
||||
* which is an object containing a property "error".
|
||||
* @returns This Connection.
|
||||
*/
|
||||
message(payload: MessagePayload, fn:(result: any) => void): Connection;
|
||||
|
||||
/**
|
||||
* Update a device record.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
update(data: UpdateData, fn:(result: UpdateSuccess) => void): Connection;
|
||||
|
||||
/**
|
||||
* Register a new device record.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
register(data: RegisterData, fn:(result: RegisterResponse) => void): Connection;
|
||||
|
||||
/**
|
||||
* Removes a device record.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
unregister(data: Device, fn:(result: Device) => void): Connection;
|
||||
|
||||
/**
|
||||
* Get my device info.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
whoami(data: any, fn:(result: DeviceResponse) => void): Connection;
|
||||
|
||||
/**
|
||||
* Find a Meshblu device.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
device(data: Device, fn:(result: DeviceResponse) => void): Connection
|
||||
|
||||
/**
|
||||
* Find Meshblu devices.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
devices(data: Color, fn:(result: DeviceResponse[]) => void): Connection
|
||||
|
||||
/**
|
||||
* Returns device messages as they are sent and received.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
subscribe(data: SubscribeData, fn:(result: any) => void): Connection
|
||||
|
||||
/**
|
||||
* Cancels device subscription.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
unsubscribe(data: UnsubscribeData, fn:(result: any) => void): Connection
|
||||
|
||||
/**
|
||||
* Send a meshblu data message.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
data(data: DataInput, fn:(result: any) => void): Connection
|
||||
|
||||
/**
|
||||
* Get a meshblu data for a device.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
* @returns This Connection.
|
||||
*/
|
||||
getdata(data: GetDataInput, fn:(result: any) => void): Connection
|
||||
|
||||
/**
|
||||
* Generate a new session token for a device.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
*/
|
||||
generateAndStoreToken(data: Device, fn:(result: ConnectionOptions) => void): void
|
||||
|
||||
/**
|
||||
* Remove a session token from a device.
|
||||
* @param data
|
||||
* @param fn The callback to be called. It should take one parameter, result.
|
||||
*/
|
||||
revokeToken(data: ConnectionOptions, fn:(result: Device) => void): void
|
||||
|
||||
/**
|
||||
*
|
||||
* @param uuid
|
||||
* @param fn The callback to be called. It should take one parameter, err,
|
||||
* which will be null if there was no problem, and one parameter, publicKey,
|
||||
* of type NodeRSA.
|
||||
*/
|
||||
getPublicKey(uuid: string, fn:(err: Error, publicKey: any) => void): void;
|
||||
|
||||
/*
|
||||
* Lack of documentation about these api functions.
|
||||
*/
|
||||
send(text: string): Connection;
|
||||
bufferedSocketEmit(): void;
|
||||
parseUrl(serverUrl: string, port: string): string;
|
||||
generateKeyPair(): KeyPair;
|
||||
setPrivateKey(privateKey: string): void;
|
||||
setup(): Connection;
|
||||
connect(): void;
|
||||
reconnect(): void;
|
||||
claimdevice(data: Device, fn:(result: Device) => void): Connection;
|
||||
mydevices(data: any, fn:(result: any) => void): Connection
|
||||
status(data: any): Connection
|
||||
authenticate(data: any, fn:(result: any) => void): Connection
|
||||
events(data: any, fn:(result: any) => void): Connection
|
||||
localdevices(fn:(result: any) => void): Connection
|
||||
unclaimeddevices(data: any, fn:(result: any) => void): Connection
|
||||
textBroadcast(data: any): Connection
|
||||
directText(data: any): Connection
|
||||
subscribeText(data: any, fn:(result: any) => void): Connection
|
||||
unsubscribeText(data: any, fn:(result: any) => void): Connection
|
||||
close(fn:(result: any) => void): Connection
|
||||
resetToken(data: any, fn:(result: any) => void): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the primary means of identifying a device.
|
||||
*/
|
||||
interface ConnectionOptions {
|
||||
uuid: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
interface KeyPair {
|
||||
privateKey: string;
|
||||
publicKey: string;
|
||||
}
|
||||
|
||||
interface MessagePayload {
|
||||
devices: string[];
|
||||
topic: string;
|
||||
payload: any;
|
||||
qos?: number;
|
||||
}
|
||||
|
||||
interface UpdateData {
|
||||
uuid: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface UpdateSuccess {
|
||||
uuid: string;
|
||||
token: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
interface RegisterData {
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface RegisterResponse {
|
||||
uuid: string;
|
||||
token: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface Device {
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
interface DeviceResponse {
|
||||
uuid: string;
|
||||
online: boolean;
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface Color {
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface SubscribeData {
|
||||
uuid: string;
|
||||
types?: string[];
|
||||
topics?: string[];
|
||||
}
|
||||
|
||||
interface UnsubscribeData {
|
||||
uuid: string;
|
||||
types?: string[];
|
||||
}
|
||||
|
||||
interface DataInput {
|
||||
uuid: string;
|
||||
online: boolean;
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface GetDataInput {
|
||||
uuid: string;
|
||||
start: string;
|
||||
finish: string;
|
||||
limit: number;
|
||||
}
|
||||
|
||||
interface IdentifySuccess {
|
||||
uuid: string;
|
||||
token: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
/// <reference path="msportalfx-test.d.ts" />
|
||||
|
||||
import testFx = require('MsPortalFx-Test');
|
||||
|
||||
var galleryPackageName = "My.Package";
|
||||
var bladeTitle = "A Service";
|
||||
var resourceProvider = 'My.Provider';
|
||||
var resourceType = 'myResourceType';
|
||||
var resourceName = 'myResource';
|
||||
var userName = 'johndoe@johndoe.com';
|
||||
var password = '123';
|
||||
var resourceId = '/subscriptions/123/resourceGroups/456/providers/My.Provider/myResourceType/myResource';
|
||||
var extensionName = 'LocalExtension';
|
||||
var label = 'Field label';
|
||||
var extensionUrl = 'https://localhost:44300/';
|
||||
var voidPromise: Q.Promise<void>;
|
||||
var boolPromise: Q.Promise<boolean>;
|
||||
var anyPromise: Q.Promise<any>;
|
||||
|
||||
var summaryBlade = new testFx.Blades.Blade(resourceName);
|
||||
|
||||
function TestPortal() {
|
||||
|
||||
testFx.portal.portalContext.signInEmail = userName;
|
||||
testFx.portal.portalContext.signInPassword = password;
|
||||
testFx.portal.portalContext.features = [{ name: "greatfeature", value: "true" }];
|
||||
testFx.portal.portalContext.testExtensions = [{ name: extensionName, uri: extensionUrl }];
|
||||
|
||||
anyPromise = testFx.portal.waitForElementLocated(summaryBlade.getLocator(), 30000);
|
||||
anyPromise = testFx.portal.quit();
|
||||
var createBladePromise = testFx.portal.openGalleryCreateBlade(galleryPackageName, bladeTitle, 20000);
|
||||
var browseResourcePromise = testFx.portal.openBrowseBlade(resourceProvider, resourceType, bladeTitle, 20000);
|
||||
var bladePromise = testFx.portal.openResourceBlade(resourceId, summaryBlade.title, 20000)
|
||||
var stringPromise = testFx.portal.takeScreenshot("TestPortal");
|
||||
var stringArrayPromise = testFx.portal.getBrowserLogs(testFx.LogLevel.All);
|
||||
}
|
||||
|
||||
function TestBlades() {
|
||||
var blade = new testFx.Blades.Blade(resourceName);
|
||||
blade.clickCommand('Delete');
|
||||
|
||||
var createBlade = new testFx.Blades.CreateBlade(bladeTitle);
|
||||
voidPromise = createBlade.actionBar.clickCreate();
|
||||
voidPromise = createBlade.actionBar.clickDelete();
|
||||
|
||||
var browseBlade = new testFx.Blades.BrowseResourceBlade(bladeTitle);
|
||||
voidPromise = browseBlade.selectResource(resourceName);
|
||||
|
||||
var pickerBlade = new testFx.Blades.PickerBlade(bladeTitle);
|
||||
pickerBlade.pickItem('abc');
|
||||
}
|
||||
|
||||
function TestParts() {
|
||||
var part = new testFx.Parts.Part(summaryBlade.getLocator(), "Roles");
|
||||
voidPromise = part.click();
|
||||
boolPromise = part.isSelected();
|
||||
boolPromise = part.waitUntilLoaded();
|
||||
boolPromise = part.isLoaded();
|
||||
|
||||
var resourceSummary = new testFx.Parts.ResourceSummaryPart(summaryBlade.getLocator());
|
||||
var count = resourceSummary.properties.length;
|
||||
}
|
||||
|
||||
function TestControls() {
|
||||
var selector = new testFx.Controls.SelectorField(summaryBlade.getLocator(), label);
|
||||
voidPromise = selector.openPicker();
|
||||
|
||||
var creatorAndSelector = new testFx.Controls.CreatorAndSelectorField(summaryBlade.getLocator(), label, label);
|
||||
var creatorAndSelectorPromise = creatorAndSelector.clickCreateNew();
|
||||
creatorAndSelectorPromise = creatorAndSelector.enterNewValue('XYZ');
|
||||
|
||||
var textField = new testFx.Controls.TextField(summaryBlade.getLocator(), "Resource name");
|
||||
var textFieldPromise = textField.sendKeys(resourceName);
|
||||
}
|
||||
|
||||
function TestActionBars() {
|
||||
var bar = new testFx.ActionBars.ActionBar(summaryBlade.getLocator());
|
||||
voidPromise = bar.clickCreate();
|
||||
voidPromise = bar.clickDelete();
|
||||
}
|
||||
Vendored
+224
@@ -0,0 +1,224 @@
|
||||
// Type definitions for msportalfx-test
|
||||
// Project: https://msazure.visualstudio.com/DefaultCollection/AzureUX/_git/portalfx-msportalfx-test
|
||||
// Definitions by: Julio Casal <https://github.com/julioct>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../q/Q.d.ts" />
|
||||
|
||||
declare module MsPortalTestFx {
|
||||
|
||||
export module Locators {
|
||||
export class Locator {
|
||||
seleniumLocator: any;
|
||||
findElements(context: any): any;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export class ContentLocator extends Locator {
|
||||
locators: Array<Locator>;
|
||||
constructor(innerLocators: Locator[]);
|
||||
findElements(context: any): any;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export class ChainedLocator extends Locator {
|
||||
locators: Array<Locator>;
|
||||
constructor(innerLocators: Locator[]);
|
||||
findElements(context: any): any;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export class By {
|
||||
static className(value: string): Locator;
|
||||
static css(value: string): Locator;
|
||||
static id(value: string): Locator;
|
||||
static js(script: any, ...var_args: any[]): Locator;
|
||||
static linkText(value: string): Locator;
|
||||
static name(value: string): Locator;
|
||||
static partialLinkText(value: string): Locator;
|
||||
static tagName(value: string): Locator;
|
||||
static xpath(value: string): Locator;
|
||||
static chained(...values: Locator[]): Locator;
|
||||
static content(...values: Locator[]): Locator;
|
||||
}
|
||||
}
|
||||
|
||||
export module ActionBars {
|
||||
export class ActionBar extends MsPortalTestFx.PortalElement {
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
clickCreate(): Q.Promise<void>;
|
||||
clickDelete(): Q.Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
export module Blades {
|
||||
export class Blade extends MsPortalTestFx.PortalElement {
|
||||
public title: string;
|
||||
|
||||
constructor(title: string);
|
||||
clickCommand(commandText: string): Q.Promise<Blade>;
|
||||
}
|
||||
|
||||
export class CreateBlade extends Blade {
|
||||
public actionBar: ActionBars.ActionBar;
|
||||
}
|
||||
|
||||
export class BrowseResourceBlade extends Blade {
|
||||
constructor(title: string);
|
||||
selectResource(resourceName: string): Q.Promise<void>;
|
||||
filterItems(filter: string): Q.Promise<BrowseResourceBlade>;
|
||||
}
|
||||
|
||||
export class PickerBlade extends Blade {
|
||||
constructor(title: string);
|
||||
pickItem(item: string): Q.Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
export module Controls {
|
||||
export class FormElement extends MsPortalTestFx.PortalElement {
|
||||
protected label: string;
|
||||
|
||||
constructor(baseLocator: Locators.Locator, parentLocator?: Locators.Locator, label?: string);
|
||||
}
|
||||
|
||||
export class CheckBoxField extends FormElement {
|
||||
constructor(parentLocator?: Locators.Locator, label?: string);
|
||||
}
|
||||
|
||||
export class SelectorField extends FormElement {
|
||||
constructor(parentLocator?: Locators.Locator, label?: string);
|
||||
openPicker(): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export class CreatorAndSelectorField extends FormElement {
|
||||
constructor(parentLocator?: Locators.Locator, selectModeLabel?: string, createModeLabel?: string);
|
||||
openPicker(): Q.Promise<void>;
|
||||
clickCreateNew(): Q.Promise<CreatorAndSelectorField>;
|
||||
enterNewValue(...var_args: string[]): Q.Promise<CreatorAndSelectorField>;
|
||||
}
|
||||
|
||||
export class GridCell extends MsPortalTestFx.PortalElement {
|
||||
constructor(text: string, parentLocator?: Locators.Locator);
|
||||
getLocator(): Locators.Locator;
|
||||
}
|
||||
|
||||
export class TextField extends FormElement {
|
||||
constructor(parentLocator?: Locators.Locator, label?: string, baseLocator?: Locators.Locator);
|
||||
sendKeys(...var_args: string[]): Q.Promise<TextField>;
|
||||
}
|
||||
|
||||
export class ResourceFilterTextField extends TextField {
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
}
|
||||
}
|
||||
|
||||
export module Parts {
|
||||
export class Part extends MsPortalTestFx.PortalElement {
|
||||
public innerText: string;
|
||||
|
||||
constructor(parentLocator?: Locators.Locator, innerText?: string, baseLocator?: Locators.Locator);
|
||||
isSelected(): Q.Promise<boolean>;
|
||||
isLoaded(): Q.Promise<boolean>;
|
||||
waitUntilLoaded(timeout?: number): Q.Promise<boolean>;
|
||||
}
|
||||
|
||||
export class PartProperty extends MsPortalTestFx.PortalElement {
|
||||
public name: string;
|
||||
|
||||
constructor(name: string, parentLocator?: Locators.Locator);
|
||||
getValue(): Q.Promise<string>;
|
||||
}
|
||||
|
||||
export class ResourceSummaryPart extends Part {
|
||||
public properties: Array<PartProperty>;
|
||||
public resourceGroupProperty: PartProperty;
|
||||
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
}
|
||||
|
||||
export class Tile extends MsPortalTestFx.PortalElement {
|
||||
public progressLocator: Locators.Locator;
|
||||
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
}
|
||||
}
|
||||
|
||||
export class PortalElement {
|
||||
protected baseLocator: Locators.Locator;
|
||||
protected parentLocator: Locators.Locator;
|
||||
|
||||
constructor(baseLocator: Locators.Locator, parentLocator?: Locators.Locator);
|
||||
getLocator(): Locators.Locator;
|
||||
click(): Q.Promise<void>;
|
||||
getAttribute(attributeName: string): Q.Promise<string>;
|
||||
}
|
||||
|
||||
export interface TestExtension {
|
||||
name: string;
|
||||
uri: string;
|
||||
}
|
||||
|
||||
export interface Feature {
|
||||
name: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface PortalContext {
|
||||
capabilities: {
|
||||
browserName: string;
|
||||
chromeOptions: {
|
||||
args: string[]
|
||||
}
|
||||
},
|
||||
chromeDriverPath?: string,
|
||||
portalUrl: string;
|
||||
signInUrl?: string;
|
||||
signInEmail?: string;
|
||||
signInPassword?: string;
|
||||
features?: Feature[];
|
||||
testExtensions?: TestExtension[];
|
||||
}
|
||||
|
||||
export enum LogLevel {
|
||||
All,
|
||||
Debug,
|
||||
Info,
|
||||
Warning,
|
||||
Severe,
|
||||
Off
|
||||
}
|
||||
|
||||
export class Portal {
|
||||
portalContext: PortalContext;
|
||||
click(locator: Locators.Locator): Q.Promise<void>;
|
||||
sendKeys(locator: Locators.Locator, ...var_args: string[]): Q.Promise<void>
|
||||
getText(locator: Locators.Locator): Q.Promise<string>;
|
||||
openGalleryCreateBlade(galleryPackageName: string, bladeTitle: string, timeout?: number): Q.Promise<Blades.CreateBlade>;
|
||||
openBrowseBlade(resourceProvider: string, resourceType: string, bladeTitle: string, timeout?: number): Q.Promise<Blades.BrowseResourceBlade>;
|
||||
openResourceBlade(resourceId: string, bladeTitle: string, timeout?: number): Q.Promise<Blades.Blade>;
|
||||
navigateToDeepLink(deepLink: string, timeout?: number): Q.Promise<any>;
|
||||
getAttribute(locator: Locators.Locator, attributeName: string, timeout?: number): Q.Promise<string>;
|
||||
waitForElementNotVisible(locator: Locators.Locator, timeout?: number): Q.Promise<boolean>;
|
||||
waitUntilElementContainsAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
|
||||
waitForElementLocated(locator: Locators.Locator, timeout?: number): Q.Promise<any>;
|
||||
takeScreenshot(filePrefix?: string): Q.Promise<string>;
|
||||
goHome(timeout?: number): Q.Promise<void>;
|
||||
getBrowserLogs(level: LogLevel): Q.Promise<string[]>;
|
||||
applyFeature(name: string, value: string): void;
|
||||
executeScript<T>(script: string): Q.Promise<T>;
|
||||
quit(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
export class SplashScreen extends PortalElement {
|
||||
clickUntrustedExtensionsOkButton(): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export var portal: Portal;
|
||||
}
|
||||
|
||||
|
||||
|
||||
declare module "MsPortalFx-Test" {
|
||||
export = MsPortalTestFx;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
///<reference path="netmask.d.ts" />
|
||||
|
||||
import netmask = require('netmask');
|
||||
|
||||
var address: string = '127.0.0.1';
|
||||
|
||||
var nm = new netmask.Netmask(address, '255.255.255.0');
|
||||
|
||||
var nm2 = new netmask.Netmask('127.0.0.1/255.255.255.0');
|
||||
|
||||
if (nm.contains('127.0.0.123')) {}
|
||||
|
||||
nm.forEach((ip: string): void => console.log(ip));
|
||||
|
||||
var adjacent: netmask.Netmask = nm.next();
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
// Type definitions for Netmask 1.0.5
|
||||
// Project: https://github.com/rs/node-netmask
|
||||
// Definitions by: Matt Frantz <https://github.com/mhfrantz/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// netmask.d.ts
|
||||
|
||||
declare module 'netmask' {
|
||||
|
||||
export function long2ip(long: number): string;
|
||||
export function ip2long(ip: string): number;
|
||||
|
||||
export class Netmask {
|
||||
maskLong: number;
|
||||
bitmask: number;
|
||||
netLong: number;
|
||||
// The number of IP address in the block (eg.: 254)
|
||||
size: number;
|
||||
// The address of the network block as a string (eg.: 216.240.32.0)
|
||||
base: string;
|
||||
// The netmask as a string (eg.: 255.255.255.0)
|
||||
mask: string;
|
||||
// The host mask, the opposite of the netmask (eg.: 0.0.0.255)
|
||||
hostmask: string;
|
||||
// The first usable address of the block
|
||||
first: string;
|
||||
// The last usable address of the block
|
||||
last: string;
|
||||
// The block's broadcast address: the last address of the block (eg.: 192.168.1.255)
|
||||
broadcast: string;
|
||||
|
||||
constructor (netmask: string);
|
||||
constructor (net: string, mask: string);
|
||||
|
||||
// Returns true if the given ip or netmask is contained in the block
|
||||
contains(ip: string | Netmask | number): boolean;
|
||||
|
||||
// Returns the Netmask object for the block which follow this one
|
||||
next(count?: number): Netmask;
|
||||
|
||||
// Evaluate a function on each IP address
|
||||
forEach(fn: (ip: string, long: number, index: number) => void): void;
|
||||
|
||||
// Returns the complete netmask formatted as `base/bitmask`
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/// <reference path="ng-flow.d.ts" />
|
||||
|
||||
var flowFactory: ng.flow.IFlowFactory;
|
||||
flowFactory.create(<flowjs.IFlowOptions> {});
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for ng-flow
|
||||
// Project: https://github.com/flowjs/ng-flow
|
||||
// Definitions by: Ryan McNamara <https://github.com/ryan10132>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
/// <reference path="../flowjs/flowjs.d.ts" />
|
||||
|
||||
declare module ng.flow {
|
||||
interface IFlowFactory {
|
||||
create(options?: flowjs.IFlowOptions): flowjs.IFlow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/// <reference path="./node-cache.d.ts" />
|
||||
|
||||
import NodeCache = require('node-cache');
|
||||
|
||||
import Options = NodeCacheTypes.Options;
|
||||
import Stats = NodeCacheTypes.Stats;
|
||||
import Callback = NodeCacheTypes.Callback;
|
||||
|
||||
interface TypeSample {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
{
|
||||
let options: Options;
|
||||
let cache: NodeCacheTypes.NodeCache;
|
||||
cache = new NodeCache();
|
||||
cache = new NodeCache(options);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let key: string;
|
||||
let cb: Callback<TypeSample>;
|
||||
let result: TypeSample;
|
||||
result = cache.get<TypeSample>(key);
|
||||
result = cache.get<TypeSample>(key, cb);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let keys: string[];
|
||||
let cb: Callback<{[key: string]: TypeSample}>;
|
||||
let result: {[key: string]: TypeSample};
|
||||
result = cache.mget<TypeSample>(keys);
|
||||
result = cache.mget<TypeSample>(keys, cb);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let key: string;
|
||||
let value: TypeSample;
|
||||
let ttl: number|string;
|
||||
let cb: Callback<boolean>;
|
||||
let result: boolean;
|
||||
result = cache.set<TypeSample>(key, value);
|
||||
result = cache.set<TypeSample>(key, value, ttl);
|
||||
result = cache.set<TypeSample>(key, value, ttl, cb);
|
||||
result = cache.set<TypeSample>(key, value, cb);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let keys: string|string[];
|
||||
let cb: Callback<number>;
|
||||
let result: number;
|
||||
result = cache.del(keys);
|
||||
result = cache.del(keys, cb);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let key: string;
|
||||
let ttl: number;
|
||||
let cb: Callback<boolean>;
|
||||
let result: boolean;
|
||||
result = cache.ttl(key);
|
||||
result = cache.ttl(key, ttl);
|
||||
result = cache.ttl(key, ttl, cb);
|
||||
result = cache.ttl(key, cb);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let cb: Callback<string[]>;
|
||||
let result: string[];
|
||||
result = cache.keys();
|
||||
result = cache.keys(cb);
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let result: Stats;
|
||||
result = cache.getStats();
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let result: void;
|
||||
result = cache.flushAll();
|
||||
}
|
||||
|
||||
{
|
||||
let cache: NodeCache;
|
||||
let result: void;
|
||||
result = cache.close();
|
||||
}
|
||||
Vendored
+263
@@ -0,0 +1,263 @@
|
||||
// Type definitions for node-cache v3.0.0
|
||||
// Project: https://github.com/tcs-de/nodecache
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module NodeCacheTypes {
|
||||
interface NodeCache {
|
||||
/** container for cached data */
|
||||
data: Data;
|
||||
|
||||
/** module options */
|
||||
options: Options;
|
||||
|
||||
/** statistics container */
|
||||
stats: Stats;
|
||||
|
||||
/**
|
||||
* get a cached key and change the stats
|
||||
*
|
||||
* @param key cache key or an array of keys
|
||||
* @param cb Callback function
|
||||
*/
|
||||
get<T>(
|
||||
key: string,
|
||||
cb?: Callback<T>
|
||||
): T;
|
||||
|
||||
/**
|
||||
* get multiple cached keys at once and change the stats
|
||||
*
|
||||
* @param keys an array of keys
|
||||
* @param cb Callback function
|
||||
*/
|
||||
mget<T>(
|
||||
keys: string[],
|
||||
cb?: Callback<{[key: string]: T}>
|
||||
): {[key: string]: T};
|
||||
|
||||
/**
|
||||
* set a cached key and change the stats
|
||||
*
|
||||
* @param key cache key
|
||||
* @param value A element to cache. If the option `option.forceString` is `true` the module trys to translate
|
||||
* it to a serialized JSON
|
||||
* @param ttl The time to live in seconds.
|
||||
* @param cb Callback function
|
||||
*/
|
||||
set<T>(
|
||||
key: string,
|
||||
value: T,
|
||||
ttl: number|string,
|
||||
cb?: Callback<boolean>
|
||||
): boolean;
|
||||
|
||||
set<T>(
|
||||
key: string,
|
||||
value: T,
|
||||
cb?: Callback<boolean>
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* remove keys
|
||||
* @param keys cache key to delete or a array of cache keys
|
||||
* @param cb Callback function
|
||||
* @returns Number of deleted keys
|
||||
*/
|
||||
del(
|
||||
keys: string|string[],
|
||||
cb?: Callback<number>
|
||||
): number;
|
||||
|
||||
/**
|
||||
* reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()`
|
||||
*/
|
||||
ttl(
|
||||
key: string,
|
||||
ttl: number,
|
||||
cb?: Callback<boolean>
|
||||
): boolean;
|
||||
|
||||
ttl(
|
||||
key: string,
|
||||
cb?: Callback<boolean>,
|
||||
ttl?: number
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* list all keys within this cache
|
||||
* @param cb Callback function
|
||||
* @returns An array of all keys
|
||||
*/
|
||||
keys(cb?: Callback<string[]>): string[];
|
||||
|
||||
/**
|
||||
* get the stats
|
||||
*
|
||||
* @returns Stats data
|
||||
*/
|
||||
getStats(): Stats;
|
||||
|
||||
/**
|
||||
* flush the hole data and reset the stats
|
||||
*/
|
||||
flushAll(): void;
|
||||
|
||||
/**
|
||||
* This will clear the interval timeout which is set on checkperiod option.
|
||||
*/
|
||||
close(): void;
|
||||
}
|
||||
|
||||
interface Data {
|
||||
[key: string]: WrappedValue<any>;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
forceString: boolean;
|
||||
objectValueSize: number;
|
||||
arrayValueSize: number;
|
||||
stdTTL: number;
|
||||
checkperiod: number;
|
||||
useClones: boolean;
|
||||
}
|
||||
|
||||
interface Stats {
|
||||
hits: number;
|
||||
misses: number;
|
||||
keys: number;
|
||||
ksize: number;
|
||||
vsize: number;
|
||||
}
|
||||
|
||||
interface WrappedValue<T> {
|
||||
// ttl
|
||||
t: number;
|
||||
// value
|
||||
v: T;
|
||||
}
|
||||
|
||||
interface Callback<T> {
|
||||
(err: any, data: T): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "node-cache" {
|
||||
import events = require("events");
|
||||
|
||||
import Data = NodeCacheTypes.Data;
|
||||
import Options = NodeCacheTypes.Options;
|
||||
import Stats = NodeCacheTypes.Stats;
|
||||
import Callback = NodeCacheTypes.Callback;
|
||||
|
||||
class NodeCache extends events.EventEmitter implements NodeCacheTypes.NodeCache {
|
||||
/** container for cached data */
|
||||
data: Data;
|
||||
|
||||
/** module options */
|
||||
options: Options;
|
||||
|
||||
/** statistics container */
|
||||
stats: Stats;
|
||||
|
||||
constructor(options?: Options);
|
||||
|
||||
/**
|
||||
* get a cached key and change the stats
|
||||
*
|
||||
* @param key cache key or an array of keys
|
||||
* @param cb Callback function
|
||||
*/
|
||||
get<T>(
|
||||
key: string,
|
||||
cb?: Callback<T>
|
||||
): T;
|
||||
|
||||
/**
|
||||
* get multiple cached keys at once and change the stats
|
||||
*
|
||||
* @param keys an array of keys
|
||||
* @param cb Callback function
|
||||
*/
|
||||
mget<T>(
|
||||
keys: string[],
|
||||
cb?: Callback<{[key: string]: T}>
|
||||
): {[key: string]: T};
|
||||
|
||||
/**
|
||||
* set a cached key and change the stats
|
||||
*
|
||||
* @param key cache key
|
||||
* @param value A element to cache. If the option `option.forceString` is `true` the module trys to translate
|
||||
* it to a serialized JSON
|
||||
* @param ttl The time to live in seconds.
|
||||
* @param cb Callback function
|
||||
*/
|
||||
set<T>(
|
||||
key: string,
|
||||
value: T,
|
||||
ttl: number|string,
|
||||
cb?: Callback<boolean>
|
||||
): boolean;
|
||||
|
||||
set<T>(
|
||||
key: string,
|
||||
value: T,
|
||||
cb?: Callback<boolean>
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* remove keys
|
||||
* @param keys cache key to delete or a array of cache keys
|
||||
* @param cb Callback function
|
||||
* @returns Number of deleted keys
|
||||
*/
|
||||
del(
|
||||
keys: string|string[],
|
||||
cb?: Callback<number>
|
||||
): number;
|
||||
|
||||
/**
|
||||
* reset or redefine the ttl of a key. If `ttl` is not passed or set to 0 it's similar to `.del()`
|
||||
*/
|
||||
ttl(
|
||||
key: string,
|
||||
ttl: number,
|
||||
cb?: Callback<boolean>
|
||||
): boolean;
|
||||
|
||||
ttl(
|
||||
key: string,
|
||||
cb?: Callback<boolean>,
|
||||
ttl?: number
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* list all keys within this cache
|
||||
* @param cb Callback function
|
||||
* @returns An array of all keys
|
||||
*/
|
||||
keys(cb?: Callback<string[]>): string[];
|
||||
|
||||
/**
|
||||
* get the stats
|
||||
*
|
||||
* @returns Stats data
|
||||
*/
|
||||
getStats(): Stats;
|
||||
|
||||
/**
|
||||
* flush the hole data and reset the stats
|
||||
*/
|
||||
flushAll(): void;
|
||||
|
||||
/**
|
||||
* This will clear the interval timeout which is set on checkperiod option.
|
||||
*/
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export = NodeCache;
|
||||
}
|
||||
Vendored
+5
@@ -9,6 +9,11 @@
|
||||
* *
|
||||
************************************************/
|
||||
|
||||
interface Error {
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
|
||||
// compat for TypeScript 1.5.3
|
||||
// if you use with --target es3 or --target es5 and use below definitions,
|
||||
// use the lib.es6.d.ts that is bundled with TypeScript 1.5.3.
|
||||
|
||||
@@ -16,8 +16,11 @@ var featureLoader: ol.FeatureLoader;
|
||||
var easingFunction: (t: number) => number;
|
||||
|
||||
// Type variables for OpenLayers
|
||||
var circle: ol.geom.Circle;
|
||||
var color: ol.Color;
|
||||
var coordinate: ol.Coordinate;
|
||||
var coordinatesArray: Array<ol.Coordinate>;
|
||||
var coordinatesArrayDim2: Array<Array<ol.Coordinate>>;
|
||||
var extent: ol.Extent;
|
||||
var boundingCoordinates: Array<ol.Coordinate>;
|
||||
var size: ol.Size;
|
||||
@@ -27,14 +30,28 @@ var feature: ol.Feature;
|
||||
var featureArray: Array<ol.Feature>;
|
||||
var graticule: ol.Graticule
|
||||
var geometry: ol.geom.Geometry;
|
||||
var geometriesArray: Array<ol.geom.Geometry>;
|
||||
var feature: ol.Feature;
|
||||
var featureArray: Array<ol.Feature>;
|
||||
var featureFormat: ol.format.Feature;
|
||||
var geometry: ol.geom.Geometry;
|
||||
var geometryCollection: ol.geom.GeometryCollection;
|
||||
var geometryLayout: ol.geom.GeometryLayout;
|
||||
var geometryType: ol.geom.GeometryType;
|
||||
var linearRing: ol.geom.LinearRing;
|
||||
var lineString: ol.geom.LineString;
|
||||
var loadingstrategy: ol.LoadingStrategy;
|
||||
var multiLineString: ol.geom.MultiLineString;
|
||||
var multiPoint: ol.geom.MultiPoint;
|
||||
var multiPolygon: ol.geom.MultiPolygon;
|
||||
var point: ol.geom.Point;
|
||||
var polygon: ol.geom.Polygon;
|
||||
var simpleGeometry: ol.geom.SimpleGeometry;
|
||||
var tilegrid: ol.tilegrid.TileGrid;
|
||||
var vector: ol.source.Vector;
|
||||
var projection: ol.proj.Projection;
|
||||
var projectionLike: ol.proj.ProjectionLike;
|
||||
var transformFn: ol.TransformFunction;
|
||||
|
||||
//
|
||||
// ol.Attribution
|
||||
@@ -103,17 +120,172 @@ loadingstrategy = ol.loadingstrategy.all;
|
||||
loadingstrategy = ol.loadingstrategy.bbox;
|
||||
loadingstrategy = ol.loadingstrategy.tile(tilegrid);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Circle
|
||||
//
|
||||
booleanValue = circle.intersectsExtent(extent);
|
||||
circle = circle.transform(projectionLike, projectionLike);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Geometry
|
||||
//
|
||||
|
||||
var geometryResult: ol.geom.Geometry;
|
||||
coordinate = geometryResult.getClosestPoint(coordinate);
|
||||
geometryResult.getClosestPoint(coordinate, coordinate);
|
||||
extent = geometryResult.getExtent();
|
||||
geometryResult.getExtent(extent);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.GeometryCollection
|
||||
//
|
||||
geometryCollection = new ol.geom.GeometryCollection(geometriesArray)
|
||||
geometryCollection = new ol.geom.GeometryCollection();
|
||||
voidValue = geometryCollection.applyTransform(transformFn);
|
||||
geometryCollection = geometryCollection.clone();
|
||||
geometriesArray = geometryCollection.getGeometries();
|
||||
geometryType = geometryCollection.getType();
|
||||
booleanValue = geometryCollection.intersectsExtent(extent);
|
||||
voidValue = geometryCollection.setGeometries(geometriesArray);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.LinearRing
|
||||
//
|
||||
linearRing = new ol.geom.LinearRing(coordinatesArray);
|
||||
linearRing = new ol.geom.LinearRing(coordinatesArray, geometryLayout);
|
||||
linearRing = linearRing.clone();
|
||||
numberValue = linearRing.getArea();
|
||||
coordinatesArray = linearRing.getCoordinates();
|
||||
geometryType = linearRing.getType();
|
||||
voidValue = linearRing.setCoordinates(coordinatesArray);
|
||||
voidValue = linearRing.setCoordinates(coordinatesArray, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.LineString
|
||||
//
|
||||
lineString = new ol.geom.LineString(coordinatesArray);
|
||||
lineString = new ol.geom.LineString(coordinatesArray, geometryLayout);
|
||||
voidValue = lineString.appendCoordinate(coordinate);
|
||||
lineString = lineString.clone();
|
||||
coordinate = lineString.getCoordinateAtM(numberValue);
|
||||
coordinate = lineString.getCoordinateAtM(numberValue, booleanValue);
|
||||
coordinatesArray = lineString.getCoordinates();
|
||||
numberValue = lineString.getLength();
|
||||
geometryType = lineString.getType();
|
||||
booleanValue = lineString.intersectsExtent(extent);
|
||||
voidValue = lineString.setCoordinates(coordinatesArray);
|
||||
voidValue = lineString.setCoordinates(coordinatesArray, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.MultiLineString
|
||||
//
|
||||
var lineStringsArray: Array<ol.geom.LineString>;
|
||||
|
||||
multiLineString = new ol.geom.MultiLineString(coordinatesArrayDim2);
|
||||
multiLineString = new ol.geom.MultiLineString(coordinatesArrayDim2, geometryLayout);
|
||||
voidValue = multiLineString.appendLineString(lineString);
|
||||
multiLineString = multiLineString.clone();
|
||||
coordinate = multiLineString.getCoordinateAtM(numberValue);
|
||||
coordinate = multiLineString.getCoordinateAtM(numberValue, booleanValue);
|
||||
coordinate = multiLineString.getCoordinateAtM(numberValue, booleanValue, booleanValue);
|
||||
coordinatesArrayDim2 = multiLineString.getCoordinates();
|
||||
lineString = multiLineString.getLineString(numberValue);
|
||||
lineStringsArray = multiLineString.getLineStrings();
|
||||
geometryType = multiLineString.getType();
|
||||
booleanValue = multiLineString.intersectsExtent(extent);
|
||||
voidValue = multiLineString.setCoordinates(coordinatesArrayDim2);
|
||||
voidValue = multiLineString.setCoordinates(coordinatesArrayDim2, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.MultiPoint
|
||||
//
|
||||
var pointsArray: Array<ol.geom.Point>;
|
||||
|
||||
multiPoint = new ol.geom.MultiPoint(coordinatesArray);
|
||||
multiPoint = new ol.geom.MultiPoint(coordinatesArray, geometryLayout);
|
||||
voidValue = multiPoint.appendPoint(point);
|
||||
multiPoint = multiPoint.clone();
|
||||
coordinatesArray = multiPoint.getCoordinates();
|
||||
point = multiPoint.getPoint(numberValue);
|
||||
pointsArray = multiPoint.getPoints();
|
||||
geometryType = multiPoint.getType();
|
||||
booleanValue = multiPoint.intersectsExtent(extent);
|
||||
voidValue = multiPoint.setCoordinates(coordinatesArray);
|
||||
voidValue = multiPoint.setCoordinates(coordinatesArray, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.MultiPolygon
|
||||
//
|
||||
var coordinatesArrayDim3: Array<Array<Array<ol.Coordinate>>>;
|
||||
var polygonsArray: Array<ol.geom.Polygon>;
|
||||
|
||||
multiPolygon = new ol.geom.MultiPolygon(coordinatesArrayDim3);
|
||||
multiPolygon = new ol.geom.MultiPolygon(coordinatesArrayDim3, geometryLayout);
|
||||
voidValue = multiPolygon.appendPolygon(polygon);
|
||||
multiPolygon = multiPolygon.clone();
|
||||
numberValue = multiPolygon.getArea();
|
||||
coordinatesArrayDim3 = multiPolygon.getCoordinates();
|
||||
coordinatesArrayDim3 = multiPolygon.getCoordinates(booleanValue);
|
||||
multiPoint = multiPolygon.getInteriorPoints();
|
||||
polygon = multiPolygon.getPolygon(numberValue);
|
||||
polygonsArray = multiPolygon.getPolygons();
|
||||
geometryType = multiPolygon.getType();
|
||||
booleanValue = multiPolygon.intersectsExtent(extent);
|
||||
voidValue = multiPolygon.setCoordinates(coordinatesArrayDim3);
|
||||
voidValue = multiPolygon.setCoordinates(coordinatesArrayDim3, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Point
|
||||
//
|
||||
point = new ol.geom.Point(coordinate);
|
||||
point = new ol.geom.Point(coordinate, geometryLayout);
|
||||
point = point.clone();
|
||||
coordinate = point.getCoordinates();
|
||||
geometryType = point.getType();
|
||||
booleanValue = point.intersectsExtent(extent);
|
||||
voidValue = point.setCoordinates(coordinate);
|
||||
voidValue = point.setCoordinates(coordinate, geometryLayout);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.Polygon
|
||||
//
|
||||
var localSphere: ol.Sphere;
|
||||
var linearRingsArray: Array<ol.geom.LinearRing>;
|
||||
|
||||
polygon = new ol.geom.Polygon(coordinatesArrayDim2);
|
||||
polygon = new ol.geom.Polygon(coordinatesArrayDim2, geometryLayout);
|
||||
polygon = ol.geom.Polygon.circular(localSphere, coordinate, numberValue);
|
||||
polygon = ol.geom.Polygon.circular(localSphere, coordinate, numberValue, numberValue);
|
||||
voidValue = polygon.appendLinearRing(linearRing);
|
||||
polygon = polygon.clone();
|
||||
numberValue = polygon.getArea();
|
||||
coordinatesArrayDim2 = polygon.getCoordinates();
|
||||
coordinatesArrayDim2 = polygon.getCoordinates(booleanValue);
|
||||
point = polygon.getInteriorPoint();
|
||||
linearRing = polygon.getLinearRing(numberValue);
|
||||
linearRingsArray = polygon.getLinearRings();
|
||||
geometryType = polygon.getType();
|
||||
booleanValue = polygon.intersectsExtent(extent);
|
||||
|
||||
//
|
||||
//
|
||||
// ol.geom.SimpleGeometry
|
||||
//
|
||||
simpleGeometry.applyTransform(transformFn);
|
||||
coordinate = simpleGeometry.getFirstCoordinate();
|
||||
coordinate = simpleGeometry.getLastCoordinate();
|
||||
geometryLayout = simpleGeometry.getLayout();
|
||||
voidValue = simpleGeometry.translate(numberValue, numberValue);
|
||||
|
||||
//
|
||||
// ol.source
|
||||
//
|
||||
|
||||
Vendored
+599
-15
@@ -2733,12 +2733,41 @@ declare module ol {
|
||||
}
|
||||
|
||||
module geom {
|
||||
|
||||
|
||||
// Type definitions
|
||||
interface GeometryLayout extends String { }
|
||||
interface GeometryType extends String { }
|
||||
|
||||
/**
|
||||
* Abstract base class; only used for creating subclasses; do not instantiate
|
||||
* in apps, as cannot be rendered.
|
||||
*/
|
||||
class Circle extends ol.geom.SimpleGeometry {
|
||||
|
||||
class Circle {
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Transform each coordinate of the circle from one coordinate reference system
|
||||
* to another. The geometry is modified in place.
|
||||
* If you do not want the geometry modified in place, first clone() it and
|
||||
* then use this function on the clone.
|
||||
*
|
||||
* Internally a circle is currently represented by two points: the center of
|
||||
* the circle `[cx, cy]`, and the point to the right of the circle
|
||||
* `[cx + r, cy]`. This `transform` function just transforms these two points.
|
||||
* So the resulting geometry is also a circle, and that circle does not
|
||||
* correspond to the shape that would be obtained by transforming every point
|
||||
* of the original circle.
|
||||
* @param source The current projection. Can be a string identifier or a {@link ol.proj.Projection} object.
|
||||
* @param destination The desired projection. Can be a string identifier or a {@link ol.proj.Projection} object.
|
||||
* @returns This geometry. Note that original geometry is modified in place.
|
||||
*/
|
||||
transform(source: ol.proj.ProjectionLike, destination: ol.proj.ProjectionLike): ol.geom.Circle;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2762,35 +2791,590 @@ declare module ol {
|
||||
getExtent(extent?: ol.Extent): ol.Extent;
|
||||
}
|
||||
|
||||
class GeometryCollection {
|
||||
/**
|
||||
* An array of ol.geom.Geometry objects.
|
||||
*/
|
||||
class GeometryCollection extends ol.geom.Geometry {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param geometries Geometries.
|
||||
*/
|
||||
constructor(geometries?: Array<ol.geom.Geometry>);
|
||||
|
||||
/**
|
||||
* Apply a transform function to each coordinate of the geometry. The geometry is modified in place.
|
||||
* If you do not want the geometry modified in place, first clone() it and then use this function on the clone.
|
||||
* @param transformFn TransformFunction
|
||||
*/
|
||||
applyTransform(transformFn: ol.TransformFunction): void;
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.GeometryCollection;
|
||||
|
||||
/**
|
||||
* Return the geometries that make up this geometry collection.
|
||||
* @returns Geometries.
|
||||
*/
|
||||
getGeometries(): Array<Geometry>;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Set the geometries that make up this geometry collection.
|
||||
* @param geometries Geometries.
|
||||
*/
|
||||
setGeometries(geometries: Array<ol.geom.Geometry>): void;
|
||||
|
||||
}
|
||||
|
||||
class LinearRing {
|
||||
/**
|
||||
* Linear ring geometry. Only used as part of polygon; cannot be rendered
|
||||
* on its own.
|
||||
*/
|
||||
class LinearRing extends SimpleGeometry {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.LinearRing;
|
||||
|
||||
/**
|
||||
* Return the area of the linear ring on projected plane.
|
||||
* @returns Area (on projected plane).
|
||||
*/
|
||||
getArea(): number;
|
||||
|
||||
/**
|
||||
* Return the coordinates of the linear ring.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(): Array<ol.Coordinate>;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* @Set the coordinates of the linear ring
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: Array<ol.Coordinate>, layout?: any): void;
|
||||
|
||||
}
|
||||
|
||||
class LineString {
|
||||
new(): LineString;
|
||||
/**
|
||||
* Linestring geometry.
|
||||
*/
|
||||
class LineString extends ol.geom.SimpleGeometry {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Append the passed coordinate to the coordinates of the linestring.
|
||||
* @param coordinate Coordinate.
|
||||
*/
|
||||
appendCoordinate(coordinate: ol.Coordinate): void;
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.LineString;
|
||||
|
||||
/**
|
||||
* Returns the coordinate at `m` using linear interpolation, or `null` if no
|
||||
* such coordinate exists.
|
||||
*
|
||||
* `extrapolate` controls extrapolation beyond the range of Ms in the
|
||||
* MultiLineString. If `extrapolate` is `true` then Ms less than the first
|
||||
* M will return the first coordinate and Ms greater than the last M will
|
||||
* return the last coordinate.
|
||||
*
|
||||
* @param m M.
|
||||
* @param extrapolate Extrapolate. Default is `false`.
|
||||
* @returns Coordinate.
|
||||
*/
|
||||
getCoordinateAtM(m: number, extrapolate?: boolean): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Return the coordinates of the linestring.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(): Array<ol.Coordinate>;
|
||||
|
||||
/**
|
||||
* Return the length of the linestring on projected plane.
|
||||
* @returns Length (on projected plane).
|
||||
*/
|
||||
getLength(): number;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Set the coordinates of the linestring.
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout) : void;
|
||||
}
|
||||
|
||||
class MultiLineString {
|
||||
/**
|
||||
* Multi-linestring geometry.
|
||||
*/
|
||||
class MultiLineString extends ol.geom.SimpleGeometry {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: Array<Array<ol.Coordinate>>, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Append the passed linestring to the multilinestring.
|
||||
* @param lineString LineString.
|
||||
*/
|
||||
appendLineString(lineString: ol.geom.LineString): void;
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.MultiLineString;
|
||||
|
||||
/**
|
||||
* Returns the coordinate at `m` using linear interpolation, or `null` if no
|
||||
* such coordinate exists.
|
||||
*
|
||||
* `extrapolate` controls extrapolation beyond the range of Ms in the
|
||||
* MultiLineString. If `extrapolate` is `true` then Ms less than the first
|
||||
* M will return the first coordinate and Ms greater than the last M will
|
||||
* return the last coordinate.
|
||||
*
|
||||
* `interpolate` controls interpolation between consecutive LineStrings
|
||||
* within the MultiLineString. If `interpolate` is `true` the coordinates
|
||||
* will be linearly interpolated between the last coordinate of one LineString
|
||||
* and the first coordinate of the next LineString. If `interpolate` is
|
||||
* `false` then the function will return `null` for Ms falling between
|
||||
* LineStrings.
|
||||
*
|
||||
* @param m M.
|
||||
* @param extrapolate Extrapolate. Default is `false`.
|
||||
* @param interpolate Interpolate. Default is `false`.
|
||||
* @returns Coordinate.
|
||||
*/
|
||||
getCoordinateAtM(m: number, extrapolate?: boolean, interpolate?: boolean): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Return the coordinates of the multilinestring.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(): Array<Array<ol.Coordinate>>;
|
||||
|
||||
/**
|
||||
* Return the linestring at the specified index.
|
||||
* @param index Index.
|
||||
* @returns LineString.
|
||||
*/
|
||||
getLineString(index: number): ol.geom.LineString;
|
||||
|
||||
/**
|
||||
* Return the linestrings of this multilinestring.
|
||||
* @returns LineStrings.
|
||||
*/
|
||||
getLineStrings(): Array<ol.geom.LineString>;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Set the coordinates of the multilinestring.
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: Array<Array<ol.Coordinate>>, layout?: ol.geom.GeometryLayout): void;
|
||||
}
|
||||
|
||||
class MultiPoint {
|
||||
/**
|
||||
* Multi-point geometry.
|
||||
*/
|
||||
class MultiPoint extends ol.geom.SimpleGeometry {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Append the passed point to this multipoint.
|
||||
* @param {ol.geom.Point} point Point.
|
||||
*/
|
||||
appendPoint(point: ol.geom.Point): void;
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.MultiPoint;
|
||||
|
||||
/**
|
||||
* Return the coordinates of the multipoint.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(): Array<ol.Coordinate>;
|
||||
|
||||
/**
|
||||
* Return the point at the specified index.
|
||||
* @param index Index.
|
||||
* @returns Point.
|
||||
*/
|
||||
getPoint(index: number): ol.geom.Point;
|
||||
|
||||
/**
|
||||
* Return the points of this multipoint.
|
||||
* @returns Points.
|
||||
*/
|
||||
getPoints(): Array<ol.geom.Point>;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Set the coordinates of the multipoint.
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: Array<ol.Coordinate>, layout?: ol.geom.GeometryLayout): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multi-polygon geometry.
|
||||
*/
|
||||
class MultiPolygon extends ol.geom.SimpleGeometry {
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: Array<Array<Array<ol.Coordinate>>>, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Append the passed polygon to this multipolygon.
|
||||
* @param polygon Polygon.
|
||||
*/
|
||||
appendPolygon(polygon: ol.geom.Polygon): void;
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.MultiPolygon;
|
||||
|
||||
/**
|
||||
* Return the area of the multipolygon on projected plane.
|
||||
* @returns Area (on projected plane).
|
||||
*/
|
||||
getArea(): number;
|
||||
|
||||
/**
|
||||
* Get the coordinate array for this geometry. This array has the structure
|
||||
* of a GeoJSON coordinate array for multi-polygons.
|
||||
*
|
||||
* @param right Orient coordinates according to the right-hand
|
||||
* rule (counter-clockwise for exterior and clockwise for interior rings).
|
||||
* If `false`, coordinates will be oriented according to the left-hand rule
|
||||
* (clockwise for exterior and counter-clockwise for interior rings).
|
||||
* By default, coordinate orientation will depend on how the geometry was
|
||||
* constructed.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(right?: boolean): Array<Array<Array<ol.Coordinate>>>;
|
||||
|
||||
/**
|
||||
* Return the interior points as {@link ol.geom.MultiPoint multipoint}.
|
||||
* @returns Interior points.
|
||||
*/
|
||||
getInteriorPoints(): ol.geom.MultiPoint;
|
||||
|
||||
/**
|
||||
* Return the polygon at the specified index.
|
||||
* @param index Index.
|
||||
* @returns Polygon.
|
||||
*/
|
||||
getPolygon(index: number): ol.geom.Polygon;
|
||||
|
||||
/**
|
||||
* Return the polygons of this multipolygon.
|
||||
* @returns Polygons.
|
||||
*/
|
||||
getPolygons(): Array<ol.geom.Polygon>;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
class MultiPolygon {
|
||||
/**
|
||||
* Set the coordinates of the multipolygon.
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: Array<Array<Array<ol.Coordinate>>>, layout?: ol.geom.GeometryLayout): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Point geometry.
|
||||
*/
|
||||
class Point extends SimpleGeometry {
|
||||
constructor(coordinates: ol.Coordinate, layout?: geom.GeometryLayout);
|
||||
getCoordinates(): ol.Coordinate;
|
||||
setCoordinates(coordinates: ol.Coordinate, opt?: geom.GeometryLayout): void;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: ol.Coordinate, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.Point;
|
||||
|
||||
/**
|
||||
* Return the coordinate of the point.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Set the coordinate of the point.
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: ol.Coordinate, layout?: ol.geom.GeometryLayout): void;
|
||||
}
|
||||
|
||||
class Polygon {
|
||||
}
|
||||
/**
|
||||
* Polygon geometry.
|
||||
*/
|
||||
class Polygon extends SimpleGeometry {
|
||||
|
||||
class SimpleGeometry extends Geometry {
|
||||
/**
|
||||
* constructor
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
constructor(coordinates: Array<Array<ol.Coordinate>>, layout?: ol.geom.GeometryLayout);
|
||||
|
||||
/**
|
||||
* Create an approximation of a circle on the surface of a sphere.
|
||||
* @param sphere The sphere.
|
||||
* @param center Center (`[lon, lat]` in degrees).
|
||||
* @param radius The great-circle distance from the center to the polygon vertices.
|
||||
* @param n Optional number of vertices for the resulting polygon. Default is `32`.
|
||||
* @returns The "circular" polygon.
|
||||
*/
|
||||
static circular(sphere: ol.Sphere, center: ol.Coordinate, radius: number, n?: number): ol.geom.Polygon;
|
||||
|
||||
/**
|
||||
* Append the passed linear ring to this polygon.
|
||||
* @param linearRing Linear ring.
|
||||
*/
|
||||
appendLinearRing(linearRing: ol.geom.LinearRing): void;
|
||||
|
||||
/**
|
||||
* Make a complete copy of the geometry.
|
||||
* @returns Clone.
|
||||
*/
|
||||
clone(): ol.geom.Polygon;
|
||||
|
||||
/**
|
||||
* Return the area of the polygon on projected plane.
|
||||
* @returns Area (on projected plane).
|
||||
*/
|
||||
getArea(): number;
|
||||
|
||||
/**
|
||||
* Get the coordinate array for this geometry. This array has the structure
|
||||
* of a GeoJSON coordinate array for polygons.
|
||||
*
|
||||
* @param right Orient coordinates according to the right-hand
|
||||
* rule (counter-clockwise for exterior and clockwise for interior rings).
|
||||
* If `false`, coordinates will be oriented according to the left-hand rule
|
||||
* (clockwise for exterior and counter-clockwise for interior rings).
|
||||
* By default, coordinate orientation will depend on how the geometry was
|
||||
* constructed.
|
||||
* @returns Coordinates.
|
||||
*/
|
||||
getCoordinates(right?: boolean): Array<Array<ol.Coordinate>>;
|
||||
|
||||
/**
|
||||
* Return an interior point of the polygon.
|
||||
* @returns Interior point.
|
||||
*/
|
||||
getInteriorPoint(): ol.geom.Point;
|
||||
|
||||
/**
|
||||
* Return the Nth linear ring of the polygon geometry. Return `null` if the
|
||||
* given index is out of range.
|
||||
* The exterior linear ring is available at index `0` and the interior rings
|
||||
* at index `1` and beyond.
|
||||
*
|
||||
* @param index Index.
|
||||
* @returns Linear ring.
|
||||
*/
|
||||
getLinearRing(index: number): ol.geom.LinearRing;
|
||||
|
||||
/**
|
||||
* Return the linear rings of the polygon.
|
||||
* @returns Linear rings.
|
||||
*/
|
||||
getLinearRings(): Array<ol.geom.LinearRing>;
|
||||
|
||||
/**
|
||||
* Get the type of this geometry.
|
||||
* @returns Geometry type
|
||||
*/
|
||||
getType(): ol.geom.GeometryType;
|
||||
|
||||
/**
|
||||
* Test if the geometry and the passed extent intersect.
|
||||
* @param extent Extent
|
||||
* @returns true if the geometry and the extent intersect.
|
||||
*/
|
||||
intersectsExtent(extent: ol.Extent): boolean;
|
||||
|
||||
/**
|
||||
* Set the coordinates of the polygon.
|
||||
* @param coordinates Coordinates.
|
||||
* @param layout Layout.
|
||||
*/
|
||||
setCoordinates(coordinates: Array<Array<ol.Coordinate>>, layout?: ol.geom.GeometryLayout): void;
|
||||
}
|
||||
/**
|
||||
* Abstract base class; only used for creating subclasses; do not instantiate
|
||||
* in apps, as cannot be rendered.
|
||||
*/
|
||||
class SimpleGeometry extends ol.geom.Geometry {
|
||||
|
||||
/**
|
||||
* Apply a transform function to each coordinate of the geometry. The geometry is modified in place.
|
||||
* If you do not want the geometry modified in place, first clone() it and then use this function on the clone.
|
||||
* @param transformFn TransformFunction
|
||||
*/
|
||||
applyTransform(transformFn: ol.TransformFunction): void;
|
||||
|
||||
/**
|
||||
* Return the first coordinate of the geometry.
|
||||
* @returns First coordinate.
|
||||
*/
|
||||
getFirstCoordinate(): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Return the last coordinate of the geometry.
|
||||
* @returns Last point.
|
||||
*/
|
||||
getLastCoordinate(): ol.Coordinate;
|
||||
|
||||
/**
|
||||
* Return the {@link ol.geom.GeometryLayout layout} of the geometry.
|
||||
* @returns Layout.
|
||||
*/
|
||||
getLayout(): ol.geom.GeometryLayout;
|
||||
|
||||
/**
|
||||
* Translate the geometry. This modifies the geometry coordinates in place.
|
||||
* If instead you want a new geometry, first clone() this geometry.
|
||||
* @param deltaX Delta X
|
||||
* @param deltaY Delta Y
|
||||
*/
|
||||
translate(deltaX: number, deltaY: number): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/// <reference path="phonegap-plugin-push.d.ts" />
|
||||
|
||||
function test() {
|
||||
var options:PhonegapPluginPush.InitOptions = {
|
||||
android: {
|
||||
senderID: '123456789',
|
||||
icon: 'phonegap',
|
||||
iconColor: 'blue',
|
||||
sound: true,
|
||||
vibrate: true,
|
||||
clearNotifications: false
|
||||
},
|
||||
ios: {
|
||||
badge: true,
|
||||
sound: true,
|
||||
alert: true
|
||||
},
|
||||
windows: {}
|
||||
};
|
||||
var push:PhonegapPluginPush.PushNotification;
|
||||
|
||||
/*from constructor*/
|
||||
push = new PushNotification(options);
|
||||
|
||||
push.unregister(() => {
|
||||
console.log('did unregister');
|
||||
}, () => {
|
||||
console.log('did not unregister');
|
||||
});
|
||||
|
||||
/*from init*/
|
||||
push = PushNotification.init(options);
|
||||
|
||||
push.on('registration', (data:PhonegapPluginPush.RegistrationEventResponse) => {
|
||||
console.log(data.registrationId);
|
||||
});
|
||||
|
||||
push.on('notification', (data:PhonegapPluginPush.NotificationEventResponse) => {
|
||||
console.log(data.message);
|
||||
console.log(data.title);
|
||||
console.log(data.count);
|
||||
console.log(data.sound);
|
||||
console.log(data.image);
|
||||
|
||||
/*the rest of the additional fields are not 'canon'*/
|
||||
console.log(data.additionalData);
|
||||
console.log(data.additionalData.foreground);
|
||||
});
|
||||
|
||||
push.on('error', (e:Error) => {
|
||||
console.log(e.message);
|
||||
});
|
||||
|
||||
push.setApplicationIconBadgeNumber(() => {
|
||||
console.log('did setApplicationIconBadgeNumber');
|
||||
}, () => {
|
||||
console.log('did not setApplicationIconBadgeNumber');
|
||||
}, 1);
|
||||
}
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
// Type definitions for phonegap-plugin-push
|
||||
// Project: https://github.com/phonegap/phonegap-plugin-push
|
||||
// Definitions by: Frederico Galvão <https://github.com/fredgalvao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module PhonegapPluginPush {
|
||||
type EventResponse = RegistrationEventResponse | NotificationEventResponse | Error
|
||||
|
||||
interface PushNotification {
|
||||
/**
|
||||
* The event registration will be triggered on each successful registration with the 3rd party push service.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event:"registration", callback:(response:RegistrationEventResponse)=>any):void
|
||||
/**
|
||||
* The event notification will be triggered each time a push notification is received by a 3rd party push service on the device.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event:"notification", callback:(response:NotificationEventResponse)=>any):void
|
||||
/**
|
||||
* The event error will trigger when an internal error occurs and the cache is aborted.
|
||||
* @param event
|
||||
* @param callback
|
||||
*/
|
||||
on(event:"error", callback:(response:Error)=>any):void
|
||||
/*Generic one, needed for the overloads*/
|
||||
/**
|
||||
*
|
||||
* @param event Name of the event to listen to. See below(above) for all the event names.
|
||||
* @param callback is called when the event is triggered.
|
||||
*/
|
||||
on(event:string, callback:(response:EventResponse)=>any):void
|
||||
|
||||
/**
|
||||
* The unregister method is used when the application no longer wants to receive push notifications.
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
*/
|
||||
unregister(successHandler:()=>any, errorHandler?:()=>any):void
|
||||
/*TODO according to js source code, "errorHandler" is optional, but is "count" also optional? I can't read objetive-C code (can anyone at all? I wonder...)*/
|
||||
/**
|
||||
* Set the badge count visible when the app is not running
|
||||
*
|
||||
* The count is an integer indicating what number should show up in the badge. Passing 0 will clear the badge. Each notification event contains a data.count value which can be used to set the badge to correct number.
|
||||
* @param successHandler
|
||||
* @param errorHandler
|
||||
* @param count
|
||||
*/
|
||||
setApplicationIconBadgeNumber(successHandler:()=>any, errorHandler:()=>any, count:number):void
|
||||
}
|
||||
|
||||
/**
|
||||
* platform specific initialization options.
|
||||
*/
|
||||
interface InitOptions {
|
||||
/**
|
||||
* Android specific initialization options.
|
||||
*/
|
||||
android?: {
|
||||
/**
|
||||
* Maps to the project number in the Google Developer Console.
|
||||
*/
|
||||
senderID:string
|
||||
/**
|
||||
* The name of a drawable resource to use as the small-icon.
|
||||
*/
|
||||
icon?:string
|
||||
/**
|
||||
* Sets the background color of the small icon.
|
||||
* Supported Formats - http://developer.android.com/reference/android/graphics/Color.html#parseColor(java.lang.String)
|
||||
*/
|
||||
iconColor?:string
|
||||
/**
|
||||
* If true it plays the sound specified in the push data or the default system sound. Default is true.
|
||||
*/
|
||||
sound?:boolean
|
||||
/**
|
||||
* If true the device vibrates on receipt of notification. Default is true.
|
||||
*/
|
||||
vibrate?:boolean
|
||||
/**
|
||||
* If true the app clears all pending notifications when it is closed. Default is true.
|
||||
*/
|
||||
clearNotifications?:boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* iOS specific initialization options.
|
||||
*/
|
||||
ios?: {
|
||||
/**
|
||||
* If true the device shows an alert on receipt of notification. Default is false.
|
||||
*/
|
||||
badge?: boolean
|
||||
/**
|
||||
* If true the device sets the badge number on receipt of notification. Default is false.
|
||||
*/
|
||||
sound?: boolean
|
||||
/**
|
||||
* If true the device plays a sound on receipt of notification. Default is false.
|
||||
*/
|
||||
alert?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Windows specific initialization options.
|
||||
*/
|
||||
windows?: {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
interface RegistrationEventResponse {
|
||||
/**
|
||||
* The registration ID provided by the 3rd party remote push service.
|
||||
*/
|
||||
registrationId:string
|
||||
}
|
||||
|
||||
interface NotificationEventResponse {
|
||||
/**
|
||||
* The text of the push message sent from the 3rd party service.
|
||||
*/
|
||||
message:string
|
||||
/**
|
||||
* The optional title of the push message sent from the 3rd party service.
|
||||
*/
|
||||
title?:string
|
||||
/**
|
||||
* The number of messages to be displayed in the badge iOS or message count in the notification shade in Android.
|
||||
* For windows, it represents the value in the badge notification which could be a number or a status glyph.
|
||||
*/
|
||||
count:string
|
||||
/**
|
||||
* The name of the sound file to be played upon receipt of the notification.
|
||||
*/
|
||||
sound:string
|
||||
/**
|
||||
* The path of the image file to be displayed in the notification.
|
||||
*/
|
||||
image:string
|
||||
/**
|
||||
* An optional collection of data sent by the 3rd party push service that does not fit in the above properties.
|
||||
*/
|
||||
additionalData: NotificationEventAdditionalData
|
||||
}
|
||||
|
||||
interface NotificationEventAdditionalData {
|
||||
/**
|
||||
* TODO: document all possible properties (I only got the android ones)
|
||||
*
|
||||
* Loosened up with a dictionary notation, but all non-defined properties need to use (map['prop']) notation
|
||||
*
|
||||
* Ideally the developer would overload (merged declaration) this or create a new interface that would extend this one
|
||||
* so that he could specify any custom code without having to use array notation (map['prop']) for all of them.
|
||||
*/
|
||||
[name: string]: any
|
||||
/**
|
||||
* Whether the notification was received while the app was in the foreground
|
||||
*/
|
||||
foreground?:boolean
|
||||
collapse_key?:string
|
||||
from?:string
|
||||
notId?:string
|
||||
}
|
||||
|
||||
interface PushNotificationStatic {
|
||||
init(options:InitOptions):PushNotification
|
||||
new(options:InitOptions):PushNotification
|
||||
}
|
||||
}
|
||||
|
||||
interface Window {
|
||||
PushNotification:PhonegapPluginPush.PushNotificationStatic
|
||||
}
|
||||
declare var PushNotification:PhonegapPluginPush.PushNotificationStatic;
|
||||
@@ -0,0 +1,43 @@
|
||||
/// <reference path="./precond.d.ts" />
|
||||
|
||||
import precond = require('precond');
|
||||
|
||||
precond.checkArgument(true);
|
||||
precond.checkArgument(true, "msg");
|
||||
precond.checkArgument(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkState(true);
|
||||
precond.checkState(true, "msg");
|
||||
precond.checkState(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsDef(true);
|
||||
precond.checkIsDef(true, "msg");
|
||||
precond.checkIsDef(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsDefAndNotNull(true);
|
||||
precond.checkIsDefAndNotNull(true, "msg");
|
||||
precond.checkIsDefAndNotNull(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsString(true);
|
||||
precond.checkIsString(true, "msg");
|
||||
precond.checkIsString(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsArray(true);
|
||||
precond.checkIsArray(true, "msg");
|
||||
precond.checkIsArray(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsNumber(true);
|
||||
precond.checkIsNumber(true, "msg");
|
||||
precond.checkIsNumber(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsBoolean(true);
|
||||
precond.checkIsBoolean(true, "msg");
|
||||
precond.checkIsBoolean(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsFunction(true);
|
||||
precond.checkIsFunction(true, "msg");
|
||||
precond.checkIsFunction(true, "%s %s %s", 1, "two");
|
||||
|
||||
precond.checkIsObject(true);
|
||||
precond.checkIsObject(true, "msg");
|
||||
precond.checkIsObject(true, "%s %s %s", 1, "two");
|
||||
@@ -0,0 +1 @@
|
||||
--noImplicitAny --module commonjs
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for precond 0.2.3
|
||||
// Project: https://github.com/MathieuTurcotte/node-precond
|
||||
// Definitions by: Oliver Schneider <https://github.com/olsio>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "precond" {
|
||||
export function checkArgument(value: any, message?: string, ...formatArgs: any[]): void;
|
||||
export function checkState(value: any, message?: string, ...formatArgs: any[]): void;
|
||||
export function checkIsDef(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsDefAndNotNull(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsString(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsArray(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsNumber(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsBoolean(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsFunction(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
export function checkIsObject(value: any, message?: string, ...formatArgs: any[]): any;
|
||||
}
|
||||
@@ -68,4 +68,16 @@ function test_Hierarchical_addressing() {
|
||||
// topics, three times in total
|
||||
// But, mySpecificSubscriber will only be called once, as it only
|
||||
// subscribes to the 'car.drive' topic
|
||||
}
|
||||
|
||||
function ClearAllSubscriptions() {
|
||||
// create a function to receive messages
|
||||
var mySubscriber = (msg: string, data: any) => { console.log(msg, data); }
|
||||
|
||||
// create two subscriptions
|
||||
PubSub.subscribe('topic1', mySubscriber);
|
||||
PubSub.subscribe('topic2', mySubscriber);
|
||||
|
||||
// unsubscribe from all subscrpitions
|
||||
PubSub.clearAllSubscriptions();
|
||||
}
|
||||
Vendored
+11
-2
@@ -1,10 +1,10 @@
|
||||
// Type definitions for PubSubJS 1.3.5
|
||||
// Type definitions for PubSubJS 1.5.2
|
||||
// Project: https://github.com/mroderick/PubSubJS
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module PubSubJS {
|
||||
interface Base extends Publish, Subscribe, Unsubscribe {
|
||||
interface Base extends Publish, Subscribe, Unsubscribe, ClearAllSubscriptions {
|
||||
version: string;
|
||||
name: string;
|
||||
}
|
||||
@@ -25,6 +25,15 @@ declare module PubSubJS {
|
||||
interface Unsubscribe{
|
||||
unsubscribe(tokenOrFunction: any): any;
|
||||
}
|
||||
|
||||
|
||||
interface ClearAllSubscriptions{
|
||||
clearAllSubscriptions(): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare var PubSub: PubSubJS.Base;
|
||||
|
||||
declare module "pubsub-js" {
|
||||
export = PubSub;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,353 @@
|
||||
/// <reference path="pusher-js.d.ts" />
|
||||
|
||||
import Pusher = require('pusher-js');
|
||||
import { PresenceChannel } from "pusher-js";
|
||||
|
||||
var API_KEY: string;
|
||||
var pusher: Pusher.Pusher;
|
||||
|
||||
//
|
||||
// Configuration
|
||||
//
|
||||
|
||||
pusher = new Pusher(API_KEY, {
|
||||
authEndpoint: "http://example.com/pusher/auth"
|
||||
});
|
||||
|
||||
pusher = new Pusher(API_KEY, {
|
||||
auth: {
|
||||
params: { foo: "bar" },
|
||||
headers: { baz: "boo" }
|
||||
}
|
||||
});
|
||||
|
||||
pusher = new Pusher(API_KEY, {
|
||||
auth: {
|
||||
params: { foo: "bar" },
|
||||
headers: { "X-CSRF-Token": "SOME_CSRF_TOKEN" }
|
||||
}
|
||||
});
|
||||
|
||||
pusher = new Pusher(API_KEY, { cluster: "eu" });
|
||||
|
||||
pusher = new Pusher(API_KEY, { enabledTransports: ["ws"] });
|
||||
|
||||
pusher = new Pusher(API_KEY, { disabledTransports: ["sockjs"] });
|
||||
|
||||
// will only use WebSockets
|
||||
pusher = new Pusher(API_KEY, {
|
||||
enabledTransports: ["ws", "xhr_streaming"],
|
||||
disabledTransports: ["xhr_streaming"]
|
||||
});
|
||||
|
||||
//
|
||||
// Connection
|
||||
//
|
||||
|
||||
var socket: Pusher.Pusher;
|
||||
var my_channel: Pusher.Channel;
|
||||
var channels: Pusher.Channel[];
|
||||
|
||||
socket = new Pusher(API_KEY);
|
||||
|
||||
//
|
||||
// Subscribing to channels
|
||||
//
|
||||
|
||||
my_channel = socket.subscribe('my-channel');
|
||||
|
||||
my_channel = socket.subscribe('private-my-channel');
|
||||
|
||||
channels = socket.allChannels();
|
||||
console.group('Pusher - subscribed to:');
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
var channel = channels[i];
|
||||
console.log(channel.name);
|
||||
}
|
||||
console.groupEnd();
|
||||
|
||||
my_channel = socket.subscribe('my-channel');
|
||||
socket.bind('new-comment',
|
||||
function(data: any) {
|
||||
// add comment into page
|
||||
}
|
||||
);
|
||||
|
||||
var channel: Pusher.Channel;
|
||||
|
||||
var context = { title: 'Pusher' };
|
||||
var handler = function(){
|
||||
console.log('My name is ' + this.title);
|
||||
};
|
||||
channel.bind('new-comment', handler, context);
|
||||
|
||||
channel.unbind('new-comment', handler); // removes just `handler` for the `new-comment` event
|
||||
channel.unbind('new-comment'); // removes all handlers for the `new-comment` event
|
||||
channel.unbind(null, handler); // removes `handler` for all events
|
||||
channel.unbind(null, null, context); // removes all handlers for `context`
|
||||
channel.unbind(); // removes all handlers on `channel`
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Samples from Pusher Documentation
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// JavaScript Quick Start Guide
|
||||
//
|
||||
|
||||
channel.bind('my-event', function(data: any) {
|
||||
alert('An event was triggered with message: ' + data.message);
|
||||
});
|
||||
|
||||
//
|
||||
// Client API Overview
|
||||
//
|
||||
|
||||
var options: Pusher.Config;
|
||||
|
||||
var channelName: string;
|
||||
var privateChannelName: string;
|
||||
var presenceChannelName: string;
|
||||
var add_member: Function;
|
||||
var remove_member: Function;
|
||||
var update_member_count: Function;
|
||||
var eventName: string;
|
||||
var callback: Function;
|
||||
var applicationKey: string;
|
||||
var log: Function;
|
||||
var $: any;
|
||||
var data: any;
|
||||
|
||||
// Connecting to Pusher
|
||||
|
||||
pusher = new Pusher(applicationKey, options);
|
||||
|
||||
options = {
|
||||
encrypted: true, // true/false
|
||||
auth: {
|
||||
params: { // {key: value} pairs
|
||||
param1: 'value1',
|
||||
param2: 'value2'
|
||||
},
|
||||
headers: { // {key: value} pairs
|
||||
header1: 'value1',
|
||||
header2: 'value2'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
pusher = new Pusher('app_key', {
|
||||
auth: {
|
||||
params: {
|
||||
CSRFToken: 'some_csrf_token'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
pusher = new Pusher('app_key', {
|
||||
auth: {
|
||||
headers: {
|
||||
'X-CSRF-Token': 'some_csrf_token'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
pusher = new Pusher('app_key', { cluster: 'eu' });
|
||||
|
||||
pusher = new Pusher('app_key', { encrypted: true } );
|
||||
|
||||
pusher = new Pusher('app_key');
|
||||
pusher.connection.bind( 'error', function( err: any ) {
|
||||
if( err.data.code === 4004 ) {
|
||||
log('>>> detected limit error');
|
||||
}
|
||||
});
|
||||
|
||||
// Disconnecting from Pusher
|
||||
|
||||
pusher.disconnect();
|
||||
|
||||
// Connection States
|
||||
|
||||
pusher = new Pusher('YOUR_APP_KEY');
|
||||
|
||||
pusher.connection.bind('connected', function() {
|
||||
$('div#status').text('Real time is go!');
|
||||
});
|
||||
|
||||
pusher.connection.bind('connecting_in', function(delay: any) {
|
||||
alert("I haven't been able to establish a connection for this feature. " +
|
||||
"I will try again in " + delay + " seconds.")
|
||||
});
|
||||
|
||||
pusher.connection.bind('state_change', function(states: any) {
|
||||
// states = {previous: 'oldState', current: 'newState'}
|
||||
$('div#status').text("Pusher's current state is " + states.current);
|
||||
});
|
||||
|
||||
var connectionState: string = pusher.connection.state;
|
||||
|
||||
// Accessing channels
|
||||
|
||||
channel = pusher.channel(channelName);
|
||||
|
||||
// Public channels
|
||||
|
||||
channel = pusher.subscribe(channelName);
|
||||
|
||||
pusher.unsubscribe(channelName);
|
||||
|
||||
// Private channels
|
||||
|
||||
var privateChannel = pusher.subscribe(privateChannelName);
|
||||
|
||||
// Presence channels
|
||||
|
||||
var presenceChannel: PresenceChannel<any> = <any>pusher.subscribe(presenceChannelName);
|
||||
|
||||
var count: number = presenceChannel.members.count;
|
||||
|
||||
presenceChannel.members.each(function(member: Pusher.UserInfo<any>) {
|
||||
var userId = member.id;
|
||||
var userInfo = member.info;
|
||||
});
|
||||
|
||||
var some_user_id: number;
|
||||
var user = presenceChannel.members.get(some_user_id);
|
||||
|
||||
var me = presenceChannel.members.me;
|
||||
|
||||
pusher = new Pusher('app_key');
|
||||
presenceChannel = <any>pusher.subscribe('presence-example');
|
||||
presenceChannel.bind('pusher:subscription_succeeded', function() {
|
||||
var me = presenceChannel.members.me;
|
||||
var userId = me.id;
|
||||
var userInfo = me.info;
|
||||
});
|
||||
|
||||
channel = pusher.subscribe('presence-meeting-11');
|
||||
|
||||
channel.bind('pusher:subscription_succeeded', function(members: Pusher.Members<any>) {
|
||||
// for example
|
||||
update_member_count(members.count);
|
||||
|
||||
members.each(function(member) {
|
||||
// for example:
|
||||
add_member(member.id, member.info);
|
||||
});
|
||||
});
|
||||
|
||||
channel.bind('pusher:member_added', function(member: Pusher.UserInfo<any>) {
|
||||
// for example:
|
||||
add_member(member.id, member.info);
|
||||
});
|
||||
|
||||
channel.bind('pusher:member_removed', function(member: Pusher.UserInfo<any>) {
|
||||
// for example:
|
||||
remove_member(member.id, member.info);
|
||||
});
|
||||
|
||||
// Pusher Events
|
||||
|
||||
channel.bind(eventName, callback);
|
||||
|
||||
pusher = new Pusher('APP_KEY');
|
||||
channel = pusher.subscribe('APPL');
|
||||
channel.bind('new-price',
|
||||
function(data: any) {
|
||||
// add new price into the APPL widget
|
||||
}
|
||||
);
|
||||
|
||||
var context = { title: 'Pusher' };
|
||||
var handler = function(){
|
||||
console.log('My name is ' + this.title);
|
||||
};
|
||||
channel.bind('new-comment', handler, context);
|
||||
|
||||
pusher.bind(eventName, callback);
|
||||
|
||||
pusher = new Pusher('APP_KEY');
|
||||
var channel1 = pusher.subscribe('test_channel_1');
|
||||
var channel2 = pusher.subscribe('test_channel_2');
|
||||
var channel3 = pusher.subscribe('test_channel_3');
|
||||
|
||||
var eventName = 'new-comment';
|
||||
callback = function(data: any) {
|
||||
// add comment into page
|
||||
};
|
||||
|
||||
// listen for 'new-comment' event on channel 1, 2 and 3
|
||||
pusher.bind(eventName, callback);
|
||||
|
||||
// Unbinding from Events
|
||||
|
||||
channel.unbind(eventName, callback);
|
||||
|
||||
pusher = new Pusher('APP_KEY');
|
||||
channel = pusher.subscribe('APPL');
|
||||
callback = function(data: any) {};
|
||||
channel.bind('new-price', callback);
|
||||
|
||||
channel.unbind('new-price', callback);
|
||||
|
||||
// Pusher channel events
|
||||
|
||||
channel.bind('pusher:subscription_succeeded', function() {
|
||||
});
|
||||
|
||||
pusher = new Pusher('APP_KEY');
|
||||
channel = pusher.subscribe('private-channel');
|
||||
channel.bind('pusher:subscription_error', function(status: number) {
|
||||
if(status == 408 || status == 503){
|
||||
// retry?
|
||||
}
|
||||
});
|
||||
|
||||
// Triggering Client Events
|
||||
|
||||
var triggered = channel.trigger(eventName, data);
|
||||
pusher = new Pusher('YOUR_APP_KEY');
|
||||
channel = pusher.subscribe('private-channel');
|
||||
channel.bind('pusher:subscription_succeeded', function() {
|
||||
var triggered = channel.trigger('client-someeventname', { your: data });
|
||||
});
|
||||
|
||||
// Best practice when sending client events
|
||||
|
||||
var outputEl = document.getElementById('client_event_example_log');
|
||||
var state: any = {
|
||||
currentX: 0,
|
||||
currentY: 0,
|
||||
lastX: undefined,
|
||||
lastY: undefined
|
||||
};
|
||||
|
||||
pusher = new Pusher("YOUR_APP_KEY");
|
||||
channel = pusher.subscribe("private-mousemoves");
|
||||
|
||||
// this method should be bound as a 'mousemove' event listener
|
||||
document.body.addEventListener('mousemove', onMouseMove, false);
|
||||
function onMouseMove(ev: any){
|
||||
ev = ev || window.event;
|
||||
state.currentX = ev.pageX || ev.clientX;
|
||||
state.currentY = ev.pageY || ev.clientY;
|
||||
}
|
||||
|
||||
setInterval(function(){
|
||||
if(state.currentX !== state.lastX || state.currentY !== state.lastY){
|
||||
state.lastX = state.currentX;
|
||||
state.lastY = state.currentY;
|
||||
|
||||
var text = document.createTextNode(
|
||||
'Triggering event due to state change: x: ' + state.currentX + ', y: ' + state.currentY
|
||||
);
|
||||
outputEl.replaceChild( text, outputEl.firstChild );
|
||||
|
||||
channel.trigger("client-mouse-moved", {x:state.currentX, y: state.currentY});
|
||||
}
|
||||
}, 300); // send every 300 milliseconds if position has changed
|
||||
|
||||
Vendored
+231
@@ -0,0 +1,231 @@
|
||||
// Type definitions for pusher-js 3.0.0
|
||||
// Project: https://github.com/pusher/pusher-js
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "pusher-js" {
|
||||
|
||||
namespace pusher {
|
||||
interface PusherStatic {
|
||||
new(apiKey: string, config?: Config): Pusher;
|
||||
}
|
||||
|
||||
interface Pusher {
|
||||
subscribe(name: string): Channel;
|
||||
subscribeAll(): void;
|
||||
unsubscribe(name: string): void;
|
||||
channel(name: string): Channel;
|
||||
allChannels(): Channel[];
|
||||
bind(eventName: string, callback: Function): Pusher;
|
||||
bind_all(callback: Function): Pusher;
|
||||
disconnect(): void;
|
||||
key: string;
|
||||
config: Config; //TODO: add GlobalConfig typings
|
||||
channels: any; //TODO: Type this
|
||||
global_emitter: EventsDispatcher;
|
||||
sessionId: number;
|
||||
timeline: any; //TODO: Type this
|
||||
connection: ConnectionManager;
|
||||
}
|
||||
|
||||
interface Config {
|
||||
/**
|
||||
* Forces the connection to use encrypted transports.
|
||||
*/
|
||||
encrypted?: boolean;
|
||||
|
||||
/**
|
||||
* Endpoint on your server that will return the authentication signature needed for private channels.
|
||||
*/
|
||||
authEndpoint?: string;
|
||||
|
||||
/**
|
||||
* Defines how the authentication endpoint, defined using authEndpoint, will be called.
|
||||
* There are two options available: ajax and jsonp.
|
||||
*/
|
||||
authTransport?: string;
|
||||
|
||||
/**
|
||||
* Allows passing additional data to authorizers. Supports query string params and headers (AJAX only).
|
||||
* For example, following will pass foo=bar via the query string and baz: boo via headers:
|
||||
*/
|
||||
auth?: AuthConfig;
|
||||
|
||||
|
||||
/**
|
||||
* Allows connecting to a different datacenter by setting up correct hostnames and ports for the connection.
|
||||
*/
|
||||
cluster?: string;
|
||||
|
||||
|
||||
/**
|
||||
* Disables stats collection, so that connection metrics are not submitted to Pusher’s servers.
|
||||
*/
|
||||
disableStats?: boolean;
|
||||
|
||||
/**
|
||||
* Specifies which transports should be used by Pusher to establish a connection.
|
||||
* Useful for applications running in controlled, well-behaving environments.
|
||||
* Available transports: ws, wss, xhr_streaming, xhr_polling, sockjs.
|
||||
* Additional transports may be added in the future and without adding them to this list, they will be disabled.
|
||||
*/
|
||||
enabledTransports?: string[];
|
||||
|
||||
|
||||
/**
|
||||
* Specified which transports must not be used by Pusher to establish a connection.
|
||||
* This settings overwrites transports whitelisted via the enabledTransports options.
|
||||
* Available transports: ws, wss, xhr_streaming, xhr_polling, sockjs.
|
||||
* Additional transports may be added in the future and without adding them to this list, they will be enabled.
|
||||
*/
|
||||
disabledTransports?: string[];
|
||||
|
||||
/**
|
||||
* Ignores null origin checks for HTTP fallbacks. Use with care, it should be disabled only if necessary (i.e. PhoneGap).
|
||||
*/
|
||||
ignoreNullOrigin?: boolean;
|
||||
|
||||
/**
|
||||
* After this time (in miliseconds) without any messages received from the server,
|
||||
* a ping message will be sent to check if the connection is still working.
|
||||
* Default value is is supplied by the server, low values will result in unnecessary traffic.
|
||||
*/
|
||||
activityTimeout?: number;
|
||||
|
||||
/**
|
||||
* Time before the connection is terminated after sending a ping message.
|
||||
* Default is 30000 (30s). Low values will cause false disconnections, if latency is high.
|
||||
*/
|
||||
pongTimeout?: number;
|
||||
|
||||
wsHost?: string;
|
||||
wsPort?: number;
|
||||
wssPort?: number;
|
||||
httpHost?: string;
|
||||
httpPort?: number;
|
||||
httpsPort?: number;
|
||||
}
|
||||
|
||||
interface AuthConfig {
|
||||
params?: { [key: string]: any };
|
||||
headers?: { [key: string]: any };
|
||||
}
|
||||
|
||||
interface GenericEventsDispatcher<Self extends EventsDispatcher> extends EventsDispatcher {
|
||||
bind(eventName: string, callback: Function, context?: any): Self;
|
||||
bind_all(callback: Function): Self;
|
||||
unbind(eventName?: string, callback?: Function, context?: any): Self;
|
||||
unbind_all(eventName?: string, callback?: Function): Self;
|
||||
emit(eventName: string, data?: any): Self;
|
||||
}
|
||||
|
||||
interface Channel extends GenericEventsDispatcher<Channel> {
|
||||
/** Triggers an event */
|
||||
trigger(eventName: string, data?: any): boolean;
|
||||
pusher: Pusher;
|
||||
name: string;
|
||||
subscribed: boolean;
|
||||
/**
|
||||
* Authenticates the connection as a member of the channel.
|
||||
* @param {String} socketId
|
||||
* @param {Function} callback
|
||||
*/
|
||||
authorize(socketId: string, callback: (data: any) => void): void;
|
||||
}
|
||||
|
||||
interface EventsDispatcher {
|
||||
bind(eventName: string, callback: Function, context?: any): EventsDispatcher;
|
||||
bind_all(callback: Function): EventsDispatcher;
|
||||
unbind(eventName?: string, callback?: Function, context?: any): EventsDispatcher;
|
||||
unbind_all(eventName?: string, callback?: Function): EventsDispatcher;
|
||||
emit(eventName: string, data?: any): EventsDispatcher;
|
||||
}
|
||||
|
||||
interface ConnectionManager extends GenericEventsDispatcher<ConnectionManager> {
|
||||
key: string;
|
||||
options: any; //TODO: Timeline.js
|
||||
state: string;
|
||||
connection: any; //TODO: Type this
|
||||
encrypted: boolean;
|
||||
timeline: any; //TODO: Type this
|
||||
connectionCallbacks: {
|
||||
message: (message: string) => void;
|
||||
ping: () => void;
|
||||
activity: () => void;
|
||||
error: (error: any) => void;
|
||||
closed: () => void;
|
||||
};
|
||||
errorCallbacks: {
|
||||
ssl_only: () => void;
|
||||
refused: () => void;
|
||||
backoff: () => void;
|
||||
retry: () => void;
|
||||
};
|
||||
handshakeCallbacks: {
|
||||
ssl_only: () => void;
|
||||
refused: () => void;
|
||||
backoff: () => void;
|
||||
retry: () => void;
|
||||
connected: (handshake: any) => void; //TODO: Type this
|
||||
};
|
||||
/**
|
||||
* Establishes a connection to Pusher.
|
||||
*
|
||||
* Does nothing when connection is already established. See top-level doc
|
||||
* to find events emitted on connection attempts.
|
||||
*/
|
||||
connect(): void;
|
||||
/**
|
||||
* Sends raw data.
|
||||
* @param {String} data
|
||||
*/
|
||||
send(data: string): boolean;
|
||||
/** Sends an event.
|
||||
*
|
||||
* @param {String} name
|
||||
* @param {String} data
|
||||
* @param {String} [channel]
|
||||
* @returns {Boolean} whether message was sent or not
|
||||
*/
|
||||
send_event(name: string, data: string, channel: string): boolean;
|
||||
/** Closes the connection. */
|
||||
disconnect(): void;
|
||||
isEncrypted(): boolean;
|
||||
}
|
||||
|
||||
interface PresenceChannel<T> extends Channel {
|
||||
members: Members<T>;
|
||||
}
|
||||
|
||||
interface Members<T> {
|
||||
/**
|
||||
* Returns member's info for given id.
|
||||
*
|
||||
* Resulting object containts two fields - id and info.
|
||||
*
|
||||
* @param {Number} id
|
||||
* @return {Object} member's info or null
|
||||
*/
|
||||
get(id: number): T;
|
||||
/**
|
||||
* Calls back for each member in unspecified order.
|
||||
*
|
||||
* @param {Function} callback
|
||||
*/
|
||||
each(callback: (member: any) => void): void;
|
||||
members: { [id: number]: UserInfo<T> };
|
||||
count: number;
|
||||
myID: number;
|
||||
me: UserInfo<T>;
|
||||
}
|
||||
|
||||
interface UserInfo<T> {
|
||||
id: number;
|
||||
info: T;
|
||||
}
|
||||
}
|
||||
|
||||
var pusher: pusher.PusherStatic;
|
||||
|
||||
export = pusher;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="react-props-decorators.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
import * as React from 'react';
|
||||
import { propTypes, defaultProps } from 'react-props-decorators';
|
||||
|
||||
@propTypes({
|
||||
foo: React.PropTypes.string,
|
||||
bar: React.PropTypes.number
|
||||
})
|
||||
@defaultProps({
|
||||
foo: "defaultString",
|
||||
bar: 100
|
||||
})
|
||||
class Baz extends React.Component<any, any> {
|
||||
/* ... */
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
--experimentalDecorators --noImplicitAny --target ES5
|
||||
@@ -0,0 +1,23 @@
|
||||
// Type definitions for react-props-decorators 0.1.0
|
||||
// Project: https://github.com/popkirby/react-props-decorators
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
declare module "react-props-decorators" {
|
||||
import * as React from 'react';
|
||||
|
||||
export interface ClassDecorator {
|
||||
<TFunction extends Function>(target:TFunction): TFunction|void;
|
||||
}
|
||||
|
||||
var propTypes: (map: React.ValidationMap<any>) => ClassDecorator;
|
||||
var defaultProps: (defaultProps: any) => ClassDecorator;
|
||||
|
||||
export {
|
||||
propTypes,
|
||||
defaultProps
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="./redux-logger.d.ts" />
|
||||
|
||||
import createLogger from 'redux-logger';
|
||||
import { applyMiddleware, createStore } from 'redux'
|
||||
|
||||
let logger = createLogger();
|
||||
|
||||
let loggerWithOpts = createLogger({
|
||||
collapsed: true,
|
||||
level: 'warn',
|
||||
logger: console.log,
|
||||
timestamp: false,
|
||||
transformer: state => state,
|
||||
predicate: (getState, action) => true
|
||||
});
|
||||
|
||||
let createStoreWithMiddleware = applyMiddleware(
|
||||
logger, loggerWithOpts
|
||||
)(createStore);
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for redux-logger v1.0.6
|
||||
// Project: https://github.com/fcomb/redux-logger
|
||||
// Definitions by: Alexander Rusakov <https://github.com/arusakov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../redux/redux.d.ts" />
|
||||
|
||||
declare module 'redux-logger' {
|
||||
|
||||
interface ReduxLoggerOptions {
|
||||
collapsed?: boolean;
|
||||
level?: string;
|
||||
logger?: any;
|
||||
timestamp?: boolean;
|
||||
transformer?: (state:any)=>any;
|
||||
predicate?: (getState:Function, action:any)=>boolean;
|
||||
}
|
||||
|
||||
export default function createLogger(options?:ReduxLoggerOptions):Redux.Middleware;
|
||||
}
|
||||
Vendored
+2
-1
@@ -44,8 +44,9 @@ declare module Redux {
|
||||
function bindActionCreators<T>(actionCreators: T, dispatch: Dispatch): T;
|
||||
function combineReducers(reducers: any): Reducer;
|
||||
function applyMiddleware(...middleware: Middleware[]): Function;
|
||||
function compose<T extends Function>(...functions: Function[]): T;
|
||||
}
|
||||
|
||||
declare module "redux" {
|
||||
export = Redux;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -67,7 +67,7 @@ declare module 'request' {
|
||||
oauth?: OAuthOptions;
|
||||
aws?: AWSOptions;
|
||||
hawk ?: HawkOptions;
|
||||
qs?: Object;
|
||||
qs?: any;
|
||||
json?: any;
|
||||
multipart?: RequestPart[];
|
||||
agentOptions?: any;
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@
|
||||
declare module Rx {
|
||||
|
||||
interface IObservable<T> {
|
||||
safeApply($scope: ng.IScope, callback: (data: any) => void): Rx.Observable<any>;
|
||||
safeApply($scope: ng.IScope, callback: (data: T) => void): Rx.Observable<T>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -291,12 +291,12 @@ declare module "svg-sprite" {
|
||||
* which all reside in the directory tmpl/css. Example: {css: true, scss: {dest: '_sprite.scss'}}
|
||||
* @default {}
|
||||
*/
|
||||
render?: { [key: string]: RenderingConfiguration };
|
||||
render?: { [key: string]: RenderingConfiguration|boolean };
|
||||
/**
|
||||
* Enabling this will trigger the creation of an HTML document demoing the usage of the sprite. Please see below for details on [rendering configurations](#rendering-configurations).
|
||||
* @default false
|
||||
*/
|
||||
example?: RenderingConfiguration;
|
||||
example?: RenderingConfiguration|boolean;
|
||||
/**
|
||||
* Specify svg-sprite which output mode to use with this configuration
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# TypeScript definitions for Tabris.js
|
||||
|
||||
[Tabris.js](http://tabrisjs.com) is a framework for developing mobile apps with native UIs in JavaScript.
|
||||
The JavaScript library is available on [npm](https://www.npmjs.com/package/tabris).
|
||||
|
||||
Current supported version is 1.2.
|
||||
|
||||
See http://definitelytyped.org/guides/contributing.html
|
||||
@@ -0,0 +1,302 @@
|
||||
/// <reference path="./tabris.d.ts" />
|
||||
|
||||
var page = tabris.create("Page", {});
|
||||
|
||||
function test_events() {
|
||||
var listener = () => console.log("triggered");
|
||||
var widget = tabris.create("Composite", {});
|
||||
widget.on("foo", listener);
|
||||
widget.trigger("foo", "details");
|
||||
widget.off("foo", listener);
|
||||
widget.off("foo");
|
||||
widget.off(null, listener);
|
||||
widget.off();
|
||||
}
|
||||
|
||||
function test_Action() {
|
||||
var widget: tabris.Action = tabris.create("Action", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
image: {src: "http://example.org"},
|
||||
title: "foo",
|
||||
placementPriority: "high"
|
||||
});
|
||||
var self: tabris.Action = widget.on("event", function(widget: tabris.Action) {});
|
||||
}
|
||||
|
||||
function test_Button() {
|
||||
var widget: tabris.Button = tabris.create("Button", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
width: 200,
|
||||
height: 400,
|
||||
alignment: "center",
|
||||
image: {src: "http://example.org"},
|
||||
text: "foo"
|
||||
});
|
||||
}
|
||||
|
||||
function test_CheckBox() {
|
||||
var widget: tabris.CheckBox = tabris.create("CheckBox", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
selection: true,
|
||||
text: "foo"
|
||||
});
|
||||
}
|
||||
|
||||
function test_Canvas() {
|
||||
var widget: tabris.Canvas = tabris.create("Canvas", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
});
|
||||
var ctx: tabris.CanvasContext = widget.getContext("2d", 200, 300);
|
||||
}
|
||||
|
||||
function test_Cell() {
|
||||
var widget: tabris.Cell = tabris.create("Cell", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
});
|
||||
}
|
||||
|
||||
function test_CollectionView() {
|
||||
var widget: tabris.CollectionView = tabris.create("CollectionView", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
cellType: (item: any) => "foo",
|
||||
initializeCell: (cell: tabris.Cell, type: string) => {},
|
||||
itemHeight: (item: any, type: string) => 23,
|
||||
items: ["foo", "bar", "baz"],
|
||||
refreshEnabled: true,
|
||||
refreshIndicator: true,
|
||||
refreshMessage: "foo"
|
||||
});
|
||||
widget.insert(["item1", "item2"]);
|
||||
widget.insert(["item1", "item2"], 3);
|
||||
widget.refresh();
|
||||
widget.refresh(3);
|
||||
widget.remove(3);
|
||||
widget.remove(3, 2);
|
||||
widget.reveal(23);
|
||||
}
|
||||
|
||||
function test_Composite() {
|
||||
var widget: tabris.Composite = tabris.create("Composite", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
});
|
||||
}
|
||||
|
||||
function test_Drawer() {
|
||||
var widget: tabris.Drawer = tabris.create("Drawer", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
});
|
||||
var same: tabris.Drawer = widget.open();
|
||||
var same: tabris.Drawer = widget.close();
|
||||
}
|
||||
|
||||
function test_ImageView() {
|
||||
var widget: tabris.ImageView = tabris.create("ImageView", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
image: {src: "http://example.com"},
|
||||
scaleMode: "auto"
|
||||
});
|
||||
}
|
||||
|
||||
function test_Page() {
|
||||
var page: tabris.Page = tabris.create("Page", {});
|
||||
page.set("foo", 23);
|
||||
page.set({
|
||||
image: {src: "http://example.com"},
|
||||
title: "foo",
|
||||
topLevel: true
|
||||
});
|
||||
page.open().close();
|
||||
}
|
||||
|
||||
function test_PageSelector() {
|
||||
var widget: tabris.PageSelector = tabris.create("PageSelector", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
});
|
||||
}
|
||||
|
||||
function test_Picker() {
|
||||
var widget: tabris.Picker = tabris.create("Picker", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
selection: "foo",
|
||||
selectionIndex: 23,
|
||||
items: ["foo", "bar", "baz"]
|
||||
});
|
||||
}
|
||||
|
||||
function test_ProgressBar() {
|
||||
var widget: tabris.ProgressBar = tabris.create("ProgressBar", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
selection: 23,
|
||||
state: "normal"
|
||||
});
|
||||
}
|
||||
|
||||
function test_RadioButton() {
|
||||
var widget: tabris.RadioButton = tabris.create("RadioButton", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
selection: true,
|
||||
text: "foo"
|
||||
});
|
||||
}
|
||||
|
||||
function test_ScrollView() {
|
||||
var widget: tabris.ScrollView = tabris.create("ScrollView", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
direction: "horizontal"
|
||||
});
|
||||
}
|
||||
|
||||
function test_SearchAction() {
|
||||
var widget: tabris.SearchAction = tabris.create("SearchAction", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
message: "foo",
|
||||
proposals: ["foo", "bar", "baz"],
|
||||
text: "foo"
|
||||
});
|
||||
}
|
||||
|
||||
function test_Slider() {
|
||||
var widget: tabris.Slider = tabris.create("Slider", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
selection: 23
|
||||
});
|
||||
}
|
||||
|
||||
function test_Switch() {
|
||||
var widget: tabris.Switch = tabris.create("Switch", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
selection: true
|
||||
});
|
||||
}
|
||||
|
||||
function test_TextInput() {
|
||||
var widget: tabris.TextInput = tabris.create("TextInput", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
alignment: "center",
|
||||
autoCapitalize: true,
|
||||
autoCorrect: false,
|
||||
editable: true,
|
||||
text: "foo",
|
||||
message: "bar",
|
||||
type: "search",
|
||||
keyboard: "ascii"
|
||||
});
|
||||
}
|
||||
|
||||
function test_Tab() {
|
||||
var widget: tabris.Tab = tabris.create("Tab", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
badge: "foo",
|
||||
title: "bar",
|
||||
image: {src: "http://example.org"}
|
||||
});
|
||||
}
|
||||
|
||||
function test_TabFolder() {
|
||||
var widget: tabris.TabFolder = tabris.create("TabFolder", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
paging: true,
|
||||
tabBarLocation: "auto",
|
||||
selection: tab1
|
||||
});
|
||||
var tab1: tabris.Tab, tab2: tabris.Tab;
|
||||
var same: tabris.TabFolder = widget.append(tab1, tab2);
|
||||
}
|
||||
|
||||
function test_TextView() {
|
||||
var widget: tabris.TextView = tabris.create("TextView", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
alignment: "center",
|
||||
markupEnabled: true,
|
||||
maxLines: 23,
|
||||
text: "foo"
|
||||
});
|
||||
}
|
||||
|
||||
function test_ToggleButton() {
|
||||
var widget: tabris.ToggleButton = tabris.create("ToggleButton", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
alignment: "center",
|
||||
image: {src: "http://example.org/"},
|
||||
selection: true,
|
||||
text: "foo"
|
||||
});
|
||||
}
|
||||
|
||||
function test_Video() {
|
||||
var widget: tabris.Video = tabris.create("Video", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
url: "http://example.org"
|
||||
});
|
||||
}
|
||||
|
||||
function test_WebView() {
|
||||
var widget: tabris.WebView = tabris.create("WebView", {});
|
||||
widget.set("foo", 23);
|
||||
widget.set({
|
||||
html: "<html>",
|
||||
url: "http://example.org"
|
||||
});
|
||||
}
|
||||
|
||||
function test_WidgetCollection() {
|
||||
var collection: tabris.WidgetCollection = page.find();
|
||||
var length: number = collection.length;
|
||||
var grandParents: tabris.WidgetCollection = collection.parent().parent();
|
||||
var grandChildren: tabris.WidgetCollection = collection.children().children();
|
||||
var found: tabris.WidgetCollection = collection.find().find(".class");
|
||||
collection.appendTo(page);
|
||||
collection.dispose();
|
||||
}
|
||||
|
||||
function test_tabris_app() {
|
||||
tabris.app.installPatch("url", (error: Error, patch: Object) => {});
|
||||
tabris.app.reload();
|
||||
}
|
||||
|
||||
function test_tabris_device() {
|
||||
var lang: string = tabris.device.get("language");
|
||||
var model: string = tabris.device.get("model");
|
||||
var orient: string = tabris.device.get("orientation");
|
||||
var platform: string = tabris.device.get("platform");
|
||||
var factor: number = tabris.device.get("scaleFactor");
|
||||
var height: number = tabris.device.get("screenHeight");
|
||||
var width: number = tabris.device.get("screenWidth");
|
||||
var version: string = tabris.device.get("version");
|
||||
var same: tabris.Device = tabris.device.on("change:orientation", () => {}).off("change:orientation");
|
||||
}
|
||||
|
||||
function test_tabris_ui() {
|
||||
var page: tabris.Page = tabris.ui.get("activePage");
|
||||
var bg: string = tabris.ui.get("background");
|
||||
var tc: string = tabris.ui.get("textColor");
|
||||
var visible: boolean = tabris.ui.get("toolbarVisible");
|
||||
var same: tabris.UI = tabris.ui.on("change:activePage", () => {}).off("change:activePage");
|
||||
}
|
||||
Vendored
+1446
File diff suppressed because it is too large
Load Diff
Vendored
+13
-9
@@ -489,6 +489,10 @@ declare module uiGrid {
|
||||
* returns the total footer height gridFooter + columnFooter
|
||||
*/
|
||||
footerHeight?: number;
|
||||
/**
|
||||
* returns or sets grid height in pixels
|
||||
*/
|
||||
gridHeight?: number;
|
||||
/**
|
||||
* set to true when Grid is scrolling horizontally. Set to false via debounced method
|
||||
*/
|
||||
@@ -1182,14 +1186,14 @@ declare module uiGrid {
|
||||
}
|
||||
|
||||
export interface IRowColConstructor {
|
||||
new (row: IGridRow, col: IGridColumn): IRowCol;
|
||||
new (row: uiGrid.IGridRow, col: IGridColumn): IRowCol;
|
||||
}
|
||||
|
||||
/**
|
||||
* A row and column pair that represents the intersection of these two entities
|
||||
*/
|
||||
export interface IRowCol {
|
||||
row: IGridRow;
|
||||
row: uiGrid.IGridRow;
|
||||
col: IGridColumn;
|
||||
/**
|
||||
* Gets the intersection of where the row and column meet
|
||||
@@ -1282,7 +1286,7 @@ declare module uiGrid {
|
||||
reader.readAsText( files[0] );
|
||||
}
|
||||
*/
|
||||
editFileChooserCallback?: (gridRow: IGridRow, gridCol: IGridColumn, files: FileList) => void;
|
||||
editFileChooserCallback?: (gridRow: uiGrid.IGridRow, gridCol: IGridColumn, files: FileList) => void;
|
||||
/**
|
||||
* A bindable string value that is used when binding to edit controls instead of colDef.field
|
||||
* For example if you have a complex property on an object like:
|
||||
@@ -1558,7 +1562,7 @@ declare module uiGrid {
|
||||
* @param {any} value The cell value
|
||||
* @returns {any} Formatted value
|
||||
*/
|
||||
exporterFieldCallback?: (grid: IGridInstance, row: IGridRow, col: IGridColumn, value: any) => any;
|
||||
exporterFieldCallback?: (grid: IGridInstance, row: uiGrid.IGridRow, col: IGridColumn, value: any) => any;
|
||||
/**
|
||||
* A function to apply to the header displayNames before exporting. Useful for internationalisation,
|
||||
* for example if you were using angular-translate you'd set this to $translate.instant.
|
||||
@@ -2844,7 +2848,7 @@ declare module uiGrid {
|
||||
* @param {any} rowEntity gridOptions.data[] array value
|
||||
* @param {ng.IAngularEvent} event object if raised from event
|
||||
*/
|
||||
selectRow(rowEntity: IGridRow, event?: ng.IAngularEvent): void;
|
||||
selectRow(rowEntity: any, event?: ng.IAngularEvent): void;
|
||||
/**
|
||||
* Select the specified row by visible index
|
||||
* (i.e. if you specify row 0 you'll get the first visible row selected).
|
||||
@@ -2871,13 +2875,13 @@ declare module uiGrid {
|
||||
* @param {any} rowEntity gridOptions.data[] array value
|
||||
* @param {ng.IAngularEvent} event object if raised from event
|
||||
*/
|
||||
toggleRowSelection(rowEntity: IGridRow, event?: ng.IAngularEvent): void;
|
||||
toggleRowSelection(rowEntity: any, event?: ng.IAngularEvent): void;
|
||||
/**
|
||||
* UnSelect the data row
|
||||
* @param {any} rowEntity gridOptions.data[] array value
|
||||
* @param {ng.IAngularEvent} event object if raised from event
|
||||
*/
|
||||
unSelectRow(rowEntity: IGridRow, event?: ng.IAngularEvent): void;
|
||||
unSelectRow(rowEntity: any, event?: ng.IAngularEvent): void;
|
||||
|
||||
// Events
|
||||
on: {
|
||||
@@ -2903,7 +2907,7 @@ declare module uiGrid {
|
||||
* @param {IGridRow} row The selected rows
|
||||
* @param {ng.IAngularEvent} event object if raised from event
|
||||
*/
|
||||
(row: IGridRow, event?: ng.IAngularEvent): void;
|
||||
(row: uiGrid.IGridRow, event?: ng.IAngularEvent): void;
|
||||
}
|
||||
|
||||
export interface rowSelectionChangedBatchHandler {
|
||||
@@ -2912,7 +2916,7 @@ declare module uiGrid {
|
||||
* @param {IGridRow} row The selected rows
|
||||
* @param {ng.IAngularEvent} event object if raised from event
|
||||
*/
|
||||
(row: Array<IGridRow>, event?: ng.IAngularEvent): void;
|
||||
(row: Array<uiGrid.IGridRow>, event?: ng.IAngularEvent): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/// <reference path="./unique-random.d.ts" />
|
||||
|
||||
import uniqueRandom = require("unique-random");
|
||||
const rand = uniqueRandom(1, 10);
|
||||
const num: number = rand();
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for unique-random
|
||||
// Project: https://github.com/sindresorhus/unique-random
|
||||
// Definitions by: Yuki Kokubun <https://github.com/Kuniwak>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "unique-random" {
|
||||
function uniqueRandom(min: number, max: number): () => number;
|
||||
|
||||
export = uniqueRandom;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="xml-parser.d.ts"/>
|
||||
|
||||
import assert = require('assert');
|
||||
import parse = require('xml-parser');
|
||||
|
||||
var doc: parse.Document = parse(
|
||||
'<?xml version="1.0" encoding="utf-8"?>' +
|
||||
'<mydoc><child a="1">foo</child><child/></mydoc>');
|
||||
var declaration: parse.Declaration = doc.declaration;
|
||||
assert.equal(declaration.attributes['version'], '1.0');
|
||||
assert.equal(declaration.attributes['encoding'], 'utf-8');
|
||||
var root: parse.Node = doc.root;
|
||||
assert.equal(root.name, 'mydoc');
|
||||
var children: parse.Node[] = root.children;
|
||||
assert.equal(children.length, 2);
|
||||
var child1: parse.Node = children[0];
|
||||
assert.equal(child1.name, 'child');
|
||||
assert.equal(child1.attributes['a'], '1');
|
||||
assert.equal(child1.content, 'foo');
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for xml-parser 1.2.1
|
||||
// Project: https://github.com/segmentio/xml-parser
|
||||
// Definitions by: Matt Frantz <https://github.com/mhfrantz/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'xml-parser' {
|
||||
|
||||
function parse(xml: string): parse.Document;
|
||||
|
||||
module parse {
|
||||
export interface Document {
|
||||
declaration: Declaration;
|
||||
root: Node;
|
||||
}
|
||||
|
||||
export interface Declaration {
|
||||
attributes: Attributes;
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
name: string;
|
||||
attributes: Attributes;
|
||||
children: Node[];
|
||||
content?: string;
|
||||
}
|
||||
|
||||
export interface Attributes {
|
||||
[name: string]: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = parse;
|
||||
}
|
||||
Reference in New Issue
Block a user