mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' into fix-angular-promises
Conflicts: angularjs/angular-tests.ts
This commit is contained in:
@@ -16,7 +16,7 @@ Include a line like this:
|
||||
|
||||
## Contributions
|
||||
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
DefinitelyTyped only works because of contributions by users like you!
|
||||
|
||||
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) on how to contribute to DefinitelyTyped.
|
||||
|
||||
|
||||
@@ -70,6 +70,13 @@ myApp.config((
|
||||
$scope.items = ["A", "List", "Of", "Items"];
|
||||
}
|
||||
})
|
||||
.state('state1.list', {
|
||||
url: "/list",
|
||||
templateUrl: "partials/state1.list.html",
|
||||
controller: ['$scope', function ($scope: MyAppScope) {
|
||||
$scope.items = ["A", "List", "Of", "Items"];
|
||||
}]
|
||||
})
|
||||
.state('state2', {
|
||||
url: "/state2",
|
||||
templateUrl: "partials/state2.html"
|
||||
@@ -173,7 +180,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
this.$state.get("myState");
|
||||
this.$state.get();
|
||||
this.$state.reload();
|
||||
|
||||
|
||||
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties
|
||||
if (this.$state.transition) {
|
||||
var transitionPromise: ng.IPromise<{}> = this.$state.transition;
|
||||
@@ -187,7 +194,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
// transition ended (success or failure)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Accesses the currently resolved values for the current state
|
||||
// http://stackoverflow.com/questions/28026620/is-there-a-way-to-access-resolved-state-dependencies-besides-injecting-them-into/28027023#28027023
|
||||
var resolvedValues = this.$state.$current.locals.globals;
|
||||
|
||||
+15
-15
@@ -26,24 +26,24 @@ declare module angular.ui {
|
||||
/**
|
||||
* Function, returns HTML content string
|
||||
*/
|
||||
templateProvider?: Function | Array<any>;
|
||||
templateProvider?: Function | Array<string|Function>;
|
||||
/**
|
||||
* A controller paired to the state. Function OR name as String
|
||||
* A controller paired to the state. Function, annotated array or name as String
|
||||
*/
|
||||
controller?: Function | string;
|
||||
controller?: Function|string|Array<string|Function>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
* Function (injectable), returns the actual controller function or string.
|
||||
*/
|
||||
controllerProvider?: Function;
|
||||
|
||||
controllerProvider?: Function|Array<string|Function>;
|
||||
|
||||
/**
|
||||
* Specifies the parent state of this state
|
||||
*/
|
||||
parent?: string | IState
|
||||
|
||||
|
||||
resolve?: {};
|
||||
parent?: string | IState;
|
||||
|
||||
|
||||
resolve?: { [name:string]: any };
|
||||
/**
|
||||
* A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed.
|
||||
*/
|
||||
@@ -55,18 +55,18 @@ declare module angular.ui {
|
||||
/**
|
||||
* Use the views property to set up multiple views. If you don't need multiple views within a single state this property is not needed. Tip: remember that often nested views are more useful and powerful than multiple sibling views.
|
||||
*/
|
||||
views?: {};
|
||||
views?: { [name:string]: IState };
|
||||
abstract?: boolean;
|
||||
/**
|
||||
* Callback function for when a state is entered. Good way to trigger an action or dispatch an event, such as opening a dialog.
|
||||
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
|
||||
*/
|
||||
onEnter?: Function|(string|Function)[];
|
||||
onEnter?: Function|Array<string|Function>;
|
||||
/**
|
||||
* Callback functions for when a state is entered and exited. Good way to trigger an action or dispatch an event, such as opening a dialog.
|
||||
* If minifying your scripts, make sure to explicitly annotate this function, because it won't be automatically annotated by your build tools.
|
||||
*/
|
||||
onExit?: Function|(string|Function)[];
|
||||
onExit?: Function|Array<string|Function>;
|
||||
/**
|
||||
* Arbitrary data object, useful for custom configuration.
|
||||
*/
|
||||
@@ -245,13 +245,13 @@ declare module angular.ui {
|
||||
/** A param object, e.g. {sectionId: section.id)}, that you'd like to test against the current active state. */
|
||||
params: IStateParamsService;
|
||||
reload(): void;
|
||||
|
||||
|
||||
/** Currently pending transition. A promise that'll resolve or reject. */
|
||||
transition: ng.IPromise<{}>;
|
||||
|
||||
|
||||
$current: IResolvedState;
|
||||
}
|
||||
|
||||
|
||||
interface IResolvedState {
|
||||
locals: {
|
||||
/**
|
||||
|
||||
@@ -296,6 +296,17 @@ module TestQ {
|
||||
result = $q.reject('');
|
||||
}
|
||||
|
||||
// $q.resolve
|
||||
{
|
||||
let result: angular.IPromise<void>;
|
||||
result = $q.resolve();
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $q.resolve<TResult>(tResult);
|
||||
result = $q.resolve<TResult>(promiseTResult);
|
||||
}
|
||||
|
||||
// $q.when
|
||||
{
|
||||
let result: angular.IPromise<void>;
|
||||
@@ -388,18 +399,18 @@ module TestPromise {
|
||||
var tresult: TResult;
|
||||
var tresultPromise: ng.IPromise<TResult>;
|
||||
var tresultHttpPromise: ng.IHttpPromise<TResult>;
|
||||
|
||||
|
||||
var tother: TOther;
|
||||
var totherPromise: ng.IPromise<TOther>;
|
||||
var totherHttpPromise: ng.IHttpPromise<TOther>;
|
||||
|
||||
|
||||
var promise: angular.IPromise<TResult>;
|
||||
|
||||
// promise.then
|
||||
result = <angular.IPromise<any>>promise.then((result) => any);
|
||||
result = <angular.IPromise<any>>promise.then((result) => any, (any) => any);
|
||||
result = <angular.IPromise<any>>promise.then((result) => any, (any) => any, (any) => any);
|
||||
|
||||
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => result);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => result, (any) => any);
|
||||
result = <angular.IPromise<TResult>>promise.then((result) => result, (any) => any, (any) => any);
|
||||
@@ -409,7 +420,7 @@ module TestPromise {
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.then((result) => tresultHttpPromise);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.then((result) => tresultHttpPromise, (any) => any);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TResult>>>promise.then((result) => tresultHttpPromise, (any) => any, (any) => any);
|
||||
|
||||
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => tother);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => tother, (any) => any);
|
||||
result = <angular.IPromise<TOther>>promise.then((result) => tother, (any) => any, (any) => any);
|
||||
@@ -419,7 +430,7 @@ module TestPromise {
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.then((result) => totherHttpPromise);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.then((result) => totherHttpPromise, (any) => any);
|
||||
result = <angular.IPromise<ng.IHttpPromiseCallbackArg<TOther>>>promise.then((result) => totherHttpPromise, (any) => any, (any) => any);
|
||||
|
||||
|
||||
// promise.catch
|
||||
result = <angular.IPromise<any>>promise.catch((err) => any);
|
||||
result = <angular.IPromise<TResult>>promise.catch((err) => tresult);
|
||||
@@ -949,7 +960,7 @@ 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) => {
|
||||
@@ -960,4 +971,14 @@ function ngFilterTyping() {
|
||||
}, (actual, expected) => {
|
||||
return actual == expected;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function parseTyping() {
|
||||
var $parse: angular.IParseService;
|
||||
var compiledExp = $parse('a.b.c');
|
||||
if (compiledExp.constant) {
|
||||
return compiledExp({});
|
||||
} else if (compiledExp.literal) {
|
||||
return compiledExp({}, {a: {b: {c: 42}}});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+12
-1
@@ -910,6 +910,9 @@ declare module angular {
|
||||
interface ICompiledExpression {
|
||||
(context: any, locals?: any): any;
|
||||
|
||||
literal: boolean;
|
||||
constant: boolean;
|
||||
|
||||
// If value is not provided, undefined is gonna be used since the implementation
|
||||
// does not check the parameter. Let's force a value for consistency. If consumer
|
||||
// whants to undefine it, pass the undefined value explicitly.
|
||||
@@ -1052,12 +1055,20 @@ declare module angular {
|
||||
*
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
resolve<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*/
|
||||
resolve(): IPromise<void>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*
|
||||
* @param value Value or a promise
|
||||
*/
|
||||
when<T>(value: IPromise<T>|T): IPromise<T>;
|
||||
/**
|
||||
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
|
||||
*/
|
||||
when(): IPromise<void>;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+8
@@ -228,6 +228,14 @@ declare module CodeMirror {
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { left: number; top: number; right: number; bottom: number; }, margin: number): void;
|
||||
|
||||
/** Scrolls the given element into view. pos is a { line, ch } object, in editor-local coordinates.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { line: number, ch: number }, margin?: number): void;
|
||||
|
||||
/** Scrolls the given element into view. pos is a { from, to } object, in editor-local coordinates.
|
||||
The margin parameter is optional. When given, it indicates the amount of pixels around the given area that should be made visible as well. */
|
||||
scrollIntoView(pos: { from: CodeMirror.Position, to: CodeMirror.Position }, margin: number): void;
|
||||
|
||||
/** Returns an { left , top , bottom } object containing the coordinates of the cursor position.
|
||||
If mode is "local" , they will be relative to the top-left corner of the editable document.
|
||||
If it is "page" or not given, they are relative to the top-left corner of the page.
|
||||
|
||||
Vendored
+31
-9
@@ -5,15 +5,6 @@
|
||||
|
||||
declare module CometD {
|
||||
|
||||
var onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
|
||||
|
||||
function init(options: ConfigurationOptions): void;
|
||||
|
||||
function addListener(channel: string, listener: (message: any) => void): void;
|
||||
function removeListener(listener: (message: any) => void): void;
|
||||
|
||||
function publish(channel: string, message: any): void;
|
||||
|
||||
interface ConfigurationOptions {
|
||||
url: string;
|
||||
logLevel?: string;
|
||||
@@ -26,4 +17,35 @@ declare module CometD {
|
||||
appendMessageTypeToURL?: boolean;
|
||||
autoBatch?: boolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface CometD {
|
||||
|
||||
onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
|
||||
|
||||
init(options: CometD.ConfigurationOptions): void;
|
||||
|
||||
configure(config: CometD.ConfigurationOptions): void;
|
||||
|
||||
addListener(channel: string, listener: (message: any) => void): void;
|
||||
removeListener(listener: (message: any) => void): void;
|
||||
|
||||
clearListeners(): void;
|
||||
|
||||
clearSubscriptions(): void;
|
||||
|
||||
handshake(handshake_params: any): void;
|
||||
|
||||
publish(channel: string, message: any): void;
|
||||
|
||||
|
||||
disconnect(): void;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface JQueryStatic {
|
||||
cometd: CometD;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="flake-idgen.d.ts"/>
|
||||
|
||||
// require flake-idgen
|
||||
import FlakeId = require('flake-idgen');
|
||||
let flakeIdGen1 = new FlakeId({datacenter: 9, worker: 7});
|
||||
|
||||
// create flake IDs
|
||||
console.log(flakeIdGen1.next());
|
||||
console.log(flakeIdGen1.next());
|
||||
console.log(flakeIdGen1.next());
|
||||
|
||||
// create flake IDs using a callback
|
||||
flakeIdGen1.next((err, id) => {
|
||||
console.info(id);
|
||||
});
|
||||
|
||||
flakeIdGen1.next((err, id) => {
|
||||
console.info(id);
|
||||
});
|
||||
|
||||
let flakeIdGen2 = new FlakeId();
|
||||
let flakeIdGen3 = new FlakeId({datacenter: 9, worker: 7});
|
||||
let flakeIdGen4 = new FlakeId({epoch: 1300000000000})
|
||||
console.info(flakeIdGen2.next());
|
||||
console.info(flakeIdGen3.next());
|
||||
console.info(flakeIdGen4.next());
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for flakge-idgen 0.1.4
|
||||
// Project: https://github.com/T-PWK/flake-idgen
|
||||
// Definitions by: Yuce Tekol <http://yuce.me/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'flake-idgen' {
|
||||
interface ConstructorOptions {
|
||||
datacenter?: number;
|
||||
worker?: number;
|
||||
id?: number;
|
||||
epoch?: number;
|
||||
seqMask?: number;
|
||||
}
|
||||
|
||||
class FlakeId {
|
||||
constructor(options?: ConstructorOptions);
|
||||
next(callback?: (err: Error, id: Buffer) => void): Buffer;
|
||||
}
|
||||
export = FlakeId;
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// Tests based on examples at http://hammerjs.github.io/examples/
|
||||
|
||||
/// <reference path="hammerjs.d.ts" />
|
||||
|
||||
import Hammer = require("hammerjs");
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// create a simple instance
|
||||
// by default, it only adds horizontal recognizers
|
||||
var mc = new Hammer( myElement );
|
||||
|
||||
// listen to events...
|
||||
mc.on( "panleft panright tap press", function ( ev )
|
||||
{
|
||||
myElement.textContent = ev.type + " gesture detected.";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// create a simple instance
|
||||
// by default, it only adds horizontal recognizers
|
||||
var mc = new Hammer( myElement );
|
||||
|
||||
// let the pan gesture support all directions.
|
||||
// this will block the vertical scrolling on a touch-device while on the element
|
||||
mc.get( 'pan' ).set( {direction: Hammer.DIRECTION_ALL} );
|
||||
|
||||
// listen to events...
|
||||
mc.on( "panleft panright panup pandown tap press", function ( ev:HammerInput )
|
||||
{
|
||||
myElement.textContent = ev.type + " gesture detected.";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
var mc = new Hammer.Manager( myElement );
|
||||
|
||||
// create a pinch and rotate recognizer
|
||||
// these require 2 pointers
|
||||
var pinch = new Hammer.Pinch();
|
||||
var rotate = new Hammer.Rotate();
|
||||
|
||||
// we want to detect both the same time
|
||||
pinch.recognizeWith( rotate );
|
||||
|
||||
// add to the Manager
|
||||
mc.add( [pinch, rotate] );
|
||||
|
||||
|
||||
mc.on( "pinch rotate", function ( ev:HammerInput )
|
||||
{
|
||||
myElement.textContent += ev.type + " ";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// We create a manager object, which is the same as Hammer(), but without the presetted recognizers.
|
||||
var mc = new Hammer.Manager( myElement );
|
||||
|
||||
// Default, tap recognizer
|
||||
mc.add( new Hammer.Tap() );
|
||||
|
||||
// Tap recognizer with minimal 4 taps
|
||||
mc.add( new Hammer.Tap( {event: 'quadrupletap', taps: 4} ) );
|
||||
|
||||
// we want to recognize this simulatenous, so a quadrupletap will be detected even while a tap has been recognized.
|
||||
// the tap event will be emitted on every tap
|
||||
mc.get( 'quadrupletap' ).recognizeWith( 'tap' );
|
||||
|
||||
|
||||
mc.on( "tap quadrupletap", function ( ev )
|
||||
{
|
||||
myElement.textContent += ev.type + " ";
|
||||
} );
|
||||
})();
|
||||
|
||||
|
||||
(() =>
|
||||
{
|
||||
var myElement = document.getElementById( 'myElement' );
|
||||
|
||||
// We create a manager object, which is the same as Hammer(), but without the presetted recognizers.
|
||||
var mc = new Hammer.Manager( myElement );
|
||||
|
||||
|
||||
// Tap recognizer with minimal 2 taps
|
||||
mc.add( new Hammer.Tap( {event: 'doubletap', taps: 2} ) );
|
||||
// Single tap recognizer
|
||||
mc.add( new Hammer.Tap( {event: 'singletap'} ) );
|
||||
|
||||
|
||||
// we want to recognize this simulatenous, so a quadrupletap will be detected even while a tap has been recognized.
|
||||
mc.get( 'doubletap' ).recognizeWith( 'singletap' );
|
||||
// we only want to trigger a tap, when we don't have detected a doubletap
|
||||
mc.get( 'singletap' ).requireFailure( 'doubletap' );
|
||||
|
||||
|
||||
mc.on( "singletap doubletap", function ( ev )
|
||||
{
|
||||
myElement.textContent += ev.type + " ";
|
||||
} );
|
||||
})();
|
||||
Vendored
+1
-1
@@ -7,7 +7,7 @@
|
||||
|
||||
declare var Hammer:HammerStatic;
|
||||
|
||||
declare module "Hammer" {
|
||||
declare module "hammerjs" {
|
||||
export = Hammer;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
/// <reference path="hystrixjs.d.ts" />
|
||||
/// <reference path="../q/Q.d.ts"/>
|
||||
|
||||
import hystrixjs = require('hystrixjs');
|
||||
import q = require('q');
|
||||
|
||||
var commandFactory = hystrixjs.commandFactory;
|
||||
|
||||
var command = commandFactory
|
||||
.getOrCreate('testCommand', 'testGroup')
|
||||
.circuitBreakerSleepWindowInMilliseconds(5000)
|
||||
.errorHandler((error) => {
|
||||
return false;
|
||||
})
|
||||
.timeout(3000)
|
||||
.circuitBreakerRequestVolumeThreshold(10)
|
||||
.requestVolumeRejectionThreshold(10)
|
||||
.circuitBreakerForceOpened(true)
|
||||
.circuitBreakerForceClosed(false)
|
||||
.statisticalWindowNumberOfBuckets(10)
|
||||
.statisticalWindowLength(10)
|
||||
.percentileWindowNumberOfBuckets(10)
|
||||
.percentileWindowLength(60)
|
||||
.circuitBreakerErrorThresholdPercentage(30)
|
||||
.fallbackTo((error) => {
|
||||
return q.resolve('fallback');
|
||||
})
|
||||
.run((args) => {
|
||||
return q.resolve(args);
|
||||
})
|
||||
.build();
|
||||
|
||||
command.execute('something').then((result) => {
|
||||
console.log(result);
|
||||
})
|
||||
|
||||
commandFactory.resetCache();
|
||||
|
||||
var metricsFactory = hystrixjs.metricsFactory;
|
||||
|
||||
var metrics = metricsFactory.getOrCreate({
|
||||
commandKey: 'metricsKey',
|
||||
commandGroup: 'metricsGroup'
|
||||
})
|
||||
metrics.markSuccess();
|
||||
metrics.markFailure();
|
||||
metrics.markRejected();
|
||||
metrics.markTimeout();
|
||||
metrics.incrementExecutionCount();
|
||||
metrics.decrementExecutionCount();
|
||||
metrics.getCurrentExecutionCount();
|
||||
metrics.addExecutionTime(3000);
|
||||
metrics.getRollingCount("FAILURE");
|
||||
var healthcounts = metrics.getHealthCounts();
|
||||
console.log(healthcounts.totalCount);
|
||||
console.log(healthcounts.errorCount);
|
||||
console.log(healthcounts.errorPercentage);
|
||||
|
||||
metricsFactory.resetCache();
|
||||
|
||||
metricsFactory.getAllMetrics().map((metrics) => {
|
||||
console.log(metrics.getCurrentExecutionCount());
|
||||
});
|
||||
|
||||
var hystrixConfig = hystrixjs.hystrixConfig;
|
||||
console.log(hystrixConfig.metricsPercentileWindowBuckets());
|
||||
console.log(hystrixConfig.circuitBreakerForceClosed());
|
||||
console.log(hystrixConfig.circuitBreakerForceOpened());
|
||||
console.log(hystrixConfig.circuitBreakerSleepWindowInMilliseconds());
|
||||
console.log(hystrixConfig.circuitBreakerErrorThresholdPercentage());
|
||||
console.log(hystrixConfig.circuitBreakerRequestVolumeThreshold());
|
||||
console.log(hystrixConfig.circuitBreakerRequestVolumeThresholdForceOverride());
|
||||
console.log(hystrixConfig.circuitBreakerRequestVolumeThresholdOverride());
|
||||
console.log(hystrixConfig.executionTimeoutInMilliseconds());
|
||||
console.log(hystrixConfig.metricsStatisticalWindowBuckets());
|
||||
console.log(hystrixConfig.metricsStatisticalWindowInMilliseconds());
|
||||
console.log(hystrixConfig.metricsPercentileWindowInMilliseconds());
|
||||
console.log(hystrixConfig.requestVolumeRejectionThreshold());
|
||||
console.log(hystrixConfig.resetProperties());
|
||||
console.log(hystrixConfig.init({}));
|
||||
|
||||
var hystrixSSEStream = hystrixjs.hystrixSSEStream;
|
||||
|
||||
hystrixSSEStream.toObservable().subscribe((result) => {
|
||||
console.log(result);
|
||||
})
|
||||
Vendored
+148
@@ -0,0 +1,148 @@
|
||||
// Type definitions for dragula v2.1.2
|
||||
// Project: https://bitbucket.org/igor_sechyn/hystrixjs
|
||||
// Definitions by: Igor Sechyn <https://github.com/igorsechyn/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../q/Q.d.ts"/>
|
||||
///<reference path="../rx/rx.d.ts"/>
|
||||
|
||||
declare module HystrixJS {
|
||||
|
||||
interface HystrixProperties {
|
||||
"hystrix.force.circuit.open"?: boolean,
|
||||
"hystrix.force.circuit.closed"?: boolean,
|
||||
"hystrix.circuit.sleepWindowInMilliseconds"?:number,
|
||||
"hystrix.circuit.errorThresholdPercentage"?: number,
|
||||
"hystrix.circuit.volumeThreshold"?:number,
|
||||
"hystrix.circuit.volumeThreshold.forceOverride"?: boolean,
|
||||
"hystrix.circuit.volumeThreshold.override"?: number,
|
||||
"hystrix.execution.timeoutInMilliseconds"?: number,
|
||||
"hystrix.metrics.statistical.window.timeInMilliseconds"?: number,
|
||||
"hystrix.metrics.statistical.window.bucketsNumber"?: number,
|
||||
"hystrix.metrics.percentile.window.timeInMilliseconds"?: number,
|
||||
"hystrix.metrics.percentile.window.bucketsNumber"?: number,
|
||||
"hystrix.request.volume.rejectionThreshold"?: number
|
||||
}
|
||||
|
||||
interface HystrixConfig {
|
||||
metricsPercentileWindowBuckets(): number;
|
||||
circuitBreakerForceClosed(): boolean;
|
||||
circuitBreakerForceOpened(): boolean;
|
||||
circuitBreakerSleepWindowInMilliseconds(): number;
|
||||
circuitBreakerErrorThresholdPercentage(): number;
|
||||
circuitBreakerRequestVolumeThreshold(): number;
|
||||
circuitBreakerRequestVolumeThresholdForceOverride(): boolean;
|
||||
circuitBreakerRequestVolumeThresholdOverride(): number;
|
||||
executionTimeoutInMilliseconds(): number;
|
||||
metricsStatisticalWindowBuckets(): number;
|
||||
metricsStatisticalWindowInMilliseconds(): number;
|
||||
metricsPercentileWindowInMilliseconds(): number;
|
||||
metricsPercentileWindowBuckets(): number;
|
||||
requestVolumeRejectionThreshold(): number;
|
||||
resetProperties(): void;
|
||||
init(properties: HystrixProperties): void;
|
||||
}
|
||||
|
||||
interface Command {
|
||||
execute(...args: any[]): Q.Promise<any>;
|
||||
}
|
||||
|
||||
interface CommandBuilder {
|
||||
circuitBreakerSleepWindowInMilliseconds(value: number): CommandBuilder;
|
||||
errorHandler(value: (error: any) => boolean): CommandBuilder;
|
||||
timeout(value: number): CommandBuilder;
|
||||
circuitBreakerRequestVolumeThreshold(value: number): CommandBuilder;
|
||||
requestVolumeRejectionThreshold(value: number): CommandBuilder;
|
||||
circuitBreakerForceOpened(value: boolean): CommandBuilder;
|
||||
circuitBreakerForceClosed(value: boolean): CommandBuilder;
|
||||
statisticalWindowNumberOfBuckets(value: number): CommandBuilder;
|
||||
statisticalWindowLength(value: number): CommandBuilder;
|
||||
percentileWindowNumberOfBuckets(value: number): CommandBuilder;
|
||||
percentileWindowLength(value: number): CommandBuilder;
|
||||
circuitBreakerErrorThresholdPercentage(value: number): CommandBuilder;
|
||||
run(value: (args: any) => Q.Promise<any>): CommandBuilder;
|
||||
fallbackTo(value: (...args: any[]) => Q.Promise<any>): CommandBuilder;
|
||||
context(value: any): CommandBuilder;
|
||||
build(): Command;
|
||||
}
|
||||
|
||||
interface CommandFactory {
|
||||
getOrCreate(commandKey: string, commandGroup?: string): CommandBuilder;
|
||||
resetCache(): void;
|
||||
}
|
||||
|
||||
interface HealthCounts {
|
||||
totalCount: number;
|
||||
errorCount: number;
|
||||
errorPercentage: number;
|
||||
}
|
||||
|
||||
interface CommandMetrics {
|
||||
markSuccess(): void;
|
||||
markRejected(): void;
|
||||
markFailure(): void;
|
||||
markTimeout(): void;
|
||||
markShortCircuited(): void;
|
||||
incrementExecutionCount(): void;
|
||||
decrementExecutionCount(): void;
|
||||
getCurrentExecutionCount(): number;
|
||||
addExecutionTime(value: number): void;
|
||||
getRollingCount(type: any): number;
|
||||
getExecutionTime(percentile: any): number;
|
||||
getHealthCounts(): HealthCounts;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
interface MetricsProperties {
|
||||
commandKey: string,
|
||||
commandGroup: string,
|
||||
statisticalWindowTimeInMilliSeconds?: number,
|
||||
statisticalWindowNumberOfBuckets?: number,
|
||||
percentileWindowTimeInMilliSeconds?: number,
|
||||
percentileWindowNumberOfBuckets?: number
|
||||
}
|
||||
|
||||
interface MetricsFactory {
|
||||
getOrCreate(config: MetricsProperties): CommandMetrics;
|
||||
resetCache(): void;
|
||||
getAllMetrics(): Array<CommandMetrics>;
|
||||
}
|
||||
|
||||
interface CirctuiBreakerConfig {
|
||||
circuitBreakerSleepWindowInMilliseconds: number,
|
||||
commandKey: string,
|
||||
circuitBreakerErrorThresholdPercentage: number,
|
||||
circuitBreakerRequestVolumeThreshold: number,
|
||||
commandGroup: string,
|
||||
circuitBreakerForceClosed: boolean,
|
||||
circuitBreakerForceOpened: boolean
|
||||
}
|
||||
|
||||
interface CircuitBreaker {
|
||||
allowRequest(): boolean;
|
||||
allowSingleTest(): boolean;
|
||||
isOpen(): boolean;
|
||||
markSuccess(): void;
|
||||
}
|
||||
|
||||
interface CircuitFactory {
|
||||
getOrCreate(config: CirctuiBreakerConfig): CircuitBreaker;
|
||||
getCache(): Array<CircuitBreaker>;
|
||||
resetCache(): void;
|
||||
}
|
||||
|
||||
interface HystrixSSEStream {
|
||||
toObservable(): Rx.Observable<any>
|
||||
}
|
||||
}
|
||||
declare var hystrixjs: {
|
||||
commandFactory: HystrixJS.CommandFactory,
|
||||
metricsFactory: HystrixJS.MetricsFactory,
|
||||
circuitFactory: HystrixJS.CircuitFactory,
|
||||
hystrixSSEStream: HystrixJS.HystrixSSEStream,
|
||||
hystrixConfig: HystrixJS.HystrixConfig
|
||||
};
|
||||
|
||||
declare module "hystrixjs" {
|
||||
export = hystrixjs;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="jade.d.ts"/>
|
||||
|
||||
import jade from 'jade';
|
||||
|
||||
jade.compile("b")();
|
||||
jade.compileFile("foo.jade", {})();
|
||||
jade.compileClient("a")({ a: 1 });
|
||||
jade.compileClientWithDependenciesTracked("test").body();
|
||||
jade.render("h1",{});
|
||||
jade.renderFile("foo.jade");
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for jade
|
||||
// Project: https://github.com/jadejs/jade
|
||||
// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'jade' {
|
||||
module jade {
|
||||
function compile(template: string, options?: any): (locals?: any) => string;
|
||||
function compileFile(path: string, options?: any): (locals?: any) => string;
|
||||
function compileClient(template: string, options?: any): (locals?: any) => string;
|
||||
function compileClientWithDependenciesTracked(template: string, options?: any): {
|
||||
body: (locals?: any) => string;
|
||||
dependencies: string[];
|
||||
};
|
||||
function render(template: string, options?: any): string;
|
||||
function renderFile(path: string, options?: any): string;
|
||||
}
|
||||
export default jade;
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
/// <reference path="jquery.soap.d.ts"/>
|
||||
|
||||
$.soap({
|
||||
url: 'http://my.server.com/soapservices/',
|
||||
method: 'helloWorld',
|
||||
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
// if you want to have the response as JSON use soapResponse.toJSON();
|
||||
// or soapResponse.toString() to get XML string
|
||||
// or soapResponse.toXML() to get XML DOM
|
||||
},
|
||||
error: function(SOAPResponse) {
|
||||
// show error
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
url: 'http://my.server.com/soapservices/', //endpoint address for the service
|
||||
method: 'helloWorld', // service operation name
|
||||
// 1) will be appended to url if appendMethodToURL=true
|
||||
// 2) will be used for request element name when building xml from JSON 'params' (unless 'elementName' is provided)
|
||||
// 3) will be used to set SOAPAction request header if no SOAPAction is specified
|
||||
appendMethodToURL: true, // method name will be appended to URL defaults to true
|
||||
SOAPAction: 'action', // manually set the Request Header 'SOAPAction', defaults to the method specified above (optional)
|
||||
soap12: false, // use SOAP 1.2 namespace and HTTP headers - default to false
|
||||
context: document.body, // Used to set this in beforeSend, success, error and data callback functions
|
||||
|
||||
// addional headers and namespaces
|
||||
envAttributes: { // additional attributes (like namespaces) for the Envelope:
|
||||
'xmlns:another': 'http://anotherNamespace.com/'
|
||||
},
|
||||
HTTPHeaders: { // additional http headers send with the $.ajax call, will be given to $.ajax({ headers: })
|
||||
'Authorization': 'Basic ' + btoa('user:pass')
|
||||
},
|
||||
|
||||
//data can be XML DOM, XML String, JSON or a function
|
||||
data: { // JSON structure used to build request XML - SHOULD be coupled with ('namespaceQualifier' AND 'namespaceURL') AND ('method' OR 'elementName')
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
|
||||
//these options ONLY apply when the request XML is going to be built from JSON 'params'
|
||||
namespaceQualifier: 'myns', // used as namespace prefix for all elements in request (optional)
|
||||
namespaceURL: 'urn://service.my.server.com', // namespace url added to parent request element (optional)
|
||||
noPrefix: false, // set to true if you don't want the namespaceQualifier to be the prefix for the nodes in params. defaults to false (optional)
|
||||
elementName: 'requestElementName', // override 'method' as outer element (optional)
|
||||
|
||||
//callback functions
|
||||
beforeSend: function(SOAPEnvelope) { }, // callback function - SOAPEnvelope object is passed back prior to ajax call (optional)
|
||||
success: function(SOAPResponse) { }, // callback function to handle successful return (optional)
|
||||
error: function(SOAPResponse) { }, // callback function to handle fault return (optional)
|
||||
statusCode: { // callback functions based on statusCode
|
||||
404: function() {
|
||||
console.log('404 Not Found')
|
||||
},
|
||||
200: function() {
|
||||
console.log('200 OK')
|
||||
}
|
||||
},
|
||||
|
||||
// WS-Security
|
||||
wss: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
nonce: 'w08370jf7340qephufqp3r4',
|
||||
created: new Date().getTime()
|
||||
},
|
||||
|
||||
// debugging
|
||||
enableLogging: false // to enable the local log function set to true, defaults to false (optional)
|
||||
})
|
||||
|
||||
$.soap({
|
||||
|
||||
}).done(function(data, textStatus, jqXHR) {
|
||||
// do stuff on success here...
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
// do stuff on error here...
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://my.server.com/soapservices/',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com',
|
||||
error: function(soapResponse) {
|
||||
// show error
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
method: 'doSomethingElse',
|
||||
data: {},
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
url: 'http://another.server.com/anotherService',
|
||||
method: 'helloWorld',
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
},
|
||||
success: function(soapResponse) {
|
||||
// do stuff with soapResponse
|
||||
},
|
||||
error: function(soapResponse) {
|
||||
alert('that other server might be down...')
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
// other parameters..
|
||||
|
||||
// WS-Security
|
||||
wss: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
nonce: 'w08370jf7340qephufqp3r4',
|
||||
created: new Date().getTime()
|
||||
}
|
||||
});
|
||||
|
||||
var username = 'foo';
|
||||
var password = 'bar';
|
||||
|
||||
$.soap({
|
||||
// other parameters...
|
||||
|
||||
HTTPHeaders: {
|
||||
Authorization: 'Basic ' + btoa(username + ':' + password)
|
||||
}
|
||||
});
|
||||
|
||||
// jquery.soap/doc/options.md
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem',
|
||||
appendMethodToURL: false
|
||||
})
|
||||
|
||||
$.soap({
|
||||
beforeSend: function(SOAPEnvelope) {
|
||||
console.log(SOAPEnvelope.toString());
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
context: document.body,
|
||||
success: function(SOAPResponse) {
|
||||
console.log(this);
|
||||
}
|
||||
});
|
||||
|
||||
var xml =
|
||||
['<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">',
|
||||
'<soap:Body>',
|
||||
'<requestNode>',
|
||||
'</requestNode>',
|
||||
'</soap:Body>',
|
||||
'</soap:Envelope>'];
|
||||
|
||||
$.soap({
|
||||
data: xml.join('')
|
||||
});
|
||||
|
||||
$.soap({
|
||||
method: 'requestNode',
|
||||
data: {
|
||||
name: 'Remy Blom',
|
||||
msg: 'Hi!'
|
||||
}
|
||||
});
|
||||
|
||||
$.soap({
|
||||
envAttributes: {
|
||||
'xmlns:another': 'http://anotherNamespace.com/'
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
elementName: 'requestNode'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
enableLogging: true
|
||||
})
|
||||
|
||||
$.soap({
|
||||
error: function(SOAPResponse) {
|
||||
console.log(SOAPResponse.toString())
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
HTTPHeaders: {
|
||||
'Authorization': 'Basic ' + btoa('user:pass')
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
method: 'helloWorld',
|
||||
namespaceQualifier: 'myns',
|
||||
namespaceURL: 'urn://service.my.server.com',
|
||||
noPrefix: true
|
||||
})
|
||||
|
||||
$.soap({
|
||||
request: function(SOAPEnvelope) {
|
||||
console.log(SOAPEnvelope.toString());
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
soap12: true
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem',
|
||||
SOAPAction: 'getAnItem'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
SOAPHeader: {
|
||||
test: [1, 2, 3]
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
statusCode: {
|
||||
404: function() {
|
||||
console.log('404 Not Found')
|
||||
},
|
||||
200: function() {
|
||||
console.log('200 OK')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
success: function(SOAPResponse) {
|
||||
console.log(SOAPResponse.toString());
|
||||
}
|
||||
})
|
||||
|
||||
$.soap({
|
||||
url: 'http://server.com/webServices/',
|
||||
method: 'getItem'
|
||||
})
|
||||
|
||||
$.soap({
|
||||
wss: {
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
nonce: 'w08370jf7340qephufqp3r4',
|
||||
created: new Date().getTime()
|
||||
}
|
||||
})
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
// Type definitions for jQuery.SOAP 1.6.7
|
||||
// Project: https://github.com/doedje/jquery.soap
|
||||
// Definitions by: Roland Greim <https://github.com/tigerxy>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
declare module JQuerySOAP {
|
||||
interface SOAPEnvelope {
|
||||
attributes: Object
|
||||
bodies: Array<SOAPObject>
|
||||
headers: Array<SOAPObject>
|
||||
prefix: string
|
||||
soapConfig: any
|
||||
typeOf: string
|
||||
addAttribute(name: String, value: string): void
|
||||
addAttribute(name: String, value: number): void
|
||||
addBody(soapObject: SOAPObject): void
|
||||
addHeader(soapObject: SOAPObject): void
|
||||
addNamespace(name: String, uri: string): void
|
||||
toString(): string
|
||||
send(options: Options): void
|
||||
}
|
||||
interface SOAPResponse {
|
||||
toJSON(): any
|
||||
toString(): String
|
||||
toXML(): XMLDocument
|
||||
}
|
||||
|
||||
interface SOAPObject {
|
||||
attributes: Object
|
||||
children: Array<SOAPObject>
|
||||
name: string
|
||||
ns: Object
|
||||
_parent: SOAPObject
|
||||
value: any
|
||||
typeOf: string
|
||||
addNamespace(name: String, url: string): void
|
||||
addParameter(name: String, value: string): void
|
||||
addParameter(name: String, value: number): void
|
||||
appendChild(soapObject: SOAPObject): SOAPObject
|
||||
attr(name: string, value: string): Object
|
||||
attr(name: string, value: number): Object
|
||||
end(): SOAPObject
|
||||
find(name: string): SOAPObject
|
||||
hasChildren(): boolean
|
||||
newChild(name: string): SOAPObject
|
||||
parent(): SOAPObject
|
||||
toString(): string
|
||||
val(value: string): SOAPObject
|
||||
val(value: number): SOAPObject
|
||||
}
|
||||
interface Options {
|
||||
appendMethodToURL?: boolean;
|
||||
async?: boolean;
|
||||
beforeSend?: (SOAPEnvelope: SOAPEnvelope) => void;
|
||||
context?: any;
|
||||
data?: Object;
|
||||
envAttributes?: any;
|
||||
elementName?: string;
|
||||
enableLogging?: boolean;
|
||||
error?: (SOAPResponse: SOAPResponse) => void;
|
||||
HTTPHeaders?: Object;
|
||||
method?: string;
|
||||
namespaceQualifier?: string;
|
||||
namespaceURL?: string;
|
||||
noPrefix?: boolean;
|
||||
request?: (SOAPEnvelope: SOAPEnvelope) => void;
|
||||
soap12?: boolean;
|
||||
SOAPAction?: string;
|
||||
SOAPHeader?: Object;
|
||||
statusCode?: Object;
|
||||
success?: (SOAPResponse: SOAPResponse) => void;
|
||||
url?: string;
|
||||
wss?: Object;
|
||||
}
|
||||
interface SOAP {
|
||||
(options?: Options): JQueryXHR;
|
||||
}
|
||||
}
|
||||
interface JQueryStatic {
|
||||
soap: JQuerySOAP.SOAP;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/// <reference path="md5.d.ts" />
|
||||
|
||||
md5('Message to hash');
|
||||
md5('');
|
||||
md5('中文');
|
||||
md5([]);
|
||||
md5(new Uint8Array([]));
|
||||
|
||||
$.md5('message');
|
||||
$.md5('Message to hash');
|
||||
$.md5('');
|
||||
$.md5('中文');
|
||||
$.md5([]);
|
||||
$.md5(new Uint8Array([]));
|
||||
|
||||
'message'.md5('Message to hash');
|
||||
'message'.md5('');
|
||||
'message'.md5('中文');
|
||||
'message'.md5([]);
|
||||
'message'.md5(new Uint8Array([]));
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for js-md5 v0.3.0
|
||||
// Project: https://github.com/emn178/js-md5
|
||||
// Definitions by: Roland Greim <https://github.com/tigerxy>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
md5(value: string): string;
|
||||
md5(value: Array<any>): string;
|
||||
md5(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
md5(value: string): string;
|
||||
md5(value: Array<any>): string;
|
||||
md5(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
interface md5 {
|
||||
(value: string): string;
|
||||
(value: Array<any>): string;
|
||||
(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
interface String {
|
||||
md5(value: string): string;
|
||||
md5(value: Array<any>): string;
|
||||
md5(value: Uint8Array): string;
|
||||
}
|
||||
|
||||
declare var md5: md5;
|
||||
+320
-36
@@ -174,8 +174,18 @@ module TestChunk {
|
||||
result = _(list).chunk<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <any[]>_.compact([0, 1, false, 2, '', 3]);
|
||||
result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
// _.compact
|
||||
module TestCompact {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.compact<TResult>();
|
||||
result = _.compact<TResult>(array);
|
||||
result = _.compact<TResult>(list);
|
||||
result = _<TResult>(array).compact().value();
|
||||
result = _(list).compact<TResult>().value();
|
||||
}
|
||||
|
||||
// _.difference
|
||||
{
|
||||
@@ -251,18 +261,77 @@ result = <_.List<string>>_.fill<string>(testFillList, 'a', 0, 3);
|
||||
result = <number[]>_(testFillArray).fill<number>(0, 0, 3).value();
|
||||
result = <_.List<number>>_(testFillList).fill<number>(0, 0, 3).value();
|
||||
|
||||
// _.findIndex
|
||||
module TestFindIndex {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
|
||||
let result: number;
|
||||
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], function (f) {
|
||||
return /^b/.test(f);
|
||||
});
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple' });
|
||||
result = _.findIndex<TResult>(array);
|
||||
result = _.findIndex<TResult>(array, predicateFn);
|
||||
result = _.findIndex<TResult>(array, predicateFn, any);
|
||||
result = _.findIndex<TResult>(array, '');
|
||||
result = _.findIndex<TResult>(array, '', any);
|
||||
result = _.findIndex<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], function (f: string) {
|
||||
return /^b/.test(f);
|
||||
});
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findLastIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple' });
|
||||
result = _.findIndex<TResult>(list);
|
||||
result = _.findIndex<TResult>(list, predicateFn);
|
||||
result = _.findIndex<TResult>(list, predicateFn, any);
|
||||
result = _.findIndex<TResult>(list, '');
|
||||
result = _.findIndex<TResult>(list, '', any);
|
||||
result = _.findIndex<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _<TResult>(array).findIndex();
|
||||
result = _<TResult>(array).findIndex(predicateFn);
|
||||
result = _<TResult>(array).findIndex(predicateFn, any);
|
||||
result = _<TResult>(array).findIndex('');
|
||||
result = _<TResult>(array).findIndex('', any);
|
||||
result = _<TResult>(array).findIndex<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).findIndex();
|
||||
result = _(list).findIndex<TResult>(predicateFn);
|
||||
result = _(list).findIndex<TResult>(predicateFn, any);
|
||||
result = _(list).findIndex('');
|
||||
result = _(list).findIndex('', any);
|
||||
result = _(list).findIndex<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
// _.findLastIndex
|
||||
module TestFindLastIndex {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
|
||||
let result: number;
|
||||
|
||||
result = _.findLastIndex<TResult>(array);
|
||||
result = _.findLastIndex<TResult>(array, predicateFn);
|
||||
result = _.findLastIndex<TResult>(array, predicateFn, any);
|
||||
result = _.findLastIndex<TResult>(array, '');
|
||||
result = _.findLastIndex<TResult>(array, '', any);
|
||||
result = _.findLastIndex<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.findLastIndex<TResult>(list);
|
||||
result = _.findLastIndex<TResult>(list, predicateFn);
|
||||
result = _.findLastIndex<TResult>(list, predicateFn, any);
|
||||
result = _.findLastIndex<TResult>(list, '');
|
||||
result = _.findLastIndex<TResult>(list, '', any);
|
||||
result = _.findLastIndex<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _<TResult>(array).findLastIndex();
|
||||
result = _<TResult>(array).findLastIndex(predicateFn);
|
||||
result = _<TResult>(array).findLastIndex(predicateFn, any);
|
||||
result = _<TResult>(array).findLastIndex('');
|
||||
result = _<TResult>(array).findLastIndex('', any);
|
||||
result = _<TResult>(array).findLastIndex<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).findLastIndex();
|
||||
result = _(list).findLastIndex<TResult>(predicateFn);
|
||||
result = _(list).findLastIndex<TResult>(predicateFn, any);
|
||||
result = _(list).findLastIndex('');
|
||||
result = _(list).findLastIndex('', any);
|
||||
result = _(list).findLastIndex<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
// _.first
|
||||
module TestFirst {
|
||||
@@ -275,14 +344,10 @@ module TestFirst {
|
||||
result = _(list).first<TResult>();
|
||||
}
|
||||
|
||||
result = <number[]>_.take([1, 2, 3]);
|
||||
result = <number[]>_.take([1, 2, 3], 2);
|
||||
result = <number[]>_.takeWhile([1, 2, 3], (num) => num < 3);
|
||||
result = <boolean[]>_.takeWhile(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.takeWhile(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_([1, 2, 3]).take().value();
|
||||
result = <number[]>_([1, 2, 3]).take(2).value();
|
||||
result = <number[]>_([1, 2, 3]).takeWhile(function (num) {
|
||||
return num < 3;
|
||||
}).value();
|
||||
@@ -317,9 +382,25 @@ module TestHead {
|
||||
result = _(list).head<TResult>();
|
||||
}
|
||||
|
||||
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);
|
||||
// _.indexOf
|
||||
module TestIndexOf {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let value: TResult;
|
||||
let result: number;
|
||||
result = _.indexOf<TResult>(array, value);
|
||||
result = _.indexOf<TResult>(array, value, true);
|
||||
result = _.indexOf<TResult>(array, value, 42);
|
||||
result = _.indexOf<TResult>(list, value);
|
||||
result = _.indexOf<TResult>(list, value, true);
|
||||
result = _.indexOf<TResult>(list, value, 42);
|
||||
result = _(array).indexOf(value);
|
||||
result = _(array).indexOf(value, true);
|
||||
result = _(array).indexOf(value, 42);
|
||||
result = _(list).indexOf<TResult>(value);
|
||||
result = _(list).indexOf<TResult>(value, true);
|
||||
result = _(list).indexOf<TResult>(value, 42);
|
||||
}
|
||||
|
||||
//_.initial
|
||||
{
|
||||
@@ -345,11 +426,41 @@ result = <number>_.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
}
|
||||
|
||||
result = <number>_.last([1, 2, 3]);
|
||||
result = <number>_([1, 2, 3]).last();
|
||||
// _.last
|
||||
module TestLast {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult;
|
||||
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = _.last<TResult>(array);
|
||||
result = _.last<TResult>(list);
|
||||
result = _<TResult>(array).last();
|
||||
result = _(list).last<TResult>();
|
||||
}
|
||||
|
||||
// _.lastIndexOf
|
||||
module TestLastIndexOf {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let value: TResult;
|
||||
let result: number;
|
||||
|
||||
result = _.lastIndexOf<TResult>(array, value);
|
||||
result = _.lastIndexOf<TResult>(array, value, true);
|
||||
result = _.lastIndexOf<TResult>(array, value, 42);
|
||||
|
||||
result = _.lastIndexOf<TResult>(list, value);
|
||||
result = _.lastIndexOf<TResult>(list, value, true);
|
||||
result = _.lastIndexOf<TResult>(list, value, 42);
|
||||
|
||||
result = _(array).lastIndexOf(value);
|
||||
result = _(array).lastIndexOf(value, true);
|
||||
result = _(array).lastIndexOf(value, 42);
|
||||
|
||||
result = _(list).lastIndexOf<TResult>(value);
|
||||
result = _(list).lastIndexOf<TResult>(value, true);
|
||||
result = _(list).lastIndexOf<TResult>(value, 42);
|
||||
}
|
||||
|
||||
// _.pull
|
||||
{
|
||||
@@ -411,10 +522,41 @@ 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[]>_.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' });
|
||||
// _.remove
|
||||
module TestRemove {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let predicateFn: (value: TResult, index?: number, collection?: _.List<TResult>) => boolean;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.remove<TResult>(array);
|
||||
result = _.remove<TResult>(array, predicateFn);
|
||||
result = _.remove<TResult>(array, predicateFn, any);
|
||||
result = _.remove<TResult>(array, '');
|
||||
result = _.remove<TResult>(array, '', any);
|
||||
result = _.remove<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.remove<TResult>(list);
|
||||
result = _.remove<TResult>(list, predicateFn);
|
||||
result = _.remove<TResult>(list, predicateFn, any);
|
||||
result = _.remove<TResult>(list, '');
|
||||
result = _.remove<TResult>(list, '', any);
|
||||
result = _.remove<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _<TResult>(array).remove().value();
|
||||
result = _<TResult>(array).remove(predicateFn).value();
|
||||
result = _<TResult>(array).remove(predicateFn, any).value();
|
||||
result = _<TResult>(array).remove('').value();
|
||||
result = _<TResult>(array).remove('', any).value();
|
||||
result = _<TResult>(array).remove<{a: number}>({a: 42}).value();
|
||||
|
||||
result = _(list).remove<TResult>().value();
|
||||
result = _(list).remove<TResult>(predicateFn).value();
|
||||
result = _(list).remove<TResult>(predicateFn, any).value();
|
||||
result = _(list).remove<TResult>('').value();
|
||||
result = _(list).remove<TResult>('', any).value();
|
||||
result = _(list).remove<{a: number}, TResult>({a: 42}).value();
|
||||
}
|
||||
|
||||
// _.slice
|
||||
{
|
||||
@@ -440,6 +582,21 @@ result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
|
||||
// _.take
|
||||
module TestTake {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.take<TResult>(array);
|
||||
result = _.take<TResult>(array, 42);
|
||||
result = _.take<TResult>(list);
|
||||
result = _.take<TResult>(list, 42);
|
||||
result = _(array).take().value();
|
||||
result = _(array).take(42).value();
|
||||
result = _(list).take<TResult>().value();
|
||||
result = _(list).take<TResult>(42).value();
|
||||
}
|
||||
|
||||
// _.takeRight
|
||||
{
|
||||
let testTakeRightArray: TResult[];
|
||||
@@ -650,6 +807,54 @@ result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1,
|
||||
* Collection *
|
||||
**************/
|
||||
|
||||
// _.all
|
||||
module TestAll {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let dictionary: _.Dictionary<TResult>;
|
||||
|
||||
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => boolean;
|
||||
|
||||
let result: boolean;
|
||||
|
||||
result = _.all<TResult>(array);
|
||||
result = _.all<TResult>(array, listIterator);
|
||||
result = _.all<TResult>(array, listIterator, any);
|
||||
result = _.all<TResult>(array, '');
|
||||
result = _.all<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.all<TResult>(list);
|
||||
result = _.all<TResult>(list, listIterator);
|
||||
result = _.all<TResult>(list, listIterator, any);
|
||||
result = _.all<TResult>(list, '');
|
||||
result = _.all<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _.all<TResult>(dictionary);
|
||||
result = _.all<TResult>(dictionary, dictionaryIterator);
|
||||
result = _.all<TResult>(dictionary, dictionaryIterator, any);
|
||||
result = _.all<TResult>(dictionary, '');
|
||||
result = _.all<{a: number}, TResult>(dictionary, {a: 42});
|
||||
|
||||
result = _(array).all();
|
||||
result = _(array).all(listIterator);
|
||||
result = _(array).all(listIterator, any);
|
||||
result = _(array).all('');
|
||||
result = _(array).all<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).all<TResult>();
|
||||
result = _(list).all<TResult>(listIterator);
|
||||
result = _(list).all<TResult>(listIterator, any);
|
||||
result = _(list).all('');
|
||||
result = _(list).all<{a: number}>({a: 42});
|
||||
|
||||
result = _(dictionary).all<TResult>();
|
||||
result = _(dictionary).all<TResult>(dictionaryIterator);
|
||||
result = _(dictionary).all<TResult>(dictionaryIterator, any);
|
||||
result = _(dictionary).all('');
|
||||
result = _(dictionary).all<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
// _.at
|
||||
{
|
||||
let testAtArray: TResult[];
|
||||
@@ -747,13 +952,53 @@ result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
|
||||
|
||||
result = <boolean>_.every([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.every(stoogesAges, 'age');
|
||||
result = <boolean>_.every(stoogesAges, { 'age': 50 });
|
||||
// _.every
|
||||
module TestEvery {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let dictionary: _.Dictionary<TResult>;
|
||||
|
||||
result = <boolean>_.all([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.all(stoogesAges, 'age');
|
||||
result = <boolean>_.all(stoogesAges, { 'age': 50 });
|
||||
let listIterator: (value: TResult, index: number, collection: _.List<TResult>) => boolean;
|
||||
let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary<TResult>) => boolean;
|
||||
|
||||
let result: boolean;
|
||||
|
||||
result = _.every<TResult>(array);
|
||||
result = _.every<TResult>(array, listIterator);
|
||||
result = _.every<TResult>(array, listIterator, any);
|
||||
result = _.every<TResult>(array, '');
|
||||
result = _.every<{a: number}, TResult>(array, {a: 42});
|
||||
|
||||
result = _.every<TResult>(list);
|
||||
result = _.every<TResult>(list, listIterator);
|
||||
result = _.every<TResult>(list, listIterator, any);
|
||||
result = _.every<TResult>(list, '');
|
||||
result = _.every<{a: number}, TResult>(list, {a: 42});
|
||||
|
||||
result = _.every<TResult>(dictionary);
|
||||
result = _.every<TResult>(dictionary, dictionaryIterator);
|
||||
result = _.every<TResult>(dictionary, dictionaryIterator, any);
|
||||
result = _.every<TResult>(dictionary, '');
|
||||
result = _.every<{a: number}, TResult>(dictionary, {a: 42});
|
||||
|
||||
result = _(array).every();
|
||||
result = _(array).every(listIterator);
|
||||
result = _(array).every(listIterator, any);
|
||||
result = _(array).every('');
|
||||
result = _(array).every<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).every<TResult>();
|
||||
result = _(list).every<TResult>(listIterator);
|
||||
result = _(list).every<TResult>(listIterator, any);
|
||||
result = _(list).every('');
|
||||
result = _(list).every<{a: number}>({a: 42});
|
||||
|
||||
result = _(dictionary).every<TResult>();
|
||||
result = _(dictionary).every<TResult>(dictionaryIterator);
|
||||
result = _(dictionary).every<TResult>(dictionaryIterator, any);
|
||||
result = _(dictionary).every('');
|
||||
result = _(dictionary).every<{a: number}>({a: 42});
|
||||
}
|
||||
|
||||
result = <number[]>_.filter([1, 2, 3, 4, 5, 6]);
|
||||
result = <number[]>_.filter([1, 2, 3, 4, 5, 6], function (num) { return num % 2 == 0; });
|
||||
@@ -1766,9 +2011,31 @@ var TestDefaultsDeepSource = {'user': {'name': 'fred', 'age': 36}};
|
||||
result = <DefaultsDeepResult>_.defaultsDeep(TestDefaultsDeepObject, TestDefaultsDeepSource);
|
||||
result = <DefaultsDeepResult>_(TestDefaultsDeepObject).defaultsDeep<DefaultsDeepResult>(TestDefaultsDeepSource).value();
|
||||
|
||||
result = <string>_.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function (num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
// _.findKey
|
||||
module TestFindKey {
|
||||
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
|
||||
let result: string;
|
||||
|
||||
result = _.findKey<{a: string;}>({a: ''});
|
||||
|
||||
result = _.findKey<{a: string;}>({a: ''}, predicateFn);
|
||||
result = _.findKey<{a: string;}>({a: ''}, predicateFn, any);
|
||||
|
||||
result = _.findKey<{a: string;}>({a: ''}, '');
|
||||
result = _.findKey<{a: string;}>({a: ''}, '', any);
|
||||
|
||||
result = _.findKey<{a: number;}, {a: string;}>({a: ''}, {a: 42});
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey();
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey(predicateFn);
|
||||
result = _<{a: string;}>({a: ''}).findKey(predicateFn, any);
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey('');
|
||||
result = _<{a: string;}>({a: ''}).findKey('', any);
|
||||
|
||||
result = _<{a: string;}>({a: ''}).findKey<{a: number;}>({a: 42});
|
||||
}
|
||||
|
||||
result = <string>_.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function (num) {
|
||||
return num % 2 == 1;
|
||||
@@ -2412,6 +2679,23 @@ result = <() => {}>_({}).constant<{}>();
|
||||
result = _({}).iteratee(any).value();
|
||||
}
|
||||
|
||||
// _.matches
|
||||
module TestMatches {
|
||||
let source: TResult;
|
||||
|
||||
{
|
||||
let result: (value: any) => boolean;
|
||||
result = _.matches<TResult>(source);
|
||||
result = _(source).matches().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: (value: TResult) => boolean;
|
||||
result = _.matches<TResult, TResult>(source);
|
||||
result = _(source).matches<TResult>().value();
|
||||
}
|
||||
}
|
||||
|
||||
// _.method
|
||||
class TestMethod {
|
||||
a = {
|
||||
|
||||
Vendored
+618
-413
File diff suppressed because it is too large
Load Diff
@@ -116,6 +116,15 @@ function test() {
|
||||
new makerjs.paths.Chord(paths.arc);
|
||||
new makerjs.paths.Parallel(paths.line, 4, [1,1]);
|
||||
|
||||
//paths.line.layer = "0";
|
||||
|
||||
var x: MakerJs.IPathLine = {
|
||||
type: "line",
|
||||
origin: [9,9],
|
||||
end: [8,8],
|
||||
layer: "4"
|
||||
};
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+12
-4
@@ -96,11 +96,15 @@ declare module MakerJs {
|
||||
/**
|
||||
* The type of the path, e.g. "line", "circle", or "arc". These strings are enumerated in pathType.
|
||||
*/
|
||||
type: string;
|
||||
"type": string;
|
||||
/**
|
||||
* The main point of reference for this path.
|
||||
*/
|
||||
origin: IPoint;
|
||||
/**
|
||||
* Optional layer of this path.
|
||||
*/
|
||||
layer?: string;
|
||||
}
|
||||
/**
|
||||
* Test to see if an object implements the required properties of a path.
|
||||
@@ -193,7 +197,7 @@ declare module MakerJs {
|
||||
/**
|
||||
* Key is the type of a path, value is a function which accepts a path object a point object as its parameters.
|
||||
*/
|
||||
[type: string]: (id: string, pathValue: IPath, origin: IPoint) => void;
|
||||
[type: string]: (id: string, pathValue: IPath, origin: IPoint, layer: string) => void;
|
||||
}
|
||||
/**
|
||||
* String-based enumeration of all paths types.
|
||||
@@ -276,7 +280,7 @@ declare module MakerJs {
|
||||
/**
|
||||
* A model may want to specify its type, but this value is not employed yet.
|
||||
*/
|
||||
type?: string;
|
||||
"type"?: string;
|
||||
/**
|
||||
* Optional array of path objects in this model.
|
||||
*/
|
||||
@@ -293,6 +297,10 @@ declare module MakerJs {
|
||||
* An author may wish to add notes to this model instance.
|
||||
*/
|
||||
notes?: string;
|
||||
/**
|
||||
* Optional layer of this model.
|
||||
*/
|
||||
layer?: string;
|
||||
}
|
||||
/**
|
||||
* Test to see if an object implements the required properties of a model.
|
||||
@@ -844,7 +852,7 @@ declare module MakerJs.exporter {
|
||||
* @param pathToExport The path to export.
|
||||
* @param offset The offset position of the path.
|
||||
*/
|
||||
exportPath(id: string, pathToExport: IPath, offset: IPoint): void;
|
||||
exportPath(id: string, pathToExport: IPath, offset: IPoint, layer: string): void;
|
||||
/**
|
||||
* Export a model.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="markitup.d.ts" />
|
||||
|
||||
// https://github.com/markitup/1.x/blob/master/markitup/sets/default/set.js
|
||||
var mySettings = {
|
||||
onShiftEnter: {
|
||||
keepDefault: false,
|
||||
replaceWith: '<br />\n'
|
||||
},
|
||||
onCtrlEnter: {
|
||||
keepDefault: false,
|
||||
openWith: '\n<p>',
|
||||
closeWith: '</p>'
|
||||
},
|
||||
onTab: {
|
||||
keepDefault: false,
|
||||
replaceWith: ' '
|
||||
},
|
||||
markupSet: [
|
||||
{
|
||||
name: 'Bold',
|
||||
key: 'B',
|
||||
openWith: '(!(<strong>|!|<b>)!)',
|
||||
closeWith: '(!(</strong>|!|</b>)!)'
|
||||
},
|
||||
{
|
||||
name: 'Italic',
|
||||
key: 'I',
|
||||
openWith: '(!(<em>|!|<i>)!)',
|
||||
closeWith: '(!(</em>|!|</i>)!)'
|
||||
},
|
||||
{
|
||||
name: 'Stroke through',
|
||||
key: 'S',
|
||||
openWith: '<del>',
|
||||
closeWith: '</del>'
|
||||
},
|
||||
{separator: '---------------'},
|
||||
{
|
||||
name: 'Bulleted List',
|
||||
openWith: ' <li>',
|
||||
closeWith: '</li>',
|
||||
multiline: true,
|
||||
openBlockWith: '<ul>\n',
|
||||
closeBlockWith: '\n</ul>'
|
||||
},
|
||||
{
|
||||
name: 'Numeric List',
|
||||
openWith: ' <li>',
|
||||
closeWith: '</li>',
|
||||
multiline: true,
|
||||
openBlockWith: '<ol>\n',
|
||||
closeBlockWith: '\n</ol>'
|
||||
},
|
||||
{
|
||||
separator: '---------------'
|
||||
},
|
||||
{
|
||||
name: 'Picture',
|
||||
key: 'P',
|
||||
replaceWith: '<img src="[![Source:!:http://]!]" alt="[![Alternative text]!]" />'
|
||||
},
|
||||
{
|
||||
name: 'Link',
|
||||
key: 'L',
|
||||
openWith: '<a href="[![Link:!:http://]!]"(!( title="[![Title]!]")!)>',
|
||||
closeWith: '</a>',
|
||||
placeHolder: 'Your text to link...'
|
||||
},
|
||||
{
|
||||
separator: '---------------'
|
||||
},
|
||||
{
|
||||
name: 'Clean',
|
||||
className: 'clean',
|
||||
replaceWith: (markitup: MarkItUp.MarkupSet): string => {
|
||||
return markitup.selection.replace(/<(.*?)>/g, "")
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Preview',
|
||||
className: 'preview',
|
||||
call: 'preview'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
// http://markitup.jaysalvat.com/documentation/
|
||||
$('#markItUp').markItUp(mySettings);
|
||||
Vendored
+237
@@ -0,0 +1,237 @@
|
||||
// Type definitions for markitup 1.x
|
||||
// Project: https://github.com/markitup/1.x
|
||||
// Definitions by: drillbits <https://github.com/drillbits>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module MarkItUp {
|
||||
interface Options {
|
||||
/**
|
||||
* Apply a specific className to the wrapping Div. Useful to prevent CSS conflicts between instances.
|
||||
*/
|
||||
nameSpace?: string;
|
||||
|
||||
/**
|
||||
* Enable/Disable the handle to resize the editor.
|
||||
*/
|
||||
resizeHandle?: boolean;
|
||||
|
||||
/**
|
||||
* Display the preview in a popup window with comma-separated list of specs. If empty or false, the preview will be displayed in the built-in iFrame preview.
|
||||
*/
|
||||
previewInWindow?: string;
|
||||
|
||||
/**
|
||||
* AutoRefresh the preview iFrame or window when the editor is used.
|
||||
*/
|
||||
previewAutoRefresh?: boolean;
|
||||
|
||||
/**
|
||||
* You can set the path of your own parser to preview markup languages other than html. If this property is set, the built-in preview will be overridden by your own preview script.
|
||||
* Use ~/ for markItUp! root.
|
||||
*/
|
||||
previewParserPath?: string;
|
||||
|
||||
/**
|
||||
* Name of the var posted with the editor content to the parser defined above.
|
||||
*
|
||||
* default: 'data'
|
||||
*/
|
||||
previewParserVar?: string;
|
||||
|
||||
/**
|
||||
* Path to the Html preview template.
|
||||
* Use ~/ for markItUp! root.
|
||||
*
|
||||
* default: '~/templates/preview.html'
|
||||
*/
|
||||
previewTemplatePath?: string;
|
||||
|
||||
/**
|
||||
* Parse the content with the javascript parser of your choice before passing it to the preview.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
previewParser?: boolean;
|
||||
|
||||
/**
|
||||
* Position of the Built-in preview before or after the main textarea.
|
||||
* 'before'|'after'
|
||||
*
|
||||
* default: 'after'
|
||||
*/
|
||||
previewPosition?: string;
|
||||
|
||||
/**
|
||||
* Define what to do when Enter key is pressed.
|
||||
*/
|
||||
onEnter?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Define what to do when Ctrl+Enter keys are pressed.
|
||||
*/
|
||||
onCtrlEnter?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Define what to do when Shift+Enter keys are pressed.
|
||||
*/
|
||||
onShiftEnter?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Define what to do when Tab key is pressed. Warning, this key is also used to jump at the end of a new inserted markup.
|
||||
*/
|
||||
onTab?: MarkupSet;
|
||||
|
||||
/**
|
||||
* Function to be called before any markup insertion.
|
||||
*/
|
||||
beforeInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called after any markup insertion.
|
||||
*/
|
||||
afterInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Note that most of the settings below are used by the engine for all insertion calls ($.markItUp( {} ), onEnter, onShiftEnter, onCtrlEnter, onTab) except exclusive button properties marked by
|
||||
*/
|
||||
markupSet?: MarkupSet[];
|
||||
}
|
||||
|
||||
interface MarkupSet {
|
||||
/**
|
||||
* Button name
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Classname to be applied to this very button.
|
||||
*/
|
||||
className?: string;
|
||||
|
||||
/**
|
||||
* Shortcut key to be applied to the button. Ctrl+key trigger the action of a button.
|
||||
*/
|
||||
key?: string;
|
||||
|
||||
/**
|
||||
* Markup to be added before selection. Accepts functions.
|
||||
*/
|
||||
openWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Markup to be added after selection. Accepts functions.
|
||||
*/
|
||||
closeWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Text to be added in place of the cursor or selection. Accepts functions.
|
||||
*/
|
||||
replaceWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Text to be added before a whole block. Accepts functions.
|
||||
*/
|
||||
openBlockWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Text to be added after a whole block. Accepts functions.
|
||||
*/
|
||||
closeBlockWith?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Set whether the tags has to be inserted at each line or on the whole selected block.
|
||||
*/
|
||||
multiline?: boolean;
|
||||
|
||||
/**
|
||||
* Placeholder text to be inserted if no text is selected by the user.
|
||||
*/
|
||||
placeHolder?: string|((h: MarkupSet) => string);
|
||||
|
||||
/**
|
||||
* Function to be called just before a markup insertion. If a global beforeInsert callback is already defined this function is fired just after.
|
||||
*/
|
||||
beforeInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called just after a markup insertion. If a global afterInsert callback is already defined this function is fired before.
|
||||
*/
|
||||
afterInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called before a multiline markup insertion.
|
||||
*/
|
||||
beforeMultiInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Function to be called after a multiline markup insertion.
|
||||
*/
|
||||
afterMultiInsert?: (h: MarkupSet) => string;
|
||||
|
||||
/**
|
||||
* Open a dropdown menu with another button set.
|
||||
*/
|
||||
dropMenu?: MarkupSet[];
|
||||
|
||||
/**
|
||||
* Keep (true) or not (false) the default behaviour of the key.
|
||||
*/
|
||||
keepDefault?: boolean;
|
||||
|
||||
/**
|
||||
* Returns the selection.
|
||||
*/
|
||||
selection?: string;
|
||||
|
||||
/**
|
||||
* Returns the textarea object.
|
||||
*/
|
||||
textarea?: HTMLElement;
|
||||
|
||||
/**
|
||||
* Returns the position of the selection.
|
||||
*/
|
||||
caretPosition?: number;
|
||||
|
||||
/**
|
||||
* Returns the position of the scrollbar.
|
||||
*/
|
||||
scrollPosition?: number;
|
||||
|
||||
/**
|
||||
* If a multi-line edition is trigged (Ctrl + Shift + click). This property return the number of the line being processed.
|
||||
*/
|
||||
line?: number;
|
||||
|
||||
/**
|
||||
* Returns true if the Control key is pressed when the callback is fired.
|
||||
*/
|
||||
ctrlKey?: boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the Shift key is pressed when the callback is fired.
|
||||
*/
|
||||
shiftKey?: boolean;
|
||||
|
||||
/**
|
||||
* Returns true if the Alt key is pressed when the callback is fired.
|
||||
*/
|
||||
altKey?: boolean;
|
||||
}
|
||||
|
||||
interface Static {
|
||||
(): JQuery;
|
||||
(settings: Options): JQuery;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
markItUp: MarkItUp.Static;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
markItUp(settings?: MarkItUp.Options): JQuery;
|
||||
markItUpRemove(): JQuery;
|
||||
}
|
||||
Vendored
+2
-2
@@ -654,7 +654,7 @@ declare namespace __MaterialUI {
|
||||
export class Overlay extends React.Component<OverlayProps, {}> {
|
||||
}
|
||||
|
||||
interface PaperProps extends React.Props<Paper> {
|
||||
interface PaperProps extends React.HTMLAttributesBase<Paper> {
|
||||
circle?: boolean;
|
||||
rounded?: boolean;
|
||||
transitionEnabled?: boolean;
|
||||
@@ -1256,7 +1256,7 @@ declare namespace __MaterialUI {
|
||||
export class ToolbarSeparator extends React.Component<ToolbarSeparatorProps, {}> {
|
||||
}
|
||||
|
||||
interface ToolbarTitleProps extends React.Props<ToolbarTitle> {
|
||||
interface ToolbarTitleProps extends React.HTMLAttributesBase<ToolbarTitle> {
|
||||
text?: string;
|
||||
}
|
||||
export class ToolbarTitle extends React.Component<ToolbarTitleProps, {}> {
|
||||
|
||||
@@ -17,11 +17,11 @@ var extensionUrl = 'https://localhost:44300/';
|
||||
var voidPromise: Q.Promise<void>;
|
||||
var boolPromise: Q.Promise<boolean>;
|
||||
var anyPromise: Q.Promise<any>;
|
||||
var stringPromise: Q.Promise<string>;
|
||||
|
||||
var summaryBlade = new testFx.Blades.Blade(resourceName);
|
||||
|
||||
function TestPortal() {
|
||||
|
||||
function TestPortal() {
|
||||
testFx.portal.portalContext.signInEmail = userName;
|
||||
testFx.portal.portalContext.signInPassword = password;
|
||||
testFx.portal.portalContext.features = [{ name: "greatfeature", value: "true" }];
|
||||
@@ -35,11 +35,17 @@ function TestPortal() {
|
||||
var stringPromise = testFx.portal.takeScreenshot("TestPortal");
|
||||
var stringArrayPromise = testFx.portal.getBrowserLogs(testFx.LogLevel.All);
|
||||
anyPromise = testFx.portal.waitUntilElementDoesNotContainAttribute(testFx.Locators.By.className('part'), 'class', 'invalid');
|
||||
voidPromise = testFx.portal.goHome();
|
||||
boolPromise = testFx.portal.waitForElementVisible(summaryBlade.getLocator());
|
||||
var anyArrayPromise = testFx.portal.waitForElementsLocated(summaryBlade.getLocator());
|
||||
var voidPromise = testFx.portal.executeScript<void>("console.log('hello from script');");
|
||||
stringPromise = testFx.portal.getCurrentUrl();
|
||||
}
|
||||
|
||||
function TestBlades() {
|
||||
var blade = new testFx.Blades.Blade(resourceName);
|
||||
blade.clickCommand('Delete');
|
||||
var bladePromise = blade.clickCommand('Delete');
|
||||
var tilesPromise = blade.getTiles();
|
||||
|
||||
var createBlade = new testFx.Blades.CreateBlade(bladeTitle);
|
||||
voidPromise = createBlade.actionBar.createButton.click();
|
||||
@@ -52,6 +58,11 @@ function TestBlades() {
|
||||
|
||||
var specPickerBlade = new testFx.Blades.SpecPickerBlade(bladeTitle);
|
||||
specPickerBlade.pickSpec('S2');
|
||||
|
||||
var quickStartBlade = new testFx.Blades.QuickStartBlade();
|
||||
voidPromise = quickStartBlade.clickLink('Learn more');
|
||||
|
||||
var usersBlade = new testFx.Blades.UsersBlade();
|
||||
}
|
||||
|
||||
function TestParts() {
|
||||
@@ -60,12 +71,21 @@ function TestParts() {
|
||||
boolPromise = part.isSelected();
|
||||
boolPromise = part.waitUntilLoaded();
|
||||
boolPromise = part.isLoaded();
|
||||
boolPromise = part.isClickable();
|
||||
boolPromise = part.hasError();
|
||||
|
||||
var resourceSummary = new testFx.Parts.ResourceSummaryPart(summaryBlade.getLocator());
|
||||
var count = resourceSummary.properties.length;
|
||||
voidPromise = resourceSummary.quickStartHotSpot.click();
|
||||
voidPromise = resourceSummary.accessHotSpot.click();
|
||||
|
||||
var pricingTier = new testFx.Parts.PricingTierPart(summaryBlade.getLocator());
|
||||
voidPromise = pricingTier.click();
|
||||
|
||||
var tile = new testFx.Parts.Tile(summaryBlade.getLocator());
|
||||
voidPromise = tile.tryPin();
|
||||
var part: testFx.Parts.Part = tile.getPart();
|
||||
voidPromise = tile.waitUntilLoaded();
|
||||
}
|
||||
|
||||
function TestControls() {
|
||||
@@ -78,6 +98,9 @@ function TestControls() {
|
||||
|
||||
var textField = new testFx.Controls.TextField(summaryBlade.getLocator(), "Resource name");
|
||||
var textFieldPromise = textField.sendKeys(resourceName);
|
||||
|
||||
var hotSpot = new testFx.Controls.HotSpot(summaryBlade.getLocator());
|
||||
boolPromise = hotSpot.isSelected();
|
||||
}
|
||||
|
||||
function TestActionBars() {
|
||||
@@ -90,4 +113,30 @@ function TestActionBars() {
|
||||
|
||||
var pickerBar = new testFx.ActionBars.PickerActionBar(summaryBlade.getLocator());
|
||||
voidPromise = pickerBar.selectButton.click();
|
||||
}
|
||||
|
||||
function TestCommands() {
|
||||
var menu = new testFx.Commands.ContextMenu();
|
||||
var itemName = "Pin";
|
||||
boolPromise = menu.hasItem(itemName);
|
||||
voidPromise = menu.clickItem(itemName);
|
||||
|
||||
var item = new testFx.Commands.ContextMenuItem(menu.getLocator(), itemName);
|
||||
voidPromise = item.click();
|
||||
}
|
||||
|
||||
function TestStartBoard() {
|
||||
var board = new testFx.StartBoard();
|
||||
var tilesPromise = board.getTiles();
|
||||
}
|
||||
|
||||
function TestNotifications() {
|
||||
var menu = new testFx.Notifications.NotificationsMenu();
|
||||
menu.waitForNewNotification("success").then((notification) => {
|
||||
stringPromise = notification.getDescription();
|
||||
});
|
||||
}
|
||||
|
||||
function TestTests() {
|
||||
boolPromise = testFx.Tests.Parts.canPinAllBladeParts(resourceId, bladeTitle);
|
||||
}
|
||||
Vendored
+73
-9
@@ -76,6 +76,7 @@ declare module MsPortalTestFx {
|
||||
|
||||
constructor(title: string);
|
||||
clickCommand(commandText: string): Q.Promise<Blade>;
|
||||
getTiles(): Q.Promise<Parts.Tile[]>;
|
||||
}
|
||||
|
||||
export class CreateBlade extends Blade {
|
||||
@@ -95,6 +96,15 @@ declare module MsPortalTestFx {
|
||||
export class SpecPickerBlade extends Blade {
|
||||
pickSpec(specCode: string): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export class QuickStartBlade extends Blade {
|
||||
constructor();
|
||||
clickLink(linkText: string): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export class UsersBlade extends Blade {
|
||||
constructor();
|
||||
}
|
||||
}
|
||||
|
||||
export module Controls {
|
||||
@@ -127,12 +137,17 @@ declare module MsPortalTestFx {
|
||||
|
||||
export class TextField extends FormElement {
|
||||
constructor(parentLocator?: Locators.Locator, label?: string, baseLocator?: Locators.Locator);
|
||||
sendKeys(...var_args: string[]): Q.Promise<TextField>;
|
||||
sendKeys(...var_args: string[]): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export class ResourceFilterTextField extends TextField {
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
}
|
||||
|
||||
export class HotSpot extends PortalElement {
|
||||
constructor(parentLocator?: Locators.Locator, baseLocator?: Locators.Locator);
|
||||
isSelected(): Q.Promise<boolean>;
|
||||
}
|
||||
}
|
||||
|
||||
export module Parts {
|
||||
@@ -143,6 +158,8 @@ declare module MsPortalTestFx {
|
||||
isSelected(): Q.Promise<boolean>;
|
||||
isLoaded(): Q.Promise<boolean>;
|
||||
waitUntilLoaded(timeout?: number): Q.Promise<boolean>;
|
||||
isClickable(): Q.Promise<boolean>;
|
||||
hasError(): Q.Promise<boolean>;
|
||||
}
|
||||
|
||||
export class PartProperty extends MsPortalTestFx.PortalElement {
|
||||
@@ -155,6 +172,8 @@ declare module MsPortalTestFx {
|
||||
export class ResourceSummaryPart extends Part {
|
||||
public properties: Array<PartProperty>;
|
||||
public resourceGroupProperty: PartProperty;
|
||||
public quickStartHotSpot: Controls.HotSpot;
|
||||
public accessHotSpot: Controls.HotSpot;
|
||||
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
}
|
||||
@@ -166,17 +185,57 @@ declare module MsPortalTestFx {
|
||||
public progressLocator: Locators.Locator;
|
||||
|
||||
constructor(parentLocator?: Locators.Locator);
|
||||
tryPin(): Q.Promise<void>;
|
||||
getPart(): Part;
|
||||
waitUntilLoaded(timeout?: number): Q.Promise<void>;
|
||||
}
|
||||
}
|
||||
|
||||
export module Commands {
|
||||
export class ContextMenu extends PortalElement {
|
||||
constructor();
|
||||
public hasItem(text: string): Q.Promise<boolean>;
|
||||
public clickItem(text: string): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export class ContextMenuItem extends PortalElement {
|
||||
constructor(parentLocator: Locators.Locator, text?: string);
|
||||
}
|
||||
}
|
||||
|
||||
export module Notifications {
|
||||
export class Notification extends PortalElement {
|
||||
constructor();
|
||||
getTitle(): Q.Promise<string>;
|
||||
getDescription(): Q.Promise<string>;
|
||||
}
|
||||
|
||||
export class NotificationsMenu extends PortalElement {
|
||||
constructor();
|
||||
waitForNewNotification(title?: string, description?: string, timeout?: number): Q.Promise<Notification>;
|
||||
}
|
||||
}
|
||||
|
||||
export module Tests {
|
||||
export module Parts {
|
||||
export function canPinAllBladeParts(targetBladeDeepLink: string, targetBladeTitle: string, timeout?: number): Q.Promise<boolean>;
|
||||
}
|
||||
}
|
||||
|
||||
export class PortalElement {
|
||||
protected baseLocator: Locators.Locator;
|
||||
public baseLocator: Locators.Locator;
|
||||
protected parentLocator: Locators.Locator;
|
||||
|
||||
constructor(baseLocator: Locators.Locator, parentLocator?: Locators.Locator);
|
||||
getLocator(): Locators.Locator;
|
||||
click(): Q.Promise<void>;
|
||||
rightClick(): Q.Promise<void>;
|
||||
getAttribute(attributeName: string): Q.Promise<string>;
|
||||
sendKeys(...var_args: string[]): Q.Promise<void>;
|
||||
getText(): Q.Promise<string>;
|
||||
isPresent(): Q.Promise<boolean>;
|
||||
isElementPresent(subLocator: Locators.Locator): Q.Promise<boolean>;
|
||||
isDisplayed(): Q.Promise<boolean>;
|
||||
getLocator(): Locators.Locator;
|
||||
}
|
||||
|
||||
export interface TestExtension {
|
||||
@@ -216,23 +275,23 @@ declare module MsPortalTestFx {
|
||||
|
||||
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>;
|
||||
|
||||
goHome(timeout?: number): Q.Promise<void>;
|
||||
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>;
|
||||
waitForElementVisible(locator: Locators.Locator, timeout?: number): Q.Promise<boolean>;
|
||||
waitForElementNotVisible(locator: Locators.Locator, timeout?: number): Q.Promise<boolean>;
|
||||
waitUntilElementContainsAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
|
||||
waitUntilElementDoesNotContainAttribute(locator: Locators.Locator, attributeName: string, attributeValue: string, timeout?: number): Q.Promise<any>;
|
||||
waitForElementLocated(locator: Locators.Locator, timeout?: number): Q.Promise<any>;
|
||||
waitForElementsLocated(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>;
|
||||
applyFeature(name: string, value: string): void;
|
||||
getCurrentUrl(): Q.Promise<string>;
|
||||
quit(): Q.Promise<any>;
|
||||
}
|
||||
|
||||
@@ -240,6 +299,11 @@ declare module MsPortalTestFx {
|
||||
clickUntrustedExtensionsOkButton(): Q.Promise<void>;
|
||||
}
|
||||
|
||||
export class StartBoard extends PortalElement {
|
||||
constructor();
|
||||
getTiles(): Q.Promise<Parts.Tile[]>;
|
||||
}
|
||||
|
||||
export var portal: Portal;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ module Knight {
|
||||
}
|
||||
|
||||
export class Knight extends React.Component<KnightP, {}> {
|
||||
static defaultProps: KnightP;
|
||||
|
||||
static create = React.createFactory(Knight);
|
||||
|
||||
componentDidMount() {
|
||||
@@ -154,6 +156,8 @@ module BoardSquare {
|
||||
}
|
||||
|
||||
export class BoardSquare extends React.Component<BoardSquareP, {}> {
|
||||
static defaultProps: BoardSquareP;
|
||||
|
||||
private _renderOverlay = (color: string) => {
|
||||
return r.div({
|
||||
style: {
|
||||
|
||||
@@ -84,6 +84,8 @@ class ModernComponent extends React.Component<Props, State>
|
||||
static childContextTypes: React.ValidationMap<ChildContext> = {
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
context: Context;
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ class ModernComponent extends React.Component<Props, State>
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
context: Context;
|
||||
|
||||
getChildContext() {
|
||||
|
||||
@@ -82,6 +82,8 @@ class ModernComponent extends React.Component<Props, State>
|
||||
someOtherValue: React.PropTypes.string
|
||||
}
|
||||
|
||||
static defaultProps: Props;
|
||||
|
||||
context: Context;
|
||||
|
||||
getChildContext() {
|
||||
|
||||
Vendored
+10
@@ -132,6 +132,11 @@ declare namespace __React {
|
||||
|
||||
// Base component for plain JS classes
|
||||
class Component<P, S> implements ComponentLifecycle<P, S> {
|
||||
static propTypes: ValidationMap<any>;
|
||||
static contextTypes: ValidationMap<any>;
|
||||
static childContextTypes: ValidationMap<any>;
|
||||
static defaultProps: Props<any>;
|
||||
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
@@ -935,6 +940,11 @@ declare module "react/addons" {
|
||||
|
||||
// Base component for plain JS classes
|
||||
class Component<P, S> implements ComponentLifecycle<P, S> {
|
||||
static propTypes: ValidationMap<any>;
|
||||
static contextTypes: ValidationMap<any>;
|
||||
static childContextTypes: ValidationMap<any>;
|
||||
static defaultProps: Props<any>;
|
||||
|
||||
constructor(props?: P, context?: any);
|
||||
setState(f: (prevState: S, props: P) => S, callback?: () => any): void;
|
||||
setState(state: S, callback?: () => any): void;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/// <reference path="satnav.d.ts" />
|
||||
Satnav({})
|
||||
.navigate({
|
||||
path: 'product/{required}/?{optional}',
|
||||
directions: (params) => {
|
||||
// Logic for product route
|
||||
console.log(params.required);
|
||||
console.log(params.hasOwnProperty('optional'));
|
||||
}
|
||||
})
|
||||
.otherwise('/product/1')
|
||||
.change(function (hash, params, old) {
|
||||
// Logic for any change
|
||||
console.log(hash);
|
||||
console.log(params);
|
||||
console.log(old);
|
||||
})
|
||||
.go(); //Resolve current route
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for satnav
|
||||
// Project: https://github.com/f5io/satnav-js
|
||||
// Definitions by: Christian Holm Diget <https://github.com/DotNetNerd>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare type Callback = () => void;
|
||||
|
||||
interface ISatnavOptions {
|
||||
html5?: boolean,
|
||||
force?: boolean,
|
||||
poll?: number,
|
||||
matchAll?: boolean
|
||||
}
|
||||
|
||||
interface INavigationOptions {
|
||||
path?: string,
|
||||
directions?: (params : any) => any,
|
||||
title?: string | Callback
|
||||
}
|
||||
|
||||
interface ISatnav {
|
||||
navigate(navigationOptions: INavigationOptions): ISatnav;
|
||||
otherwise(route: string): ISatnav;
|
||||
change(onChange: (hash: string, params: any, old: any) => any): ISatnav;
|
||||
go(): ISatnav;
|
||||
}
|
||||
|
||||
declare function Satnav(options?: ISatnavOptions): ISatnav;
|
||||
Vendored
+104
@@ -20,6 +20,110 @@ declare module "sequelize" {
|
||||
// https://github.com/sequelize/sequelize/tree/v3.4.1/lib/associations
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* The options for the get mixin of the BelongsTo association.
|
||||
* @see BelongsToAssociationGetMixin
|
||||
*/
|
||||
interface BelongsToAssociationGetMixinOptions {
|
||||
/**
|
||||
* Apply a scope on the related model, or remove its default scope by passing false.
|
||||
*/
|
||||
scope: string | boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The get association mixin applied to models with BelongsTo.
|
||||
* An example of usage is as follows:
|
||||
*
|
||||
* ```js
|
||||
* interface UserInstance extends Sequelize.Instance<UserInstance, UserAttrib>, UserAttrib {
|
||||
* getRole: Sequelize.BelongsToAssociationGetMixin<RoleInstance>;
|
||||
* // setRole...
|
||||
* // createRole...
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @see http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/
|
||||
* @see Instance
|
||||
*/
|
||||
interface BelongsToAssociationGetMixin<TInstance> {
|
||||
/**
|
||||
* Get the associated instance.
|
||||
* @param options The obtions to use when getting the association.
|
||||
*/
|
||||
(options?: BelongsToAssociationGetMixinOptions): Promise<TInstance>
|
||||
}
|
||||
|
||||
/**
|
||||
* The options for the set mixin of the BelongsTo association.
|
||||
* @see BelongsToAssociationSetMixin
|
||||
*/
|
||||
interface BelongsToAssociationSetMixinOptions {
|
||||
/**
|
||||
* Skip saving this after setting the foreign key if false.
|
||||
*/
|
||||
save: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The set association mixin applied to models with BelongsTo.
|
||||
* An example of usage is as follows:
|
||||
*
|
||||
* ```js
|
||||
* interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
|
||||
* // getRole...
|
||||
* setRole: BelongsToAssociationSetMixin<RoleInstance, RoleId>;
|
||||
* // createRole...
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @see http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/
|
||||
* @see Instance
|
||||
*/
|
||||
interface BelongsToAssociationSetMixin<TInstance, TInstancePrimaryKey> {
|
||||
/**
|
||||
* Get the associated instance.
|
||||
* @param newAssociation An instance or the primary key of an instance to associate with this. Pass null or undefined to remove the association.
|
||||
* @param options The obtions to use when setting the association.
|
||||
*/
|
||||
(newAssociation: TInstance | TInstancePrimaryKey, options?: BelongsToAssociationSetMixinOptions): Promise<void>
|
||||
}
|
||||
|
||||
/**
|
||||
* The options for the create mixin of the BelongsTo association.
|
||||
* @see BelongsToAssociationCreateMixin
|
||||
*/
|
||||
interface BelongsToAssociationCreateMixinOptions extends CreateOptions, BelongsToAssociationSetMixinOptions {}
|
||||
|
||||
/**
|
||||
* The create association mixin applied to models with BelongsTo.
|
||||
* An example of usage is as follows:
|
||||
*
|
||||
* ```js
|
||||
* interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
|
||||
* // getRole...
|
||||
* // setRole...
|
||||
* createRole: BelongsToAssociationCreateMixin<RoleAttributes>;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @see http://docs.sequelizejs.com/en/latest/api/associations/belongs-to/
|
||||
* @see Instance
|
||||
*/
|
||||
interface BelongsToAssociationCreateMixin<TAttributes> {
|
||||
/**
|
||||
* Create a new instance of the associated model and associate it with this.
|
||||
* @param values The values used to create the association.
|
||||
* @param options The options passed to `target.create` and `setAssociation`.
|
||||
*/
|
||||
(values?: TAttributes, options?: BelongsToAssociationCreateMixinOptions): Promise<void>
|
||||
}
|
||||
|
||||
// TODO: HasOne Associations
|
||||
// TODO: HasMany Associations
|
||||
// TODO: BelongsToMany Associations
|
||||
|
||||
/**
|
||||
* Foreign Key Options
|
||||
*
|
||||
|
||||
Vendored
+207
-137
@@ -1,4 +1,4 @@
|
||||
// Type definitions for SharePoint 2010 and 2013
|
||||
// Type definitions for SharePoint 2010 and 2013
|
||||
// Project: http://sptypescript.codeplex.com
|
||||
// Definitions by: Stanislav Vyshchepan <http://blog.gandjustas.ru>, Andrey Markeev <http://markeev.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -72,7 +72,7 @@ declare module SP {
|
||||
static isUndefined(obj: any): boolean;
|
||||
static replaceOrAddQueryString(url: string, key: string, value: string): string;
|
||||
static removeHtml(str: string): string;
|
||||
static removeStyleChildren(element: HTMLElement): any;
|
||||
static removeStyleChildren(element: HTMLElement): void;
|
||||
static removeHtmlAndTrimStringWithEllipsis(str: string, maxLength: number): string;
|
||||
static setTextAreaElementValue(textAreaElement: HTMLTextAreaElement, newValue: string): void;
|
||||
static truncateToInt(n: number): number;
|
||||
@@ -116,12 +116,12 @@ declare module SP {
|
||||
export function refreshView(viewId: string): void;
|
||||
}
|
||||
export module Selection {
|
||||
export function selectListItem(iid: string, bSelect: boolean): any;
|
||||
export function selectListItem(iid: string, bSelect: boolean): void;
|
||||
export function getSelectedItems(): { id: number; fsObjType: FileSystemObjectType; }[];
|
||||
export function getSelectedList(): string;
|
||||
export function getSelectedView(): string;
|
||||
export function navigateUp(viewId: string): void;
|
||||
export function deselectAllListItems(iid: string): any;
|
||||
export function deselectAllListItems(iid: string): void;
|
||||
}
|
||||
export module Overrides {
|
||||
export function overrideDeleteConfirmation(listId: string, overrideText: string): void;
|
||||
@@ -321,7 +321,7 @@ interface ContextInfo extends SPClientTemplates.RenderContext {
|
||||
}
|
||||
|
||||
declare function GetCurrentCtx(): ContextInfo;
|
||||
declare function SetFullScreenMode(fullscreen: boolean): any;
|
||||
declare function SetFullScreenMode(fullscreen: boolean): void;
|
||||
declare module SP {
|
||||
export enum RequestExecutorErrors {
|
||||
requestAbortedOrTimedout,
|
||||
@@ -348,7 +348,7 @@ declare module SP {
|
||||
method?: string;
|
||||
headers?: { [key: string]: string; };
|
||||
/** Can be string or bytearray depending on binaryStringRequestBody field */
|
||||
body?: string|Uint8Array;
|
||||
body?: string | Uint8Array;
|
||||
binaryStringRequestBody?: boolean;
|
||||
|
||||
/** Currently need fix to get ginary response. Details: http://techmikael.blogspot.ru/2013/07/how-to-copy-files-between-sites-using.html */
|
||||
@@ -367,7 +367,7 @@ declare module SP {
|
||||
headers?: { [key: string]: string; };
|
||||
contentType?: string;
|
||||
/** Can be string or bytearray depending on request.binaryStringResponseBody field */
|
||||
body?: string|Uint8Array;
|
||||
body?: string | Uint8Array;
|
||||
state?: any;
|
||||
}
|
||||
|
||||
@@ -651,7 +651,7 @@ declare class CalloutActionMenuEntry {
|
||||
|
||||
declare class CalloutActionMenu {
|
||||
constructor(actionsId: any);
|
||||
addAction(action: CalloutAction): any;
|
||||
addAction(action: CalloutAction): void;
|
||||
getActions(): CalloutAction[];
|
||||
render(): void;
|
||||
refreshActions(): void;
|
||||
@@ -664,9 +664,9 @@ declare class CalloutAction {
|
||||
getText(): string;
|
||||
getToolTop(): string;
|
||||
getDisabledToolTip(): string;
|
||||
getOnClickCallback(): (event: any, action: CalloutAction) => any;
|
||||
getIsDisabledCallback(): (action: CalloutAction) => boolean;
|
||||
getIsVisibleCallback(): (action: CalloutAction) => boolean;
|
||||
getOnClickCallback(event: any, action: CalloutAction): any;
|
||||
getIsDisabledCallback(action: CalloutAction): boolean;
|
||||
getIsVisibleCallback(action: CalloutAction): boolean;
|
||||
getIsMenu(): boolean;
|
||||
getMenuEntries(): CalloutActionMenuEntry[];
|
||||
render(): void;
|
||||
@@ -680,7 +680,7 @@ declare class Callout {
|
||||
set(options: CalloutOptions): any;
|
||||
/** Adds event handler to the callout.
|
||||
@param eventName one of the following: "opened", "opening", "closing", "closed" */
|
||||
addEventCallback(eventName: string, callback: (callout: Callout) => void): any;
|
||||
addEventCallback(eventName: string, callback: (callout: Callout) => void): void;
|
||||
/** Returns the launch point element of the callout. */
|
||||
getLaunchPoint(): HTMLElement;
|
||||
/** Returns the ID of the callout. */
|
||||
@@ -714,13 +714,13 @@ declare class Callout {
|
||||
/** Returns the callout actions menu */
|
||||
getActionMenu(): CalloutActionMenu;
|
||||
/** Adds a link to the actions panel in the bottom part of the callout window */
|
||||
addAction(action: CalloutAction): any;
|
||||
addAction(action: CalloutAction): void;
|
||||
/** Re-renders the actions menu. Call after the actions menu is changed. */
|
||||
refreshActions(): void;
|
||||
/** Display the callout. Animation can be used only for IE9+ */
|
||||
open(useAnimation?: boolean): any;
|
||||
open(useAnimation: boolean): void;
|
||||
/** Hide the callout. Animation can be used only for IE9+ */
|
||||
close(useAnimation?: boolean): any;
|
||||
close(useAnimation: boolean): void;
|
||||
/** Display if hidden, hide if shown. */
|
||||
toggle(): void;
|
||||
/** Do not call this directly. Instead, use CalloutManager.remove */
|
||||
@@ -774,7 +774,7 @@ declare class CalloutManager {
|
||||
/** Checks if callout with specified ID already exists. If it doesn't, creates it, otherwise returns the existing one. */
|
||||
static createNewIfNecessary(options: CalloutOptions): Callout;
|
||||
/** Detaches callout from the launch point and destroys it. */
|
||||
static remove(callout: Callout): any;
|
||||
static remove(callout: Callout): void;
|
||||
/** Searches for a callout associated with the specified launch point. Throws error if not found. */
|
||||
static getFromLaunchPoint(launchPoint: HTMLElement): Callout;
|
||||
/** Searches for a callout associated with the specified launch point. Returns null if not found. */
|
||||
@@ -785,7 +785,7 @@ declare class CalloutManager {
|
||||
/** Finds the closest launch point based on the specified descendant element, and returns callout associated with the launch point. */
|
||||
static getFromCalloutDescendant(descendant: HTMLElement): Callout;
|
||||
/** Perform some action for each callout on the page. */
|
||||
static forEach(callback: (callout: Callout) => void): any;
|
||||
static forEach(callback: (callout: Callout) => void): void;
|
||||
/** Closes all callouts on the page */
|
||||
static closeAll(): boolean;
|
||||
/** Returns true if at least one of the defined on page callouts is opened. */
|
||||
@@ -1346,15 +1346,15 @@ declare module SPClientTemplates {
|
||||
View?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template
|
||||
Body?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template
|
||||
/** Defines templates for rendering groups (aggregations). */
|
||||
Group?: GroupCallback| string;
|
||||
Group?: GroupCallback | string;
|
||||
/** Defines templates for list items rendering. */
|
||||
Item?: ItemCallback| string;
|
||||
Item?: ItemCallback | string;
|
||||
/** Defines template for rendering list view header.
|
||||
Can be either string or SingleTemplateCallback */
|
||||
Header?: SingleTemplateCallback| string;
|
||||
Header?: SingleTemplateCallback | string;
|
||||
/** Defines template for rendering list view footer.
|
||||
Can be either string or SingleTemplateCallback */
|
||||
Footer?: SingleTemplateCallback| string;
|
||||
Footer?: SingleTemplateCallback | string;
|
||||
/** Defines templates for fields rendering. The field is specified by it's internal name. */
|
||||
Fields?: FieldTemplates;
|
||||
}
|
||||
@@ -1367,15 +1367,15 @@ declare module SPClientTemplates {
|
||||
View?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template
|
||||
Body?: RenderCallback | string; // TODO: determine appropriate context type and purpose of this template
|
||||
/** Defines templates for rendering groups (aggregations). */
|
||||
Group?: GroupCallback| string;
|
||||
Group?: GroupCallback | string;
|
||||
/** Defines templates for list items rendering. */
|
||||
Item?: ItemCallback| string;
|
||||
Item?: ItemCallback | string;
|
||||
/** Defines template for rendering list view header.
|
||||
Can be either string or SingleTemplateCallback */
|
||||
Header?: SingleTemplateCallback| string;
|
||||
Header?: SingleTemplateCallback | string;
|
||||
/** Defines template for rendering list view footer.
|
||||
Can be either string or SingleTemplateCallback */
|
||||
Footer?: SingleTemplateCallback| string;
|
||||
Footer?: SingleTemplateCallback | string;
|
||||
/** Defines templates for fields rendering. The field is specified by it's internal name. */
|
||||
Fields?: FieldTemplateMap;
|
||||
}
|
||||
@@ -1397,7 +1397,7 @@ declare module SPClientTemplates {
|
||||
ListTemplateType?: number;
|
||||
/** Base view ID (SPView.BaseViewID) for which the template should be applied.
|
||||
If not defined, the templates will be applied to all views. */
|
||||
BaseViewID?: number|string;
|
||||
BaseViewID?: number | string;
|
||||
}
|
||||
export class TemplateManager {
|
||||
static RegisterTemplateOverrides(renderCtx: TemplateOverridesOptions): void;
|
||||
@@ -1481,7 +1481,7 @@ declare module SPClientTemplates {
|
||||
registerGetValueCallback(fieldname: string, callback: () => any): void;
|
||||
updateControlValue(fieldname: string, value: any): void;
|
||||
registerClientValidator(fieldname: string, validator: SPClientForms.ClientValidation.ValidatorSet): void;
|
||||
registerHasValueChangedCallback(fieldname: string, callback: (eventArg?: any) => void): any;
|
||||
registerHasValueChangedCallback(fieldname: string, callback: (eventArg?: any) => void): void;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1499,7 +1499,7 @@ declare module SPClientForms {
|
||||
}
|
||||
|
||||
export class ValidatorSet {
|
||||
public RegisterValidator(validator: IValidator): any;
|
||||
public RegisterValidator(validator: IValidator): void;
|
||||
}
|
||||
|
||||
export interface IValidator {
|
||||
@@ -1509,6 +1509,43 @@ declare module SPClientForms {
|
||||
export class RequiredValidator implements IValidator {
|
||||
Validate(value: any): ValidationResult;
|
||||
}
|
||||
|
||||
export class RequiredFileValidator implements IValidator {
|
||||
Validate(value: any): ValidationResult;
|
||||
}
|
||||
|
||||
export class RequiredRichTextValidator implements IValidator {
|
||||
Validate(value: any): ValidationResult;
|
||||
}
|
||||
|
||||
export class MaxLengthUrlValidator implements IValidator {
|
||||
Validate(value: any): ValidationResult;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export enum FormManagerEvents {
|
||||
Event_OnControlValueChanged,//: 1,
|
||||
Event_OnControlInitializedCallback,//: 2,
|
||||
Event_OnControlFocusSetCallback,//: 3,
|
||||
Event_GetControlValueCallback,//: 4,
|
||||
Event_OnControlValidationError,//: 5,
|
||||
Event_RegisterControlValidator,//: 6,
|
||||
Event_GetHasValueChangedCallback//: 7
|
||||
}
|
||||
|
||||
export class ClientForm {
|
||||
constructor(qualifier: string);
|
||||
RenderClientForm(): void;
|
||||
SubmitClientForm(): boolean;
|
||||
NotifyControlEvent(eventName: FormManagerEvents, fldName: string, eventArg: any): void;
|
||||
}
|
||||
|
||||
export class ClientFormManager {
|
||||
static GetClientForm(qualifier: string): ClientForm;
|
||||
static RegisterClientForm(qualifier: string): void;
|
||||
static SubmitClientForm(qualifier: string): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1521,6 +1558,31 @@ declare class SPMgr {
|
||||
|
||||
declare var spMgr: SPMgr;
|
||||
|
||||
declare function SPField_FormDisplay_Default(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPField_FormDisplay_DefaultNoEncode(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPField_FormDisplay_Empty(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldText_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldNumber_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldBoolean_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldNote_Display(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldNote_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldFile_Display(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldFile_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldChoice_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldChoice_Dropdown_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldChoice_Radio_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldMultiChoice_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldDateTime_Display(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldDateTime_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldUrl_Display(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldUrl_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldUserMulti_Display(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPClientPeoplePickerCSRTemplate(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldLookup_Display(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldLookup_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldLookupMulti_Edit(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
declare function SPFieldAttachments_Default(ctx: SPClientTemplates.RenderContext_FieldInForm): string;
|
||||
|
||||
declare module SPAnimation {
|
||||
export enum Attribute {
|
||||
PositionX,
|
||||
@@ -1563,7 +1625,7 @@ declare module SPAnimation {
|
||||
|
||||
|
||||
export class State {
|
||||
SetAttribute(attributeId: Attribute, value: number): any;
|
||||
SetAttribute(attributeId: Attribute, value: number): void;
|
||||
GetAttribute(attributeId: Attribute): number;
|
||||
GetDataIndex(attributeId: Attribute): number
|
||||
}
|
||||
@@ -4817,6 +4879,9 @@ declare module SP {
|
||||
loadAndInstallApp(appPackageStream: SP.Base64EncodedByteArray): SP.AppInstance;
|
||||
ensureUser(logonName: string): SP.User;
|
||||
applyTheme(colorPaletteUrl: string, fontSchemeUrl: string, backgroundImageUrl: string, shareGenerated: boolean): void;
|
||||
|
||||
/** Available after March 2015 CU for SharePoint 2013*/
|
||||
getList(url: string): List;
|
||||
}
|
||||
export class WebCollection extends SP.ClientObjectCollection<Web> {
|
||||
itemAt(index: number): SP.Web;
|
||||
@@ -5105,7 +5170,7 @@ declare module Microsoft.SharePoint.Client.Search {
|
||||
set_maxSnippetLength: (value: number) => void;
|
||||
|
||||
get_personalizationData: () => QueryPersonalizationData;
|
||||
set_personalizationData: (QueryPersonalizationData: any) => void;
|
||||
set_personalizationData: (value: QueryPersonalizationData) => void;
|
||||
|
||||
get_processBestBets: () => boolean;
|
||||
set_processBestBets: (value: boolean) => void;
|
||||
@@ -5149,7 +5214,7 @@ declare module Microsoft.SharePoint.Client.Search {
|
||||
set_startRow: (value: number) => void;
|
||||
|
||||
get_summaryLength: () => number;
|
||||
set_summaryLength: (number: any) => void;
|
||||
set_summaryLength: (value: number) => void;
|
||||
|
||||
get_timeout: () => number;
|
||||
set_timeout: (value: number) => void;
|
||||
@@ -5167,11 +5232,11 @@ declare module Microsoft.SharePoint.Client.Search {
|
||||
|
||||
|
||||
getQuerySuggestionsWithResults: (iNumberOfQuerySuggestions: number,
|
||||
iNumberOfResultSuggestions: number,
|
||||
fPreQuerySuggestions: boolean,
|
||||
fHitHighlighting: boolean,
|
||||
fCapitalizeFirstLetters: boolean,
|
||||
fPrefixMatchAllTerms: boolean) => QuerySuggestionResults;
|
||||
iNumberOfResultSuggestions: number,
|
||||
fPreQuerySuggestions: boolean,
|
||||
fHitHighlighting: boolean,
|
||||
fCapitalizeFirstLetters: boolean,
|
||||
fPrefixMatchAllTerms: boolean) => QuerySuggestionResults;
|
||||
|
||||
|
||||
}
|
||||
@@ -5217,15 +5282,15 @@ declare module Microsoft.SharePoint.Client.Search {
|
||||
executeQuery: (query: Query) => SP.JsonObjectResult;
|
||||
executeQueries: (queryIds: string[], queries: Query[], handleExceptions: boolean) => SP.JsonObjectResult;
|
||||
recordPageClick: (
|
||||
pageInfo: string,
|
||||
clickType: string,
|
||||
blockType: number,
|
||||
clickedResultId: string,
|
||||
subResultIndex: number,
|
||||
immediacySourceId: string,
|
||||
immediacyQueryString: string,
|
||||
immediacyTitle: string,
|
||||
immediacyUrl: string) => void;
|
||||
pageInfo: string,
|
||||
clickType: string,
|
||||
blockType: number,
|
||||
clickedResultId: string,
|
||||
subResultIndex: number,
|
||||
immediacySourceId: string,
|
||||
immediacyQueryString: string,
|
||||
immediacyTitle: string,
|
||||
immediacyUrl: string) => void;
|
||||
exportPopularQueries: (web: SP.Web, sourceId: SP.Guid) => SP.JsonObjectResult;
|
||||
}
|
||||
|
||||
@@ -5531,14 +5596,14 @@ declare module Microsoft.SharePoint.Client.Search {
|
||||
export class DocumentCrawlLog extends SP.ClientObject {
|
||||
constructor(context: SP.ClientContext, site: SP.Site);
|
||||
getCrawledUrls: (getCountOnly: boolean,
|
||||
maxRows: { High: number; Low: number; },
|
||||
queryString: string,
|
||||
isLike: boolean,
|
||||
contentSourceID: number,
|
||||
errorLevel: number,
|
||||
errorID: number,
|
||||
startDateTime: Date,
|
||||
endDateTime: Date) => SP.JsonObjectResult;
|
||||
maxRows: { High: number; Low: number; },
|
||||
queryString: string,
|
||||
isLike: boolean,
|
||||
contentSourceID: number,
|
||||
errorLevel: number,
|
||||
errorID: number,
|
||||
startDateTime: Date,
|
||||
endDateTime: Date) => SP.JsonObjectResult;
|
||||
}
|
||||
|
||||
export class SearchObjectOwner extends SP.ClientObject {
|
||||
@@ -7336,8 +7401,8 @@ declare module SP {
|
||||
}
|
||||
|
||||
export module Workplace {
|
||||
export function add_resized(handler: Function): any;
|
||||
export function remove_resized(handler: Function): any;
|
||||
export function add_resized(handler: Function): void;
|
||||
export function remove_resized(handler: Function): void;
|
||||
}
|
||||
|
||||
export module UIUtility {
|
||||
@@ -7562,7 +7627,7 @@ declare module SP {
|
||||
Pictures in bmp, jpg and png formats and up to 5,000,000 bytes are supported.
|
||||
A user can upload a picture only to the user's own profile.
|
||||
@param data Binary content of an image file */
|
||||
setMyProfilePicture(data: any): void;
|
||||
setMyProfilePicture(data: SP.Base64EncodedByteArray): void;
|
||||
}
|
||||
|
||||
/** Specifies the capabilities of a personal site. */
|
||||
@@ -7803,17 +7868,17 @@ declare module SP {
|
||||
/** Specifies the item of this item */
|
||||
set_title(value: string): string;
|
||||
/** Specifies the GUID for this item in the Content database. */
|
||||
get_uniqueId(): any;
|
||||
get_uniqueId(): SP.Guid;
|
||||
/** Specifies the GUID for this item in the Content database. */
|
||||
set_uniqueId(value: any): any;
|
||||
set_uniqueId(value: SP.Guid): SP.Guid;
|
||||
/** Specifies the URL of this item. */
|
||||
get_url(): string;
|
||||
/** Specifies the URL of this item. */
|
||||
set_url(value: string): string;
|
||||
/** Specifies the site identification (GUID) in the Content database for this item if it is a site, or the identification of its parent site if this item is a document. */
|
||||
get_webId(): string;
|
||||
get_webId(): SP.Guid;
|
||||
/** Specifies the site identification (GUID) in the Content database for this item if it is a site, or the identification of its parent site if this item is a document. */
|
||||
set_webId(value: any): any;
|
||||
set_webId(value: SP.Guid): any;
|
||||
}
|
||||
|
||||
export enum FollowedItemType {
|
||||
@@ -8060,7 +8125,7 @@ declare module SP {
|
||||
|
||||
export module DateTimeUtil {
|
||||
export class SimpleDate {
|
||||
construction(year: number, month: number, day: number, era: number): any;
|
||||
constructor(year: number, month: number, day: number, era: number);
|
||||
get_year(): number;
|
||||
set_year(value: number): void;
|
||||
get_month(): number;
|
||||
@@ -8233,10 +8298,10 @@ declare module SP.WorkflowServices {
|
||||
export class InteropService extends SP.ClientObject {
|
||||
constructor(context: SP.ClientRuntimeContext, objectPath: SP.ObjectPathStaticProperty);
|
||||
static getCurrent(context: SP.ClientRuntimeContext): InteropService;
|
||||
enableEvents(listId: any, itemGuid: any): void;
|
||||
disableEvents(listId: any, itemGuid: any): void;
|
||||
startWorkflow(associationName: any, correlationId: any, listId: any, itemGuid: any, workflowParameters: any): SP.GuidResult;
|
||||
cancelWorkflow(instanceId: any): void;
|
||||
enableEvents(listId: SP.Guid, itemGuid: SP.Guid): void;
|
||||
disableEvents(listId: SP.Guid, itemGuid: SP.Guid): void;
|
||||
startWorkflow(associationName: string, correlationId: SP.Guid, listId: SP.Guid, itemGuid: SP.Guid, workflowParameters: any): SP.GuidResult;
|
||||
cancelWorkflow(instanceId: SP.Guid): void;
|
||||
}
|
||||
|
||||
/** Represents a workflow definition and associated properties. */
|
||||
@@ -8312,7 +8377,6 @@ declare module SP.WorkflowServices {
|
||||
|
||||
/** Manages workflow definitions and workflow activity authoring. */
|
||||
export class WorkflowDeploymentService extends SP.ClientObject {
|
||||
constructor(context: SP.ClientRuntimeContext, objectPath: SP.ObjectPathStaticProperty);
|
||||
/** Returns an XML representation of a list of valid Workflow Manager Client 1.0 actions for the specified web (WorkflowInfo element). */
|
||||
getDesignerActions(web: SP.Web): SP.StringResult;
|
||||
/** Returns an XML representation of a collection of XAML class signatures for workflow definitions.
|
||||
@@ -8336,7 +8400,7 @@ declare module SP.WorkflowServices {
|
||||
getDefinition(definitionId: string): WorkflowDefinition;
|
||||
/** Saves the collateral file of a workflow definition.
|
||||
@param workflowDefinitionId The guid identifier of the workflow definition.*/
|
||||
saveCollateral(workflowDefinitionId: string, leafFileName: string, fileContent: any): void;
|
||||
saveCollateral(workflowDefinitionId: string, leafFileName: string, fileContent: Base64EncodedByteArray): void;
|
||||
/** Deletes the URL of a workflow definition's collateral file.
|
||||
@param workflowDefinitionId The guid identifier of the workflow definition. */
|
||||
deleteCollateral(workflowDefinitionId: string, leafFileName: string): void;
|
||||
@@ -8353,7 +8417,7 @@ declare module SP.WorkflowServices {
|
||||
@param packageDefaultFilename The default filename to choose for the new package.
|
||||
@param packageTitle The title of the package.
|
||||
@param packageDescription The description of the package. */
|
||||
packageDefinition(definitionId: any, packageDefaultFilename: any, packageTitle: any, packageDescription: any): SP.StringResult;
|
||||
packageDefinition(definitionId: SP.Guid, packageDefaultFilename: string, packageTitle: string, packageDescription: string): SP.StringResult;
|
||||
}
|
||||
|
||||
/** Represents an instance of a workflow association that performs on a list item the process that is defined in a workflow template */
|
||||
@@ -8451,9 +8515,9 @@ declare module SP.WorkflowServices {
|
||||
/** Base class representing subscriptions for the external workflow host. */
|
||||
export class WorkflowSubscription extends SP.ClientObject {
|
||||
/** Gets the unique ID of the workflow definition to activate. */
|
||||
get_definitionId(): any;
|
||||
get_definitionId(): SP.Guid;
|
||||
/** Sets the unique ID of the workflow definition to activate. */
|
||||
set_definitionId(value: any): any;
|
||||
set_definitionId(value: SP.Guid): SP.Guid;
|
||||
/** Gets a boolean value that specifies if the workflow subscription is enabled.
|
||||
When disabled, new instances of the subscription cannot be started, but existing instances will continue to run. */
|
||||
get_enabled(): boolean;
|
||||
@@ -8479,9 +8543,9 @@ declare module SP.WorkflowServices {
|
||||
/** Boolean value that specifies whether multiple workflow instances can be started manually on the same list item at the same time. This property can be used for list workflows only. */
|
||||
set_manualStartBypassesActivationLimit(value: boolean): boolean;
|
||||
/** Gets the name of the workflow subscription for the specified event source. */
|
||||
get_name(): any;
|
||||
get_name(): string;
|
||||
/** Sets the name of the workflow subscription for the specified event source. */
|
||||
set_name(value: any): any;
|
||||
set_name(value: string): string;
|
||||
/** Gets the properties and values to pass to the workflow definition when the subscription is matched. */
|
||||
get_propertyDefinitions(): any;
|
||||
/** Gets the name of the workflow status field on the specified list. */
|
||||
@@ -8520,8 +8584,8 @@ declare module SP.WorkflowServices {
|
||||
@param listId GUID of the list containing the event receiver to be unregistered.
|
||||
@eventName eventName The name of the event to be removed. */
|
||||
unregisterInterestInList(listId: string, eventName: string): void;
|
||||
getSubscription(subscriptionId: any): WorkflowSubscription;
|
||||
deleteSubscription(subscriptionId: any): WorkflowSubscription;
|
||||
getSubscription(subscriptionId: SP.Guid): WorkflowSubscription;
|
||||
deleteSubscription(subscriptionId: SP.Guid): WorkflowSubscription;
|
||||
/** Retrieves workflow subscriptions that contains all of the workflow subscriptions on the Web */
|
||||
enumerateSubscriptions(): WorkflowSubscriptionCollection;
|
||||
/** Retrieves workflow subscriptions based on workflow definition */
|
||||
@@ -8764,7 +8828,7 @@ declare module SP {
|
||||
|
||||
public get_view(): NavigationTermSetView;
|
||||
|
||||
public createTerm(termName: string, linkType: NavigationLinkType, termId: Guid): any;
|
||||
public createTerm(termName: string, linkType: NavigationLinkType, termId: Guid): Taxonomy.Term;
|
||||
|
||||
public getTaxonomyTermStore(): Taxonomy.TermStore;
|
||||
|
||||
@@ -8821,7 +8885,7 @@ declare module SP {
|
||||
|
||||
public getResolvedAssociatedFolderUrl(): StringResult;
|
||||
|
||||
public getWebRelativeFriendlyUrl(): any; StringResult: any;
|
||||
public getWebRelativeFriendlyUrl(): StringResult;
|
||||
|
||||
public getAllParentTerms(): NavigationTermCollection;
|
||||
|
||||
@@ -8898,11 +8962,11 @@ declare module SP {
|
||||
export class TaxonomyNavigation {
|
||||
static getWebNavigationSettings(context: ClientContext, web: Web): WebNavigationSettings;
|
||||
static getTermSetForWeb(context: ClientContext, web: Web, siteMapProviderName: string, includeInheritedSettings: boolean): NavigationTermSet;
|
||||
static setCrawlAsFriendlyUrlPage(context: ClientContext, navigationTerm: any, crawlAsFriendlyUrlPage: any): BooleanResult;
|
||||
static setCrawlAsFriendlyUrlPage(context: ClientContext, navigationTerm: Taxonomy.Term, crawlAsFriendlyUrlPage: boolean): BooleanResult;
|
||||
static getNavigationLcidForWeb(context: ClientContext, web: Web): IntResult;
|
||||
static flushSiteFromCache(context: ClientContext, site: Site): void;
|
||||
static flushWebFromCache(context: ClientContext, web: Web): void;
|
||||
static flushTermSetFromCache(context: ClientContext, webForPermissions: any, termStoreId: Guid, termSetId: Guid): void;
|
||||
static flushTermSetFromCache(context: ClientContext, webForPermissions: Web, termStoreId: Guid, termSetId: Guid): void;
|
||||
}
|
||||
|
||||
export class WebNavigationSettings extends ClientObject {
|
||||
@@ -8946,7 +9010,6 @@ declare module SP {
|
||||
}
|
||||
|
||||
export class SPContainerId extends ClientObject {
|
||||
constructor(context: ClientRuntimeContext, objectPath: ObjectPath);
|
||||
static createFromList(context: ClientRuntimeContext, list: List): SPContainerId;
|
||||
static createFromWeb(context: ClientRuntimeContext, web: Web): SPContainerId;
|
||||
static createFromSite(context: ClientRuntimeContext, site: Site): SPContainerId;
|
||||
@@ -8980,7 +9043,6 @@ declare module SP {
|
||||
}
|
||||
|
||||
export class SPPolicyAssociation extends ClientObject {
|
||||
constructor(context: ClientRuntimeContext, objectPath: ObjectPath);
|
||||
|
||||
get_allowOverride(): boolean;
|
||||
set_allowOverride(value: boolean): boolean;
|
||||
@@ -9026,7 +9088,6 @@ declare module SP {
|
||||
}
|
||||
|
||||
export class SPPolicyBinding extends ClientObject {
|
||||
constructor(context: ClientRuntimeContext, objectPath: ObjectPath);
|
||||
|
||||
get_identity(): any;
|
||||
set_identity(value: any): any;
|
||||
@@ -9072,7 +9133,6 @@ declare module SP {
|
||||
}
|
||||
|
||||
export class SPPolicyDefinition extends ClientObject {
|
||||
constructor(context: ClientRuntimeContext, objectPath: ObjectPath);
|
||||
|
||||
get_comment(): string;
|
||||
set_comment(value: string): string;
|
||||
@@ -9080,8 +9140,8 @@ declare module SP {
|
||||
get_createdBy(): any;
|
||||
set_createdBy(value: any): any;
|
||||
|
||||
get_defaultPolicyRuleConfigId: any;
|
||||
set_defaultPolicyRuleConfigId: any;
|
||||
get_defaultPolicyRuleConfigId(): any;
|
||||
set_defaultPolicyRuleConfigId(value: any): any;
|
||||
|
||||
get_description(): string;
|
||||
set_description(value: string): string;
|
||||
@@ -9120,7 +9180,6 @@ declare module SP {
|
||||
}
|
||||
|
||||
export class SPPolicyRule extends ClientObject {
|
||||
constructor(context: ClientRuntimeContext, objectPath: ObjectPath);
|
||||
|
||||
get_comment(): string;
|
||||
set_comment(value: string): string;
|
||||
@@ -9176,7 +9235,7 @@ declare module SP {
|
||||
|
||||
deletePolicyRule(policyRuleId: any): void;
|
||||
|
||||
notifyUnifiedPolicySync(notificationId: any, syncSvcUrl: string, changeInfos: any, syncNow: boolean, fullSyncForTenant: any): void;
|
||||
notifyUnifiedPolicySync(notificationId: any, syncSvcUrl: string, changeInfos: any, syncNow: boolean, fullSyncForTenant: boolean): void;
|
||||
|
||||
updatePolicyDefinition(policyDefinition: SPPolicyDefinition): void;
|
||||
|
||||
@@ -9394,7 +9453,7 @@ declare class SPClientPeoplePicker {
|
||||
|
||||
public SetInitialValue(entities: ISPClientPeoplePickerEntity[], initialErrorMsg?: string): void
|
||||
public AddUserKeys(userKeys: string, bSearch: boolean): void;
|
||||
public BatchAddUserKeysOperation(allKeys: string[], numProcessed: number): any;
|
||||
public BatchAddUserKeysOperation(allKeys: string[], numProcessed: number): void;
|
||||
public ResolveAllUsers(fnContinuation: () => void): void;
|
||||
public ExecutePickerQuery(queryIds: string, onSuccess: (queryId: string, result: SP.StringResult) => void, onFailure: (queryId: string, result: SP.StringResult) => void, fnContinuation: () => void): void;
|
||||
public AddUnresolvedUserFromEditor(bRunQuery?: boolean): void;
|
||||
@@ -9437,7 +9496,7 @@ declare class SPClientPeoplePicker {
|
||||
public AddLoadingSuggestionMenuOption(): void;
|
||||
public ShowingLocalSuggestions(): boolean;
|
||||
public ShouldUsePPMRU(): boolean;
|
||||
public AddResolvedUserToLocalCache(resolvedEntity: ISPClientPeoplePickerEntity, resolveText: string): any;
|
||||
public AddResolvedUserToLocalCache(resolvedEntity: ISPClientPeoplePickerEntity, resolveText: string): void;
|
||||
}
|
||||
|
||||
interface ISPClientPeoplePickerSchema {
|
||||
@@ -9532,7 +9591,7 @@ declare class SPClientPeoplePickerProcessedUser {
|
||||
ErrorDescription: string;// '',
|
||||
ResolveText: string;// '',
|
||||
public UpdateResolvedUser(newUserInfo: ISPClientPeoplePickerEntity, strNewElementId: string): void;
|
||||
public UpdateSuggestions(entity: ISPClientPeoplePickerEntity): any;
|
||||
public UpdateSuggestions(entity: ISPClientPeoplePickerEntity): void;
|
||||
public BuildUserHTML(): string;
|
||||
public UpdateUserMaxWidth(): void;
|
||||
public ResolvedAsUnverifiedEmail(): string;
|
||||
@@ -9551,16 +9610,17 @@ declare module Microsoft {
|
||||
export module ReputationModel {
|
||||
export class Reputation {
|
||||
constructor();
|
||||
static setLike(context: SP.ClientContext, listId: string, itemId: number, like: boolean): any;
|
||||
static setRating(context: SP.ClientContext, listId: string, itemId: number, rating: number): any;
|
||||
static setLike(context: SP.ClientContext, listId: string, itemId: number, like: boolean): void;
|
||||
static setRating(context: SP.ClientContext, listId: string, itemId: number, rating: number): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Available only in SharePoint Online*/
|
||||
declare module Define {
|
||||
export function loadScript(url: string, successCallback: () => void, errCallback: () => void): any;
|
||||
export function loadScript(url: string, successCallback: () => void, errCallback: () => void): void;
|
||||
/** Loads script from _layouts/15/[req].js */
|
||||
export function require(req: string, callback: Function): void;
|
||||
/** Loads script from _layouts/15/[req].js */
|
||||
@@ -9570,7 +9630,7 @@ declare module Define {
|
||||
|
||||
/** Available only in SharePoint Online*/
|
||||
declare module Verify {
|
||||
export function ArgumentType(arg: string, expected: any): any;
|
||||
export function ArgumentType(arg: string, expected: any): void;
|
||||
}
|
||||
|
||||
|
||||
@@ -9582,7 +9642,7 @@ declare module BrowserStorage {
|
||||
/** Available only in SharePoint Online*/
|
||||
interface CachedStorage {
|
||||
getItem(key: string): string;
|
||||
setItem(key: string, value: string): any;
|
||||
setItem(key: string, value: string): void;
|
||||
removeItem(key: string): void;
|
||||
clead(): void;
|
||||
length: number;
|
||||
@@ -9621,7 +9681,7 @@ declare module DOM {
|
||||
export function GetEventSrcElement(evt: Event): HTMLElement;
|
||||
export function GetInnerText(el: HTMLElement): string;
|
||||
export function PreventDefaultNavigation(evt: Event): void;
|
||||
export function SetEvent(eventName: string, eventFunc: Function, el: HTMLElement): any;
|
||||
export function SetEvent(eventName: string, eventFunc: Function, el: HTMLElement): void;
|
||||
}
|
||||
|
||||
/** Available only in SharePoint Online*/
|
||||
@@ -9645,8 +9705,8 @@ declare module IE8Support {
|
||||
|
||||
/** Available only in SharePoint Online*/
|
||||
declare module StringUtil {
|
||||
export function BuildParam(stPattern: string, ...params: any[]): any;
|
||||
export function ApplyStringTemplate(str: string, ...params: any[]): any;
|
||||
export function BuildParam(stPattern: string, ...params: any[]): string;
|
||||
export function ApplyStringTemplate(str: string, ...params: any[]): string;
|
||||
}
|
||||
|
||||
/** Available only in SharePoint Online*/
|
||||
@@ -9867,10 +9927,20 @@ declare module SP {
|
||||
HideInitialLoadingBanner(): void;
|
||||
ShowInitialGridErrorMsg(errorMsg: string): void;
|
||||
ShowGridErrorMsg(errorMsg: string): void;
|
||||
LaunchPrintView(additionalScriptFiles: any, beforeInitFnName: any, beforeInitFnArgsObj: any, title: any, bEnableGantt: any, optGanttDelegateNames: any, optInitTableViewParamsFnName: any, optInitTableViewParamsFnArgsObj: any, optInitGanttStylesFnName: any, optInitGanttStylesFnArgsObj: any): void;
|
||||
LaunchPrintView(
|
||||
additionalScriptFiles: any,
|
||||
beforeInitFnName: any,
|
||||
beforeInitFnArgsObj: any,
|
||||
title: string,
|
||||
bEnableGantt: boolean,
|
||||
optGanttDelegateNames?: any,
|
||||
optInitTableViewParamsFnName?: any,
|
||||
optInitTableViewParamsFnArgsObj?: any,
|
||||
optInitGanttStylesFnName?: any,
|
||||
optInitGanttStylesFnArgsObj?: any): void;
|
||||
GetAllDataJson(fnOnFinished: any, optFnGetCellStyleID?: any): void;
|
||||
SetTableView(tableViewParams: any): void;
|
||||
SetRowView(rowViewParams: any): void;
|
||||
SetRowView(rowViewParam: any): void;
|
||||
|
||||
/** Enable grid after Disable. */
|
||||
Enable(): void;
|
||||
@@ -9885,7 +9955,7 @@ declare module SP {
|
||||
/** Switches the currently selected cell into edit mode: displays edit control and sets focus into it.
|
||||
Returns true if success. */
|
||||
TryBeginEdit(): boolean;
|
||||
FinalizeEditing(fnContinue: any, fnError: any): void;
|
||||
FinalizeEditing(fnContinue: Function, fnError: Function): void;
|
||||
/** Get diff tracker object that tracks changes to the grid data. */
|
||||
GetDiffTracker(): SP.JsGrid.Internal.DiffTracker;
|
||||
/** Moves focus to the JsGrid control */
|
||||
@@ -9943,7 +10013,7 @@ declare module SP {
|
||||
MoveRecordsUpByOne(recordKeys: any): any;
|
||||
MoveRecordsDownByOne(recordKeys: any): any;
|
||||
GetReorderRange(recordKeys: any): any;
|
||||
GetNodeExpandCollapseState(recordKey: any): any;
|
||||
GetNodeExpandCollapseState(recordKey: number): any;
|
||||
ToggleExpandCollapse(recordKey: number): void;
|
||||
|
||||
/** Attach event handler to a particular event type */
|
||||
@@ -10002,7 +10072,7 @@ declare module SP {
|
||||
HideColumn(columnKey: string): void;
|
||||
/** Update column descriptions */
|
||||
UpdateColumns(columnInfoCollection: ColumnInfoCollection): void;
|
||||
GetColumns(optPaneId?: any): ColumnInfo[];
|
||||
GetColumns(optPaneId?: string): ColumnInfo[];
|
||||
/** Get ColumnInfo object by fieldKey
|
||||
@fieldKey when working with SharePoint data sources, fieldKey corresponds to field internal name */
|
||||
GetColumnByFieldKey(fieldKey: string, optPaneId?: any): ColumnInfo;
|
||||
@@ -10060,12 +10130,12 @@ declare module SP {
|
||||
/** Moves cursor to entry record (the row that is used to add new records) */
|
||||
JumpToEntryRecord(): void;
|
||||
|
||||
SelectRowRange(rowIdx1: any, rowIdx2: any, bAppend: any, optPaneId?: any): void;
|
||||
SelectColumnRange(colIdx1: any, colIdx2: any, bAppend: any, optPaneId?: any): void;
|
||||
SelectCellRange(rowIdx1: any, rowIdx2: any, colIdx1: any, colIdx2: any, bAppend: any, optPaneId: any): void;
|
||||
SelectRowRangeByKey(rowKey1: any, rowKey2: any, bAppend: any, optPaneId?: any): void;
|
||||
SelectColumnRangeByKey(colKey1: any, colKey2: any, bAppend: any, optPaneId?: any): void;
|
||||
SelectCellRangeByKey(recordKey1: string, recordKey2: string, colKey1: any, colKey2: any, bAppend: any, optPaneId?: any): void;
|
||||
SelectRowRange(rowIdx1: number, rowIdx2: number, bAppend: boolean, optPaneId?: string): void;
|
||||
SelectColumnRange(colIdx1: number, colIdx2: number, bAppend: boolean, optPaneId?: string): void;
|
||||
SelectCellRange(rowIdx1: number, rowIdx2: number, colIdx1: number, colIdx2: number, bAppend: boolean, optPaneId?: string): void;
|
||||
SelectRowRangeByKey(rowKey1: any, rowKey2: any, bAppend: boolean, optPaneId?: string): void;
|
||||
SelectColumnRangeByKey(colKey1: any, colKey2: any, bAppend: boolean, optPaneId?: string): void;
|
||||
SelectCellRangeByKey(recordKey1: string, recordKey2: string, colKey1: any, colKey2: any, bAppend: boolean, optPaneId?: string): void;
|
||||
|
||||
ChangeKeys(oldKey: any, newKey: any): void;
|
||||
GetSelectedRowRanges(optPaneId?: any): any;
|
||||
@@ -10261,14 +10331,14 @@ declare module SP {
|
||||
validationState: SP.JsGrid.ValidationState;
|
||||
}
|
||||
export class RecordInserted implements IEventArgs {
|
||||
constructor(recordKey: any, recordIdx: any, afterRecordKey: any, changeKey: any);
|
||||
constructor(recordKey: number, recordIdx: number, afterRecordKey: number, changeKey: JsGrid.IChangeKey);
|
||||
recordKey: number;
|
||||
recordIdx: number;
|
||||
afterRecordKey: number;
|
||||
changeKey: JsGrid.IChangeKey;
|
||||
}
|
||||
export class RecordDeleted implements IEventArgs {
|
||||
constructor(recordKey: any, recordIdx: any, changeKey: any);
|
||||
constructor(recordKey: number, recordIdx: number, changeKey: JsGrid.IChangeKey);
|
||||
recordKey: number;
|
||||
recordIdx: number;
|
||||
changeKey: JsGrid.IChangeKey;
|
||||
@@ -10279,7 +10349,7 @@ declare module SP {
|
||||
bChecked: boolean;
|
||||
}
|
||||
export class OnCellErrorStateChanged implements IEventArgs {
|
||||
constructor(recordKey: any, fieldKey: any, bAddingError: any, bCellCurrentlyHasError: any, bCellHadError: any, errorId: any);
|
||||
constructor(recordKey: number, fieldKey: string, bAddingError: boolean, bCellCurrentlyHasError: boolean, bCellHadError: boolean, errorId: number);
|
||||
recordKey: number;
|
||||
fieldKey: string;
|
||||
bAddingError: boolean;
|
||||
@@ -10288,7 +10358,7 @@ declare module SP {
|
||||
errorId: number;
|
||||
}
|
||||
export class OnRowErrorStateChanged implements IEventArgs {
|
||||
constructor(recordKey: any, bAddingError: any, bErrorCurrentlyInRow: any, bRowHadError: any, errorId: any, message: any);
|
||||
constructor(recordKey: number, bAddingError: boolean, bErrorCurrentlyInRow: boolean, bRowHadError: boolean, errorId: number, message: string);
|
||||
recordKey: number;
|
||||
bAddingError: boolean;
|
||||
bErrorCurrentlyInRow: boolean;
|
||||
@@ -10412,8 +10482,8 @@ declare module SP {
|
||||
UpdateSplitterStyleFromCss(styleObject: IStyleType.Splitter, splitterStyleNameCollection: any): void;
|
||||
UpdateHeaderStyleFromCss(styleObject: IStyleType.Header, headerStyleNameCol: any): void;
|
||||
UpdateGridPaneStyleFromCss(styleObject: IStyleType.GridPane, gridStyleNameCollection: any): void;
|
||||
UpdateDefaultCellStyleFromCss(styleObject: IStyleType.Cell, cssClass: any): void;
|
||||
UpdateGroupStylesFromCss(styleObject: any, prefix: any): void;
|
||||
UpdateDefaultCellStyleFromCss(styleObject: IStyleType.Cell, cssClass: string): void;
|
||||
UpdateGroupStylesFromCss(styleObject: IStyleType.Cell, prefix: string): void;
|
||||
}
|
||||
|
||||
export interface IStyleType { }
|
||||
@@ -10530,15 +10600,15 @@ declare module SP {
|
||||
|
||||
static SetRTL: { (rtlObject: any): void; };
|
||||
static MakeJsGridStyleManager: { (): IStyleManager };
|
||||
static CreateStyleFromCss: { (styleType: IStyleType, cssStyleName: string, optExistingStyle: any, optClassId: any): any; };
|
||||
static CreateStyleFromCss: { (styleType: IStyleType, cssStyleName: string, optExistingStyle?: any, optClassId?: any): any; };
|
||||
static CreateStyle: { (styleType: IStyleType, styleProps: any): any; };
|
||||
static MergeCellStyles: { (majorStyle: any, minorStyle: any): any; };
|
||||
static ApplyCellStyle: { (td: any, style: any): void; };
|
||||
static ApplyRowHeaderStyle: { (domObj: any, style: any, fnGetHeaderSibling: any): void; };
|
||||
static ApplyCornerHeaderBorderStyle: { (domObj: any, colStyle: any, rowStyle: any): void; };
|
||||
static ApplyHeaderInnerBorderStyle: { (domObj: any, bIsRowHeader: any, headerObject: any): void };
|
||||
static ApplyColumnContextMenuStyle: { (domObj: any, style: any): void };
|
||||
static ApplySplitterStyle: { (domObj: any, style: any): void };
|
||||
static ApplyCellStyle: { (td: HTMLTableCellElement, style: any): void; };
|
||||
static ApplyRowHeaderStyle: { (domObj: HTMLElement, style: any, fnGetHeaderSibling: Function): void; };
|
||||
static ApplyCornerHeaderBorderStyle: { (domObj: HTMLElement, colStyle: any, rowStyle: any): void; };
|
||||
static ApplyHeaderInnerBorderStyle: { (domObj: HTMLElement, bIsRowHeader: any, headerObject: any): void };
|
||||
static ApplyColumnContextMenuStyle: { (domObj: HTMLElement, style: any): void };
|
||||
static ApplySplitterStyle: { (domObj: HTMLElement, style: any): void };
|
||||
static MakeBorderString: { (width: number, style: string, color: string): string };
|
||||
static GetCellStyleDefaultBackgroundColor: { (): string };
|
||||
|
||||
@@ -10649,7 +10719,7 @@ declare module SP {
|
||||
constructor(gridFieldMap: any, keyColumnName: string, fnGetPropType: any);
|
||||
gridFieldMap: any;
|
||||
/** Create a new record */
|
||||
MakeRecord(dataPropMap: any, localizedPropMap: any, bKeepRawData: any): IRecord;
|
||||
MakeRecord(dataPropMap: any, localizedPropMap: any, bKeepRawData: boolean): IRecord;
|
||||
}
|
||||
|
||||
export interface IPropertyBase {
|
||||
@@ -10800,11 +10870,11 @@ declare module SP {
|
||||
|
||||
|
||||
export class Utils {
|
||||
static RegisterDisplayControl(name: string, singleton: any, requiredFunctionNames: string[]): any;
|
||||
static RegisterEditControl(name: string, factory: (gridContext: IEditControlGridContext, gridTextInputElement: HTMLElement) => IEditControl, requiredFunctionNames: string[]): any;
|
||||
static RegisterWidgetControl(name: string, factory: { (ddContext: any): IPropertyType; }, requiredFunctionNames: string[]): any;
|
||||
static RegisterDisplayControl(name: string, singleton: any, requiredFunctionNames: string[]): void;
|
||||
static RegisterEditControl(name: string, factory: (gridContext: IEditControlGridContext, gridTextInputElement: HTMLElement) => IEditControl, requiredFunctionNames: string[]): void;
|
||||
static RegisterWidgetControl(name: string, factory: { (ddContext: any): IPropertyType; }, requiredFunctionNames: string[]): void;
|
||||
|
||||
static UpdateDisplayControlForPropType(propTypeName: string, displayControlType: string): any;
|
||||
static UpdateDisplayControlForPropType(propTypeName: string, displayControlType: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10819,7 +10889,7 @@ declare module SP {
|
||||
|
||||
export module Internal {
|
||||
export class DiffTracker {
|
||||
constructor(objBag: any, fnGetChange: any);
|
||||
constructor(objBag: any, fnGetChange: Function);
|
||||
ExternalAPI: {
|
||||
AnyChanges(): boolean;
|
||||
ChangeKeySliceInfo(): any;
|
||||
@@ -10827,7 +10897,7 @@ declare module SP {
|
||||
EventSliceInfo(): any;
|
||||
GetChanges(optStartEvent: any, optEndEvent: any, optRecordKeys: any, bFirstStartEvent: boolean, bStartInclusive: boolean, bEndInclusive: boolean, bIncludeInvalidPropUpdates: boolean, bLastEndEvent: boolean): any;
|
||||
GetChangesAsJson(changeQuery: any, optfnPreProcessUpdateForSerialize?: any): string;
|
||||
GetUniquePropertyChanges(changeQuery: any, optfnFilter: any): any;
|
||||
GetUniquePropertyChanges(changeQuery: any, optfnFilter?: any): any;
|
||||
RegisterEvent(changeKey: IChangeKey, eventObject: any): void;
|
||||
UnregisterEvent(changeKey: IChangeKey, eventObject: any): void;
|
||||
};
|
||||
@@ -10874,20 +10944,20 @@ declare module SP {
|
||||
export interface IEditControl {
|
||||
SupportedWriteMode?: SP.JsGrid.EditActorWriteType;
|
||||
SupportedReadMode?: SP.JsGrid.EditActorReadType;
|
||||
GetCellContext? (): IEditControlCellContext;
|
||||
GetOriginalValue? (): IValue;
|
||||
SetValue? (value: IValue): void;
|
||||
GetCellContext?(): IEditControlCellContext;
|
||||
GetOriginalValue?(): IValue;
|
||||
SetValue?(value: IValue): void;
|
||||
Dispose(): void;
|
||||
GetInputElement? (): HTMLElement;
|
||||
Focus? (eventInfo: Sys.UI.DomEvent): void;
|
||||
GetInputElement?(): HTMLElement;
|
||||
Focus?(eventInfo: Sys.UI.DomEvent): void;
|
||||
BindToCell(cellContext: IEditControlCellContext): void;
|
||||
OnBeginEdit(eventInfo: Sys.UI.DomEvent): void;
|
||||
Unbind(): void;
|
||||
OnEndEdit(): void;
|
||||
OnCellMove? (): void;
|
||||
OnValueChanged? (newValue: IValue): void;
|
||||
IsCurrentlyUsingGridTextInputElement? (): boolean;
|
||||
SetSize? (width: number, height: number): void;
|
||||
OnCellMove?(): void;
|
||||
OnValueChanged?(newValue: IValue): void;
|
||||
IsCurrentlyUsingGridTextInputElement?(): boolean;
|
||||
SetSize?(width: number, height: number): void;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
|
||||
--noImplicitAny
|
||||
Vendored
+82
-67
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Snap-SVG 0.3
|
||||
// Type definitions for Snap-SVG 0.4.1
|
||||
// Project: https://github.com/adobe-webplatform/Snap.svg
|
||||
// Definitions by: Lars Klein <https://github.com/lhk>
|
||||
// Definitions by: Lars Klein <https://github.com/lhk>, Mattanja Kern <https://github.com/mattanja>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function mina(a:number, A:number, b:number, B:number, get:Function, set:Function, easing?:(num:number)=>number):mina.AnimationDescriptor;
|
||||
@@ -13,7 +13,8 @@ declare module mina {
|
||||
status: Function;
|
||||
stop: Function;
|
||||
}
|
||||
export interface AnimationDescriptor{
|
||||
|
||||
export interface AnimationDescriptor {
|
||||
id: string;
|
||||
start: number;
|
||||
end: number;
|
||||
@@ -53,13 +54,12 @@ declare function Snap(query:string):Snap.Paper;
|
||||
declare function Snap(DOM:SVGElement):Snap.Paper;
|
||||
|
||||
declare module Snap {
|
||||
|
||||
export var filter:Filter;
|
||||
export var path:Path;
|
||||
|
||||
|
||||
export function Matrix(a:number,b:number,c:number,d:number,e:number,f:number):Matrix;
|
||||
export function Matrix(svgMatrix:SVGMatrix):Matrix;
|
||||
|
||||
|
||||
export function ajax(url:string,postData:string,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function ajax(url:string,postData:Object,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
export function ajax(url:string,callback:Function,scope?:Object):XMLHttpRequest;
|
||||
@@ -72,10 +72,10 @@ declare module Snap {
|
||||
export function select(query:string):Snap.Element;
|
||||
export function selectAll(query:string):any;
|
||||
export function snapTo(values:Array<number>,value:number,tolerance?:number):number;
|
||||
|
||||
|
||||
export function animate(from:number|number[],to:number|number[],updater:(n:number)=>void,duration:number,easing?:(num:number)=>number,callback?:()=>void):mina.MinaAnimation;
|
||||
export function animation(attr:Object,duration:number,easing?:(num:number)=>number,callback?:()=>void):Snap.Animation;
|
||||
|
||||
|
||||
export function color(clr:string):RGBHSB;
|
||||
export function getRGB(color:string):RGB;
|
||||
export function hsb(h:number,s:number,b:number):HSB;
|
||||
@@ -89,27 +89,39 @@ declare module Snap {
|
||||
export function angle(x1:number,y1:number,x2:number,y2:number,x3?:number,y3?:number):number;
|
||||
export function rad(deg:number):number;
|
||||
export function deg(rad:number):number;
|
||||
|
||||
export function sin(angle: number): number;
|
||||
export function cos(angle: number): number;
|
||||
export function tan(angle: number): number;
|
||||
export function asin(angle: number): number;
|
||||
export function acos(angle: number): number;
|
||||
export function atan(angle: number): number;
|
||||
export function atan2(angle: number): number;
|
||||
|
||||
export function len(x1: number, y1: number, x2: number, y2: number): number;
|
||||
export function len2(x1: number, y1: number, x2: number, y2: number): number;
|
||||
|
||||
export function parse(svg:string):Fragment;
|
||||
export function parsePathString(pathString:string):Array<any>;
|
||||
export function parsePathString(pathString:Array<string>):Array<any>;
|
||||
export function parseTransformString(TString:string):Array<any>;
|
||||
export function parseTransformString(TString:Array<string>):Array<any>;
|
||||
|
||||
export interface RGB{
|
||||
|
||||
export function closest(x: number, y: number, X: number, Y: number): boolean;
|
||||
|
||||
export interface RGB {
|
||||
r:number;
|
||||
g:number;
|
||||
b:number;
|
||||
hex:string;
|
||||
}
|
||||
|
||||
export interface HSB{
|
||||
|
||||
export interface HSB {
|
||||
h:number;
|
||||
s:number;
|
||||
b:number;
|
||||
}
|
||||
|
||||
export interface RGBHSB{
|
||||
|
||||
export interface RGBHSB {
|
||||
r:number;
|
||||
g:number;
|
||||
b:number;
|
||||
@@ -120,14 +132,14 @@ declare module Snap {
|
||||
v:number;
|
||||
l:number;
|
||||
}
|
||||
|
||||
export interface HSL{
|
||||
|
||||
export interface HSL {
|
||||
h:number;
|
||||
s:number;
|
||||
l:number;
|
||||
}
|
||||
|
||||
export interface BBox{
|
||||
|
||||
export interface BBox {
|
||||
cx:number;
|
||||
cy:number;
|
||||
h:number;
|
||||
@@ -144,7 +156,7 @@ declare module Snap {
|
||||
y2:number;
|
||||
y:number;
|
||||
}
|
||||
|
||||
|
||||
export interface TransformationDescriptor {
|
||||
string: string;
|
||||
globalMatrix: Snap.Matrix;
|
||||
@@ -154,7 +166,8 @@ declare module Snap {
|
||||
local: string;
|
||||
toString(): string;
|
||||
}
|
||||
export interface Animation{
|
||||
|
||||
export interface Animation {
|
||||
attr:{[attr:string]:string|number|boolean|any};
|
||||
duration:number;
|
||||
easing?:(num:number)=>number;
|
||||
@@ -165,16 +178,19 @@ declare module Snap {
|
||||
add(el:Snap.Element):Snap.Element;
|
||||
addClass(value:string):Snap.Element;
|
||||
after(el:Snap.Element):Snap.Element;
|
||||
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element;
|
||||
align(el: Snap.Element, way: string):Snap.Element;
|
||||
animate(animation:any):Snap.Element;
|
||||
animate(attrs:{[attr:string]:string|number|boolean|any},duration:number,easing?:(num: number)=> number,callback?:()=>void):Snap.Element;
|
||||
append(el:Snap.Element):Snap.Element;
|
||||
appendTo(el:Snap.Element):Snap.Element;
|
||||
asPX(attr:string,value?:string):number; //TODO: check what is really returned
|
||||
attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element;
|
||||
attr(param:string):string;
|
||||
attr(params:{[attr:string]:string|number|boolean|any}):Snap.Element;
|
||||
before(el:Snap.Element):Snap.Element;
|
||||
children(): Snap.Element[];
|
||||
clone():Snap.Element;
|
||||
data(key:string,value?:any):any;
|
||||
getAlign(el: Snap.Element, way: string): string;
|
||||
getBBox():BBox;
|
||||
getPointAtLength(length:number):{x:number, y:number, alpha:number};
|
||||
getSubpath(from:number,to:number):string;
|
||||
@@ -195,20 +211,20 @@ declare module Snap {
|
||||
removeClass(value:string):Snap.Element;
|
||||
removeData(key?:string):Snap.Element;
|
||||
select(query:string):Snap.Element;
|
||||
selectAll(query: string): Snap.Set;
|
||||
selectAll(): Snap.Set;
|
||||
stop():Snap.Element;
|
||||
toDefs():Snap.Element;
|
||||
toJSON(): any;
|
||||
toggleClass(value:string,flag:boolean):Snap.Element;
|
||||
toPattern(x:number,y:number,width:number,height:number):Object;
|
||||
toPattern(x:string,y:string,width:string,height:string):Object;
|
||||
toString():string;
|
||||
toggleClass(value:string,flag:boolean):Snap.Element;
|
||||
transform(tstr:string):Snap.Element;
|
||||
transform(): TransformationDescriptor;
|
||||
transform(tstr:string):Snap.Element;
|
||||
type:string;
|
||||
use():Object;
|
||||
|
||||
|
||||
selectAll(): Snap.Set;
|
||||
selectAll(query: string): Snap.Set;
|
||||
|
||||
click(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
dblclick(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
mousedown(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
@@ -220,7 +236,7 @@ declare module Snap {
|
||||
touchmove(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
touchend(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
touchcancel(handler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
|
||||
|
||||
unclick(handler?: (event: MouseEvent) => void): Snap.Element;
|
||||
undblclick(handler: (event: MouseEvent) => void): Snap.Element;
|
||||
unmousedown(handler: (event: MouseEvent) => void): Snap.Element;
|
||||
@@ -236,9 +252,9 @@ declare module Snap {
|
||||
hover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void, thisArg?: any): Snap.Element;
|
||||
hover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void, inThisArg?: any, outThisArg?: any): Snap.Element;
|
||||
unhover(hoverInHandler: (event: MouseEvent) => void, hoverOutHandler: (event: MouseEvent) => void): Snap.Element;
|
||||
|
||||
|
||||
drag():Snap.Element;
|
||||
drag(onMove: (dx: number, dy: number, event: MouseEvent) => void,
|
||||
drag(onMove: (dx: number, dy: number, x: number, y: number, event: MouseEvent) => void,
|
||||
onStart: (x: number, y: number, event: MouseEvent) => void,
|
||||
onEnd: (event: MouseEvent) => void,
|
||||
moveThisArg?: any,
|
||||
@@ -249,15 +265,14 @@ declare module Snap {
|
||||
onStart: (x: number, y: number, event: MouseEvent) => void,
|
||||
onEnd: (event: MouseEvent) => void): Snap.Element;
|
||||
}
|
||||
|
||||
|
||||
export interface Fragment {
|
||||
//TODO: The documentation says that selectAll returns a set, but the getting started guide
|
||||
// uses .attr on the returned object. That's not supported by a set
|
||||
select(query:string):Snap.Element;
|
||||
selectAll(query ?:string):Snap.Set;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface Matrix {
|
||||
add(a:number,b:number,c:number,d:number,e:number,f:number):Matrix;
|
||||
add(matrix:Matrix):Matrix;
|
||||
@@ -267,13 +282,13 @@ declare module Snap {
|
||||
rotate(a:number,x?:number,y?:number):Matrix;
|
||||
scale(x:number,y?:number,cx?:number,cy?:number):Matrix;
|
||||
split():ExplicitTransform;
|
||||
toTransformString():string;
|
||||
toTransformString():string;
|
||||
translate(x:number,y:number):Matrix;
|
||||
x(x:number,y:number):number;
|
||||
y(x:number,y:number):number;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
interface ExplicitTransform {
|
||||
dx: number;
|
||||
dy: number;
|
||||
@@ -283,32 +298,32 @@ declare module Snap {
|
||||
rotate: number;
|
||||
isSimple: boolean;
|
||||
}
|
||||
|
||||
interface Paper extends Snap.Element {
|
||||
|
||||
clear():void;
|
||||
el(name:string, attr:Object):Snap.Element;
|
||||
filter(filstr:string):Snap.Element;
|
||||
gradient(gradient:string):any;
|
||||
g(varargs?:any):any;
|
||||
group(...els:any[]):any;
|
||||
mask(varargs:any):Object;
|
||||
ptrn(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
svg(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
toString():string;
|
||||
use(id?:string):Object;
|
||||
use(id?:Snap.Element):Object;
|
||||
|
||||
circle(x:number,y:number,r:number):Snap.Element;
|
||||
ellipse(x:number,y:number,rx:number,ry:number):Snap.Element;
|
||||
image(src:string,x:number,y:number,width:number,height:number):Snap.Element;
|
||||
line(x1:number,y1:number,x2:number,y2:number):Snap.Element;
|
||||
path(pathString?:string):Snap.Element;
|
||||
polygon(varargs:any[]):Snap.Element;
|
||||
polyline(varargs:any[]):Snap.Element;
|
||||
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
|
||||
text(x:number,y:number,text:string|number):Snap.Element;
|
||||
text(x:number,y:number,text:Array<string|number>):Snap.Element;
|
||||
interface Paper extends Snap.Element {
|
||||
clear():void;
|
||||
el(name:string, attr:Object):Snap.Element;
|
||||
filter(filstr:string):Snap.Element;
|
||||
gradient(gradient:string):any;
|
||||
g(varargs?:any):any;
|
||||
group(...els:any[]):any;
|
||||
mask(varargs:any):Object;
|
||||
ptrn(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
svg(x:number,y:number,width:number,height:number,vbx:number,vby:number,vbw:number,vbh:number):Object;
|
||||
toDataUrl(): string;
|
||||
toString():string;
|
||||
use(id?:string):Object;
|
||||
use(id?:Snap.Element):Object;
|
||||
|
||||
circle(x:number,y:number,r:number):Snap.Element;
|
||||
ellipse(x:number,y:number,rx:number,ry:number):Snap.Element;
|
||||
image(src:string,x:number,y:number,width:number,height:number):Snap.Element;
|
||||
line(x1:number,y1:number,x2:number,y2:number):Snap.Element;
|
||||
path(pathString?:string):Snap.Element;
|
||||
polygon(varargs:any[]):Snap.Element;
|
||||
polyline(varargs:any[]):Snap.Element;
|
||||
rect(x:number,y:number,width:number,height:number,rx?:number,ry?:number):Snap.Element;
|
||||
text(x:number,y:number,text:string|number):Snap.Element;
|
||||
text(x:number,y:number,text:Array<string|number>):Snap.Element;
|
||||
}
|
||||
|
||||
export interface Set {
|
||||
@@ -327,7 +342,7 @@ declare module Snap {
|
||||
push(els:Snap.Element[]):Snap.Element;
|
||||
splice(index:number,count:number,insertion?:Object[]):Snap.Element[];
|
||||
}
|
||||
|
||||
|
||||
interface Filter {
|
||||
blur(x:number,y?:number):string;
|
||||
brightness(amount:number):string;
|
||||
@@ -339,9 +354,9 @@ declare module Snap {
|
||||
sepia(amount:number):string;
|
||||
shadow(dx: number, dy: number, blur: number, color: string, opacity: number): string;
|
||||
shadow(dx: number, dy: number, color: string, opacity: number): string;
|
||||
shadow(dx: number, dy: number, opacity: number): string;
|
||||
shadow(dx: number, dy: number, opacity: number): string;
|
||||
}
|
||||
|
||||
|
||||
interface Path {
|
||||
bezierBBox(...args:number[]):BBox;
|
||||
bezierBBox(bez:Array<number>):BBox;
|
||||
@@ -363,7 +378,7 @@ declare module Snap {
|
||||
toCubic(pathString:Array<string>):Array<any>;
|
||||
toRelative(path:string):Array<any>;
|
||||
}
|
||||
|
||||
|
||||
interface IntersectionDot{
|
||||
x:number,
|
||||
y:number,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/// <reference path="stamplay-js-sdk.d.ts" />
|
||||
|
||||
var userFn = Stamplay.User();
|
||||
var user = new userFn.Model;
|
||||
var colTags = Stamplay.Cobject('tag');
|
||||
var tags = new colTags.Collection();
|
||||
|
||||
// Signing up
|
||||
var registrationData = {
|
||||
email : 'user@provider.com',
|
||||
password: 'mySecret'
|
||||
};
|
||||
|
||||
user.signup(registrationData).then(function(){
|
||||
user.set('phoneNumber', '020 123 4567' );
|
||||
return user.save();
|
||||
}).then(function(){
|
||||
var number = user.get('phoneNumber');
|
||||
console.log(number); // number value is 020 123 4567
|
||||
});
|
||||
|
||||
|
||||
// Action
|
||||
var colFoo = Stamplay.Cobject('foo');
|
||||
var fooMod = new colFoo.Model();
|
||||
fooMod.fetch(5).then(
|
||||
function(){
|
||||
return fooMod.upVote()
|
||||
}
|
||||
).then(
|
||||
function(){
|
||||
//success callback
|
||||
}, function( err : any ){
|
||||
//error callback
|
||||
}
|
||||
)
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for stamplay-js-sdk 1.2.9
|
||||
// Project: https://github.com/Stamplay/stamplay-js-sdk
|
||||
// Definitions by: Riderman de Sousa Barbosa <https://github.com/ridermansb/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="..\promises-a-plus\promises-a-plus.d.ts"/>
|
||||
|
||||
declare module Stamplay {
|
||||
|
||||
export interface IStamplayModel {
|
||||
signup({}) : PromisesAPlus.Thenable<any>
|
||||
new() : IStamplayModel
|
||||
get(property : string) : any
|
||||
set(property : string, value: any) : void
|
||||
unset(property : string) : void
|
||||
fetch(id : any) : PromisesAPlus.Thenable<any>
|
||||
destroy() : PromisesAPlus.Thenable<any>
|
||||
save({}?) : PromisesAPlus.Thenable<any>
|
||||
upVote() : PromisesAPlus.Thenable<any>
|
||||
}
|
||||
|
||||
export interface IStamplayObject {
|
||||
Model : IStamplayModel
|
||||
Collection : any
|
||||
|
||||
}
|
||||
|
||||
export interface StamplayStatic {
|
||||
User() : IStamplayObject
|
||||
Cobject(object : string) : IStamplayObject
|
||||
}
|
||||
}
|
||||
|
||||
declare var Stamplay: Stamplay.StamplayStatic;
|
||||
|
||||
declare module "Stamplay" {
|
||||
export = Stamplay;
|
||||
}
|
||||
Vendored
+1105
-1037
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -42,7 +42,7 @@ declare module JQueryTooltipster {
|
||||
* If the content of the tooltip is provided as a string, it is displayed as plain text by default.
|
||||
* If this content should actually be interpreted as HTML, set this option to true. Default: false
|
||||
*/
|
||||
contentAsHTML?: string;
|
||||
contentAsHTML?: boolean;
|
||||
|
||||
/**
|
||||
* If you provide a jQuery object to the 'content' option, this sets if it is a clone of this object that should actually be used. Default: true
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/// <reference path="undertaker.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
var fs = require('fs');
|
||||
var Undertaker = require('undertaker');
|
||||
import { Registry } from 'undertaker';
|
||||
require('es6-promise');
|
||||
|
||||
var taker = new Undertaker();
|
||||
|
||||
taker.task('task1', function(cb: () => void){
|
||||
// do things
|
||||
|
||||
cb(); // when everything is done
|
||||
});
|
||||
|
||||
taker.task('task2', function(){
|
||||
return fs.createReadStream('./myFile.js')
|
||||
.pipe(fs.createWriteStream('./myFile.copy.js'));
|
||||
});
|
||||
|
||||
taker.task('task3', function(){
|
||||
return new Promise(function(resolve, reject){
|
||||
// do things
|
||||
|
||||
resolve(); // when everything is done
|
||||
});
|
||||
});
|
||||
|
||||
taker.task('combined', taker.series('task1', 'task2'));
|
||||
|
||||
taker.task('all', taker.parallel('combined', 'task3'));
|
||||
|
||||
var registry: Registry;
|
||||
function CommonRegistry(options: { buildDir: string }): Registry {
|
||||
return registry;
|
||||
}
|
||||
|
||||
var taker = new Undertaker(CommonRegistry({ buildDir: '/dist' }));
|
||||
|
||||
taker.task('build', taker.series('clean', function build(cb: () => void) {
|
||||
// do things
|
||||
cb();
|
||||
}));
|
||||
|
||||
Vendored
+117
@@ -0,0 +1,117 @@
|
||||
// Type definitions for undertaker 0.12.0
|
||||
// Project: https://github.com/phated/undertaker
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "undertaker" {
|
||||
|
||||
export interface UndertakerStatic {
|
||||
new(registry?: Registry): Undertaker;
|
||||
}
|
||||
|
||||
export interface Undertaker {
|
||||
task: TaskMethod;
|
||||
/**
|
||||
* Takes a variable amount of strings (taskName) and/or functions (fn)
|
||||
* and returns a function of the composed tasks or functions.
|
||||
* Any taskNames are retrieved from the registry using the get method.
|
||||
*
|
||||
* When the returned function is executed, the tasks or functions will be executed in series,
|
||||
* each waiting for the prior to finish. If an error occurs, execution will stop.
|
||||
* @param task
|
||||
*/
|
||||
series(...tasks: (string|Task)[]): Task;
|
||||
/**
|
||||
* Takes a variable amount of strings (taskName) and/or functions (fn)
|
||||
* and returns a function of the composed tasks or functions.
|
||||
* Any taskNames are retrieved from the registry using the get method.
|
||||
*
|
||||
* When the returned function is executed, the tasks or functions will be executed in parallel,
|
||||
* all being executed at the same time. If an error occurs, all execution will complete.
|
||||
* @param tasks
|
||||
*/
|
||||
parallel(...tasks: (string|Task)[]): Task;
|
||||
/**
|
||||
* Returns the current registry object.
|
||||
*/
|
||||
registry(): Registry;
|
||||
/**
|
||||
* The tasks from the current registry will be transferred to it
|
||||
* and the current registry will be replaced with the new registry.
|
||||
* @param registry
|
||||
*/
|
||||
registry(registry: Registry): void;
|
||||
/**
|
||||
* Optionally takes an object (options) and returns an object representing the tree of registered tasks.
|
||||
* @param options
|
||||
*/
|
||||
tree(options?: { deep?: boolean }): Node[]|string[];
|
||||
/**
|
||||
* Takes a string or function (task) and returns a timestamp of the last time the task was run successfully.
|
||||
* The time will be the time the task started. Returns undefined if the task has not been run.
|
||||
* @param task
|
||||
* @param timeResolution
|
||||
*/
|
||||
lastRun(task: string, timeResolution?: number): number;
|
||||
}
|
||||
|
||||
export interface Task {
|
||||
(cb?: Function): any;
|
||||
}
|
||||
|
||||
export interface TaskMethod {
|
||||
/**
|
||||
* Returns the registered function.
|
||||
* @param taskName
|
||||
*/
|
||||
(taskName: string): Task;
|
||||
/**
|
||||
* Register the task by the taskName.
|
||||
* @param taskName
|
||||
* @param fn
|
||||
*/
|
||||
(taskName: string, fn: Task): void;
|
||||
/**
|
||||
* Register the task by the name property of the function.
|
||||
* @param fn
|
||||
*/
|
||||
(fn: Task): void;
|
||||
/**
|
||||
* Register the task by the displayName property of the function.
|
||||
* @param fn
|
||||
*/
|
||||
(fn: Task & { displayName: string }): void;
|
||||
}
|
||||
|
||||
export interface Registry {
|
||||
/**
|
||||
* receives the undertaker instance to set pre-defined tasks using the task(taskName, fn) method.
|
||||
* @param taker
|
||||
*/
|
||||
init(taker: Undertaker): void;
|
||||
/**
|
||||
* returns the task with that name or undefined if no task is registered with that name.
|
||||
* @param taskName
|
||||
*/
|
||||
get(taskName: string): Task;
|
||||
/**
|
||||
* add task to the registry. If set modifies a task, it should return the new task.
|
||||
* @param taskName
|
||||
* @param fn
|
||||
*/
|
||||
set(taskName: string, fn: Task): void;
|
||||
/**
|
||||
* returns an object listing all tasks in the registry.
|
||||
*/
|
||||
tasks(): { [taskName: string]: Task };
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
label: string;
|
||||
type: string;
|
||||
nodes: Node[];
|
||||
}
|
||||
|
||||
export default UndertakerStatic;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/// <reference path="urbanairship-cordova.d.ts" />
|
||||
|
||||
//#region Basic Example taken from http://docs.urbanairship.com/platform/phonegap.html#actions
|
||||
|
||||
// Register for any Urban Airship events
|
||||
document.addEventListener("urbanairship.registration", function (event: UrbanAirshipPlugin.RegistrationEvent) {
|
||||
if (event.error) {
|
||||
console.log("There was an error registering for push notifications");
|
||||
} else {
|
||||
console.log("Registered with channel ID: " + event.channelID);
|
||||
console.log("Registered with device token: " + event.deviceToken);
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("urbanairship.push", function (event: UrbanAirshipPlugin.PushEvent) {
|
||||
console.log("Incoming push: " + event.message);
|
||||
});
|
||||
|
||||
// Set tags on a device, that you can push to
|
||||
UAirship.setTags(["loves_cats", "shops_for_games"], function () {
|
||||
UAirship.getTags(function (tags: string[]) {
|
||||
tags.forEach(function (tag: string) {
|
||||
console.log("Tag: " + tag);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Set an alias, this lets you tie a device to a user in your system
|
||||
UAirship.setAlias("awesomeuser22", function () {
|
||||
UAirship.getAlias(function (alias: string) {
|
||||
console.log("The user formerly known as " + alias);
|
||||
});
|
||||
});
|
||||
|
||||
// Enable user notifications (will prompt the user to accept push notifications)
|
||||
UAirship.setUserNotificationsEnabled(true, function (status: string) {
|
||||
console.log("User notifications are enabled! Fire away!");
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Method signatures and parameter types
|
||||
|
||||
UAirship.setUserNotificationsEnabled(true, (status: string) => {});
|
||||
UAirship.isUserNotificationsEnabled((enabled: boolean) => {});
|
||||
UAirship.getChannelID((id: string) => {});
|
||||
|
||||
UAirship.getLaunchNotification(true, (push: UrbanAirshipPlugin.PushEvent) => {
|
||||
var message: string = push.message;
|
||||
var extras: { [key: string]: any; } = push.extras;
|
||||
});
|
||||
|
||||
UAirship.setQuietTimeEnabled(true, () => {});
|
||||
UAirship.isQuietTimeEnabled((enabled: boolean) => {});
|
||||
UAirship.setQuietTime(1, 1, 1, 1, () => {});
|
||||
UAirship.getQuietTime((quietTime: UrbanAirshipPlugin.QuietTimeTimeSpan) => {});
|
||||
UAirship.isInQuietTime((inQuietTime: boolean) => {});
|
||||
|
||||
UAirship.setNotificationTypes(UAirship.notificationType.sound, () => {});
|
||||
UAirship.setNotificationTypes(UAirship.notificationType.alert, () => {});
|
||||
UAirship.setNotificationTypes(UAirship.notificationType.badge, () => {});
|
||||
UAirship.setNotificationTypes(UAirship.notificationType.sound | UAirship.notificationType.badge, () => {});
|
||||
|
||||
UAirship.setAutobadgeEnabled(true, () => {});
|
||||
UAirship.setBadgeNumber(1, () => {});
|
||||
UAirship.getBadgeNumber((badgeNumber: number) => {});
|
||||
UAirship.resetBadge(() => {});
|
||||
UAirship.clearNotifications(() => {});
|
||||
UAirship.setSoundEnabled(true, () => {});
|
||||
UAirship.isSoundEnabled((enabled: boolean) => { var isEnabled: boolean = enabled; });
|
||||
UAirship.setVibrateEnabled(true, () => {});
|
||||
UAirship.isVibrateEnabled((enabled: boolean) => { var isEnabled: boolean = enabled; });
|
||||
UAirship.setTags(["a", "b", "c"], () => {});
|
||||
UAirship.getTags((tags: string[]) => { var results: string[] = tags; });
|
||||
UAirship.setAlias("a", () => {});
|
||||
UAirship.getAlias((alias: string) => { var result: string = alias; })
|
||||
UAirship.setNamedUser("a", () => {});
|
||||
UAirship.getNamedUser((namedUserId: string) => { var result: string = namedUserId; });
|
||||
|
||||
UAirship.editNamedUserTagGroups()
|
||||
.addTags("loyalty", ["platinum-member", "gold-member"])
|
||||
.removeTags("loyalty", ["silver-member", "bronze-member"])
|
||||
.apply();
|
||||
|
||||
UAirship.editChannelTagGroups()
|
||||
.addTags("loyalty", ["platinum-member", "gold-member"])
|
||||
.removeTags("loyalty", ["silver-member", "bronze-member"])
|
||||
.apply();
|
||||
|
||||
UAirship.setAnalyticsEnabled(true, () => {});
|
||||
UAirship.isAnalyticsEnabled((enabled: boolean) => { var result: boolean = enabled; });
|
||||
|
||||
UAirship.runAction("a", "b", (result: UrbanAirshipPlugin.RunActionResult) => {
|
||||
var error: string = result.error;
|
||||
var value: any = result.value;
|
||||
});
|
||||
|
||||
UAirship.setLocationEnabled(true, () => {});
|
||||
UAirship.isLocationEnabled((enabled: boolean) => { var result: boolean = enabled; });
|
||||
UAirship.setBackgroundLocationEnabled(true, () => {});
|
||||
UAirship.isBackgroundLocationEnabled(() => {});
|
||||
UAirship.recordCurrentLocation(() => {});
|
||||
|
||||
//#endregion
|
||||
+477
@@ -0,0 +1,477 @@
|
||||
// Type definitions for phonegap-ua-push 3.4.1
|
||||
// Project: https://github.com/urbanairship/phonegap-ua-push
|
||||
// Definitions by: Justin Unterreiner <https://github.com/Justin-Credible>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
//#region API Types
|
||||
|
||||
/**
|
||||
* This is a wrapper "namespace" for the various types used by the UAirship module.
|
||||
*/
|
||||
declare module UrbanAirshipPlugin {
|
||||
|
||||
//#region API Definitions
|
||||
|
||||
interface UrbanAirshipStatic {
|
||||
|
||||
/**
|
||||
* The enumeration values for use with setNotificationTypes().
|
||||
*/
|
||||
notificationType: {
|
||||
none: number;
|
||||
badge: number;
|
||||
sound: number;
|
||||
alert: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables user notifications on the device.
|
||||
* This will prompt users to opt-in to notifications on iOS.
|
||||
*
|
||||
* @param enabled Set to true to enable notifications, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setUserNotificationsEnabled(enabled: boolean, callback: (status: string) => void): void;
|
||||
|
||||
/**
|
||||
* Checks if user notifications are enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isUserNotificationsEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Get the push identifier for the device. The channel ID is used to send
|
||||
* messages to the device for testing, and is the canonical identifier for
|
||||
* the device in Urban Airship.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getChannelID(callback: (id: string) => void): void;
|
||||
|
||||
/**
|
||||
* Returns the push message object that contains the data associated with a
|
||||
* push notification. The extras dictionary can contain arbitrary key/value
|
||||
* data that you use in your application.
|
||||
*
|
||||
* @param clear Set to true to clear the notification.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getLaunchNotification(clear: boolean, callback: (push: UrbanAirshipPlugin.PushEvent) => void): void;
|
||||
|
||||
/**
|
||||
* Enables or disables quiet time.
|
||||
*
|
||||
* @param enabled Set to true to enable quiet time, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setQuietTimeEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Checks if quiet time is enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isQuietTimeEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Set the quiet time for the device.
|
||||
*
|
||||
* @param startHour The start hour for quiet time.
|
||||
* @param startMinute The start minute for quiet time.
|
||||
* @param endHour The end hour for quiet time.
|
||||
* @param endMinute the end minute for quiet time.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setQuietTime(startHour: number, startMinute: number, endHour: number, endMinute: number, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Get the current quiet time. The quietTime object represents a timespan
|
||||
* during which notifications should be silenced. The typical use case is
|
||||
* to expose a preference to your users so that they can enable this setting
|
||||
* and specify an interval during which they do not wish to be disturbed.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getQuietTime(callback: (quietTime: UrbanAirshipPlugin.QuietTimeTimeSpan) => void): void;
|
||||
|
||||
/**
|
||||
* Checks if quiet time is currently in effect.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isInQuietTime(callback: (inQuietTime: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* (iOS Only)
|
||||
*
|
||||
* On iOS, registration for push requires specifying what
|
||||
* combination of badges, sound and alerts are desired. This function
|
||||
* must be explicitly called in order to begin the registration process.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* UAirship.setNotificationTypes(UAirship.notificationType.sound |
|
||||
* UAirship.notificationType.alert);
|
||||
*
|
||||
* @param bitmask The notification types to set.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setNotificationTypes(bitmask: number, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (iOS Only)
|
||||
*
|
||||
* Set whether the UA Autobadge feature is enabled.
|
||||
*
|
||||
* @param enabled Set to true to enable Autobadge, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setAutobadgeEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (iOS Only)
|
||||
*
|
||||
* Set the current application badge number.
|
||||
*
|
||||
* @param badge The number to use for the badge.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setBadgeNumber(badge: number, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (iOS Only)
|
||||
*
|
||||
* Gets the current application badge number.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getBadgeNumber(callback: (badgeNumber: number) => void): void;
|
||||
|
||||
/**
|
||||
* (iOS Only)
|
||||
*
|
||||
* Reset the badge number to zero.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
resetBadge(callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (Android Only)
|
||||
*
|
||||
* Clears the notifications posted by the application.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
clearNotifications(callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (Android only, iOS sound settings come in the push)
|
||||
*
|
||||
* Set whether the device makes sound on push.
|
||||
*
|
||||
* @param enabled Set to true to enable sound, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setSoundEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (Android Only)
|
||||
*
|
||||
* Checks if sound is enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isSoundEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* (Android Only)
|
||||
*
|
||||
* Set whether the device vibrates on push.
|
||||
*
|
||||
* @param enabled Set to true to enable vibration, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setVibrateEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* (Android Only)
|
||||
*
|
||||
* Checks if vibration is enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isVibrateEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Sets tags for the device.
|
||||
*
|
||||
* @param tags An array of tags.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setTags(tags: string[], callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Returns the tags for the device.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getTags(callback: (tags: string[]) => void): void;
|
||||
|
||||
/**
|
||||
* Set alias for the device.
|
||||
*
|
||||
* @param alias The alias to set for this device.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setAlias(alias: string, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Gets the alias for this device.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getAlias(callback: (alias: string) => void): void;
|
||||
|
||||
/**
|
||||
* Set the named user ID for this device.
|
||||
*
|
||||
* @param namedUser The named user ID.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setNamedUser(namedUserId: string, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Gets the named user ID for this device.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
getNamedUser(callback: (namedUserId: string) => void): void;
|
||||
|
||||
/**
|
||||
* Fluent API to edit the named user tag groups by adding or removing
|
||||
* tags, then applying the changes.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* UAirship.editNamedUserTagGroups()
|
||||
* .addTags("loyalty", ["platinum-member", "gold-member"])
|
||||
* .removeTags("loyalty", ["silver-member", "bronze-member"])
|
||||
* .apply()
|
||||
*
|
||||
* @returns The chainable API instance.
|
||||
*/
|
||||
editNamedUserTagGroups(): UrbanAirshipPlugin.EditNamedUserTagGroupsApi;
|
||||
|
||||
/**
|
||||
* Fluent API to edit the channel tag groups by adding or removing tags,
|
||||
* then applying the changes.
|
||||
*
|
||||
* For exmaple:
|
||||
*
|
||||
* UAirship.editChannelTagGroups()
|
||||
* .addTags("loyalty", ["platinum-member", "gold-member"])
|
||||
* .removeTags("loyalty", ["silver-member", "bronze-member"])
|
||||
* .apply()
|
||||
*/
|
||||
editChannelTagGroups(): UrbanAirshipPlugin.EditChannelTagGroupsApi;
|
||||
|
||||
/**
|
||||
* Enables or disables analytics. Disabling analytics will delete any
|
||||
* locally stored events and prevent any events from uploading. Features
|
||||
* that depend on analytics being enabled may not work properly if it’s
|
||||
* disabled (reports, region triggers, location segmentation, push to
|
||||
* local time).
|
||||
*
|
||||
* @param enabled Set to true to enable analytics, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setAnalyticsEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Checks if analytics is enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isAnalyticsEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Runs an Urban Airship action.
|
||||
*
|
||||
* @param actionName The name of the action to run.
|
||||
* @param actionValue The value for the action.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
runAction(actionName: string, actionValue: string, callback: (result: UrbanAirshipPlugin.RunActionResult) => void): void;
|
||||
|
||||
/**
|
||||
* Enables or disables Urban Airship location services on the device.
|
||||
*
|
||||
* @param enabled Set to true to enable location, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setLocationEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Checks if location is enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isLocationEnabled(callback: (enabled: boolean) => void): void;
|
||||
|
||||
/**
|
||||
* Enables or disables background location on the device.
|
||||
*
|
||||
* @param enabled Set to true to enable background location, false to disable.
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
setBackgroundLocationEnabled(enabled: boolean, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Checks if background location updates are enabled or not.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
isBackgroundLocationEnabled(callback: () => void): void;
|
||||
|
||||
/**
|
||||
* Records the current location of the device.
|
||||
*
|
||||
* @param callback The function to call on completion.
|
||||
*/
|
||||
recordCurrentLocation(callback: () => void): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the chainable API object returned by editNamedUserTagGroups().
|
||||
*/
|
||||
interface EditNamedUserTagGroupsApi {
|
||||
|
||||
/**
|
||||
* Used to add the given tags to the given tag group.
|
||||
*
|
||||
* @param tagGroup The tag group to add tags to.
|
||||
* @param tags The tags to add to the group.
|
||||
*
|
||||
* @returns The chainable API instance.
|
||||
*/
|
||||
addTags: (tagGroup: string, tags: string[]) => EditNamedUserTagGroupsApi;
|
||||
|
||||
/**
|
||||
* Used to remove the given tags from the given tag group.
|
||||
*
|
||||
* @param tagGroup The tag group to remove tags from.
|
||||
* @param tags The tags to remove from the group.
|
||||
*
|
||||
* @returns The chainable API instance.
|
||||
*/
|
||||
removeTags: (tagGroup: string, tags: string[]) => EditNamedUserTagGroupsApi;
|
||||
|
||||
/**
|
||||
* Used to apply the changes from the chained API call.
|
||||
*
|
||||
* @param callback The optional function to call on completion.
|
||||
*/
|
||||
apply: (callback?: () => void) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes the chainable API object returned by editChannelTagGroups().
|
||||
*/
|
||||
interface EditChannelTagGroupsApi {
|
||||
|
||||
/**
|
||||
* Used to add the given tags to the given tag group.
|
||||
*
|
||||
* @param tagGroup The tag group to add tags to.
|
||||
* @param tags The tags to add to the group.
|
||||
*
|
||||
* @returns The chainable API instance.
|
||||
*/
|
||||
addTags: (tagGroup: string, tags: string[]) => EditChannelTagGroupsApi;
|
||||
|
||||
/**
|
||||
* Used to remove the given tags from the given tag group.
|
||||
*
|
||||
* @param tagGroup The tag group to remove tags from.
|
||||
* @param tags The tags to remove from the group.
|
||||
*
|
||||
* @returns The chainable API instance.
|
||||
*/
|
||||
removeTags: (tagGroup: string, tags: string[]) => EditChannelTagGroupsApi;
|
||||
|
||||
/**
|
||||
* Used to apply the changes from the chained API call.
|
||||
*
|
||||
* @param callback The optional function to call on completion.
|
||||
*/
|
||||
apply: (callback?: () => void) => void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Data Types
|
||||
|
||||
interface PushEvent extends Event {
|
||||
message: string;
|
||||
extras: { [key: string]: any };
|
||||
}
|
||||
|
||||
interface RegistrationEvent extends Event {
|
||||
|
||||
error: string;
|
||||
|
||||
/**
|
||||
* The channel ID for the device.
|
||||
*/
|
||||
channelID: string;
|
||||
|
||||
/**
|
||||
* (iOS Only)
|
||||
*
|
||||
* The push token for the device.
|
||||
*/
|
||||
deviceToken: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a timespan during which notifications should be silenced.
|
||||
*
|
||||
* For example, 10PM - 6AM would be:
|
||||
* { startHour: 22, startMinute: 0, endHour: 6, endMinute: 0 }
|
||||
*/
|
||||
interface QuietTimeTimeSpan {
|
||||
startHour: number,
|
||||
startMinute: number,
|
||||
endHour: number,
|
||||
endMinute: number
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of the runAction() call.
|
||||
*/
|
||||
interface RunActionResult {
|
||||
error: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region UAirship Global Variable Declaration
|
||||
|
||||
declare var UAirship: UrbanAirshipPlugin.UrbanAirshipStatic;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Additional Document Events
|
||||
|
||||
interface Document {
|
||||
addEventListener(type: "urbanairship.push", listener: (ev: UrbanAirshipPlugin.PushEvent) => void, useCapture?: boolean): void;
|
||||
addEventListener(type: "urbanairship.registration", listener: (ev: UrbanAirshipPlugin.RegistrationEvent) => void, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
@@ -0,0 +1,626 @@
|
||||
/// <reference path="webcl.d.ts" />
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
class CLHException {
|
||||
constructor(
|
||||
public message: string
|
||||
) { }
|
||||
}
|
||||
|
||||
class PlatformInfo {
|
||||
EXTENTION: string;
|
||||
NAME: string;
|
||||
PROFILE: string;
|
||||
VENDOR: string;
|
||||
VERSION: string;
|
||||
|
||||
constructor(
|
||||
public platform: WEBCL.WebCLPlatform,
|
||||
public deviceInfos: DeviceInfo[]= new Array<DeviceInfo>()
|
||||
) {
|
||||
this.PROFILE = platform.getInfo(WEBCL.PlatformInfo.PLATFORM_PROFILE);
|
||||
this.VERSION = platform.getInfo(WEBCL.PlatformInfo.PLATFORM_VERSION);
|
||||
this.NAME = platform.getInfo(WEBCL.PlatformInfo.PLATFORM_NAME);
|
||||
this.VENDOR = platform.getInfo(WEBCL.PlatformInfo.PLATFORM_VENDOR);
|
||||
this.EXTENTION = platform.getInfo(WEBCL.PlatformInfo.PLATFORM_EXTENSIONS);
|
||||
}
|
||||
}
|
||||
|
||||
class DeviceInfo {
|
||||
ADDRESS_BITS: number;
|
||||
AVAILABLE: boolean;
|
||||
COMPILER_AVAILABLE: boolean;
|
||||
DRIVER_VERSION: string;
|
||||
ENDIAN_LITTLE: boolean;
|
||||
ERROR_CORRECTION_SUPPORT: boolean;
|
||||
EXECUTION_CAPABILITIES: WEBCL.DeviceExecCapabilitiesBits;
|
||||
EXTENSIONS: string;
|
||||
GLOBAL_MEM_CACHE_SIZE: number;
|
||||
GLOBAL_MEM_CACHE_TYPE: WEBCL.DeviceMemCacheType;
|
||||
GLOBAL_MEM_CACHELINE_SIZE: number;
|
||||
GLOBAL_MEM_SIZE: number;
|
||||
HOST_UNIFIED_MEMORY: boolean;
|
||||
IMAGE_SUPPORT: boolean;
|
||||
IMAGE2D_MAX_HEIGHT: number;
|
||||
IMAGE2D_MAX_WIDTH: number;
|
||||
IMAGE3D_MAX_DEPTH: number;
|
||||
IMAGE3D_MAX_HEIGHT: number;
|
||||
IMAGE3D_MAX_WIDTH: number;
|
||||
LOCAL_MEM_SIZE: number;
|
||||
LOCAL_MEM_TYPE: WEBCL.DeviceLocalMemType;
|
||||
MAX_CLOCK_FREQUENCY: number;
|
||||
MAX_COMPUTE_UNITS: number;
|
||||
MAX_CONSTANT_ARGS: number;
|
||||
MAX_CONSTANT_BUFFER_SIZE: number;
|
||||
MAX_MEM_ALLOC_SIZE: number;
|
||||
MAX_PARAMETER_SIZE: number;
|
||||
MAX_READ_IMAGE_ARGS: number;
|
||||
MAX_SAMPLERS: number;
|
||||
MAX_WORK_GROUP_SIZE: number;
|
||||
MAX_WORK_ITEM_DIMENSIONS: number;
|
||||
MAX_WORK_ITEM_SIZES: number;
|
||||
MAX_WRITE_IMAGE_ARGS: number;
|
||||
MEM_BASE_ADDR_ALIGN: number;
|
||||
NAME: string;
|
||||
NATIVE_VECTOR_WIDTH_CHAR: number;
|
||||
NATIVE_VECTOR_WIDTH_FLOAT: number;
|
||||
NATIVE_VECTOR_WIDTH_INT: number;
|
||||
NATIVE_VECTOR_WIDTH_LONG: number;
|
||||
NATIVE_VECTOR_WIDTH_SHORT: number;
|
||||
OPENCL_C_VERSION: string;
|
||||
PLATFORM: WEBCL.WebCLPlatform;
|
||||
PlatformInfo: PlatformInfo;
|
||||
PREFERRED_VECTOR_WIDTH_CHAR: number;
|
||||
PREFERRED_VECTOR_WIDTH_FLOAT: number;
|
||||
PREFERRED_VECTOR_WIDTH_INT: number;
|
||||
PREFERRED_VECTOR_WIDTH_LONG: number;
|
||||
PREFERRED_VECTOR_WIDTH_SHORT: number;
|
||||
PROFILE: string;
|
||||
PROFILING_TIMER_RESOLUTION: number;
|
||||
QUEUE_PROPERTIES: WEBCL.CommandQueueProperties;
|
||||
SINGLE_FP_CONFIG: WEBCL.DeviceFPConfigBits;
|
||||
TYPE: WEBCL.DeviceTypeBits;
|
||||
VENDOR: string;
|
||||
VENDOR_ID: number;
|
||||
VERSION: string;
|
||||
|
||||
constructor(public device: WEBCL.WebCLDevice, platformInfo: PlatformInfo) {
|
||||
this.ADDRESS_BITS = device.getInfo(WEBCL.DeviceInfo.DEVICE_ADDRESS_BITS);
|
||||
this.AVAILABLE = device.getInfo(WEBCL.DeviceInfo.DEVICE_AVAILABLE);
|
||||
this.COMPILER_AVAILABLE = device.getInfo(WEBCL.DeviceInfo.DEVICE_COMPILER_AVAILABLE);
|
||||
this.DRIVER_VERSION = device.getInfo(WEBCL.DeviceInfo.DRIVER_VERSION);
|
||||
this.ENDIAN_LITTLE = device.getInfo(WEBCL.DeviceInfo.DEVICE_ENDIAN_LITTLE);
|
||||
this.ERROR_CORRECTION_SUPPORT = device.getInfo(WEBCL.DeviceInfo.DEVICE_ERROR_CORRECTION_SUPPORT);
|
||||
this.EXECUTION_CAPABILITIES = device.getInfo(WEBCL.DeviceInfo.DEVICE_EXECUTION_CAPABILITIES);
|
||||
this.EXTENSIONS = device.getInfo(WEBCL.DeviceInfo.DEVICE_EXTENSIONS);
|
||||
this.GLOBAL_MEM_CACHE_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_GLOBAL_MEM_CACHE_SIZE);
|
||||
this.GLOBAL_MEM_CACHE_TYPE = device.getInfo(WEBCL.DeviceInfo.DEVICE_GLOBAL_MEM_CACHE_TYPE);
|
||||
this.GLOBAL_MEM_CACHELINE_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_GLOBAL_MEM_CACHELINE_SIZE);
|
||||
this.GLOBAL_MEM_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_GLOBAL_MEM_SIZE);
|
||||
this.HOST_UNIFIED_MEMORY = device.getInfo(WEBCL.DeviceInfo.DEVICE_HOST_UNIFIED_MEMORY);
|
||||
this.IMAGE_SUPPORT = device.getInfo(WEBCL.DeviceInfo.DEVICE_IMAGE_SUPPORT);
|
||||
this.IMAGE2D_MAX_HEIGHT = device.getInfo(WEBCL.DeviceInfo.DEVICE_IMAGE2D_MAX_HEIGHT);
|
||||
this.IMAGE2D_MAX_WIDTH = device.getInfo(WEBCL.DeviceInfo.DEVICE_IMAGE2D_MAX_WIDTH);
|
||||
this.IMAGE3D_MAX_DEPTH = device.getInfo(WEBCL.DeviceInfo.DEVICE_IMAGE3D_MAX_DEPTH);
|
||||
this.IMAGE3D_MAX_HEIGHT = device.getInfo(WEBCL.DeviceInfo.DEVICE_IMAGE3D_MAX_HEIGHT);
|
||||
this.IMAGE3D_MAX_WIDTH = device.getInfo(WEBCL.DeviceInfo.DEVICE_IMAGE3D_MAX_WIDTH);
|
||||
this.LOCAL_MEM_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_LOCAL_MEM_SIZE);
|
||||
this.LOCAL_MEM_TYPE = device.getInfo(WEBCL.DeviceInfo.DEVICE_LOCAL_MEM_TYPE);
|
||||
this.MAX_CLOCK_FREQUENCY = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_CLOCK_FREQUENCY);
|
||||
this.MAX_COMPUTE_UNITS = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_COMPUTE_UNITS);
|
||||
this.MAX_CONSTANT_ARGS = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_CONSTANT_ARGS);
|
||||
this.MAX_CONSTANT_BUFFER_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_CONSTANT_BUFFER_SIZE);
|
||||
this.MAX_MEM_ALLOC_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_MEM_ALLOC_SIZE);
|
||||
this.MAX_PARAMETER_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_PARAMETER_SIZE);
|
||||
this.MAX_READ_IMAGE_ARGS = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_READ_IMAGE_ARGS);
|
||||
this.MAX_SAMPLERS = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_SAMPLERS);
|
||||
this.MAX_WORK_GROUP_SIZE = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_WORK_GROUP_SIZE);
|
||||
this.MAX_WORK_ITEM_DIMENSIONS = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_WORK_ITEM_DIMENSIONS);
|
||||
this.MAX_WORK_ITEM_SIZES = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_WORK_ITEM_SIZES);
|
||||
this.MAX_WRITE_IMAGE_ARGS = device.getInfo(WEBCL.DeviceInfo.DEVICE_MAX_WRITE_IMAGE_ARGS);
|
||||
this.MEM_BASE_ADDR_ALIGN = device.getInfo(WEBCL.DeviceInfo.DEVICE_MEM_BASE_ADDR_ALIGN);
|
||||
this.NAME = device.getInfo(WEBCL.DeviceInfo.DEVICE_NAME);
|
||||
this.NATIVE_VECTOR_WIDTH_CHAR = device.getInfo(WEBCL.DeviceInfo.DEVICE_NATIVE_VECTOR_WIDTH_CHAR);
|
||||
this.NATIVE_VECTOR_WIDTH_FLOAT = device.getInfo(WEBCL.DeviceInfo.DEVICE_NATIVE_VECTOR_WIDTH_FLOAT);
|
||||
this.NATIVE_VECTOR_WIDTH_INT = device.getInfo(WEBCL.DeviceInfo.DEVICE_NATIVE_VECTOR_WIDTH_INT);
|
||||
this.NATIVE_VECTOR_WIDTH_LONG = device.getInfo(WEBCL.DeviceInfo.DEVICE_NATIVE_VECTOR_WIDTH_LONG);
|
||||
this.NATIVE_VECTOR_WIDTH_SHORT = device.getInfo(WEBCL.DeviceInfo.DEVICE_NATIVE_VECTOR_WIDTH_SHORT);
|
||||
this.OPENCL_C_VERSION = device.getInfo(WEBCL.DeviceInfo.DEVICE_OPENCL_C_VERSION);
|
||||
this.PLATFORM = device.getInfo(WEBCL.DeviceInfo.DEVICE_PLATFORM);
|
||||
this.PlatformInfo = platformInfo;
|
||||
this.PREFERRED_VECTOR_WIDTH_CHAR = device.getInfo(WEBCL.DeviceInfo.DEVICE_PREFERRED_VECTOR_WIDTH_CHAR);
|
||||
this.PREFERRED_VECTOR_WIDTH_FLOAT = device.getInfo(WEBCL.DeviceInfo.DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT);
|
||||
this.PREFERRED_VECTOR_WIDTH_INT = device.getInfo(WEBCL.DeviceInfo.DEVICE_PREFERRED_VECTOR_WIDTH_INT);
|
||||
this.PREFERRED_VECTOR_WIDTH_LONG = device.getInfo(WEBCL.DeviceInfo.DEVICE_PREFERRED_VECTOR_WIDTH_LONG);
|
||||
this.PREFERRED_VECTOR_WIDTH_SHORT = device.getInfo(WEBCL.DeviceInfo.DEVICE_PREFERRED_VECTOR_WIDTH_SHORT);
|
||||
this.PROFILE = device.getInfo(WEBCL.DeviceInfo.DEVICE_PROFILE);
|
||||
this.PROFILING_TIMER_RESOLUTION = device.getInfo(WEBCL.DeviceInfo.DEVICE_PROFILING_TIMER_RESOLUTION);
|
||||
this.QUEUE_PROPERTIES = device.getInfo(WEBCL.DeviceInfo.DEVICE_QUEUE_PROPERTIES);
|
||||
this.SINGLE_FP_CONFIG = device.getInfo(WEBCL.DeviceInfo.DEVICE_SINGLE_FP_CONFIG);
|
||||
this.TYPE = device.getInfo(WEBCL.DeviceInfo.DEVICE_TYPE);
|
||||
this.VENDOR = device.getInfo(WEBCL.DeviceInfo.DEVICE_VENDOR);
|
||||
this.VENDOR_ID = device.getInfo(WEBCL.DeviceInfo.DEVICE_VENDOR_ID);
|
||||
this.VERSION = device.getInfo(WEBCL.DeviceInfo.DEVICE_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
class ContextInfo {
|
||||
DEVICES: WEBCL.WebCLDevice[];
|
||||
|
||||
constructor(
|
||||
public context: WEBCL.WebCLContext
|
||||
) {
|
||||
this.DEVICES = context.getInfo(WEBCL.ContextInfo.CONTEXT_DEVICES);
|
||||
}
|
||||
}
|
||||
|
||||
class KernelWorkGroupInfo {
|
||||
KERNEL_COMPILE_WORK_GROUP_SIZE: number;
|
||||
KERNEL_LOCAL_MEM_SIZE: number;
|
||||
KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: number;
|
||||
KERNEL_PRIVATE_MEM_SIZE: number;
|
||||
KERNEL_WORK_GROUP_SIZE: number;
|
||||
|
||||
constructor(kernel: WEBCL.WebCLKernel, device: WEBCL.WebCLDevice) {
|
||||
this.KERNEL_COMPILE_WORK_GROUP_SIZE = kernel.getWorkGroupInfo(device, WEBCL.KernelWorkGroupInfo.KERNEL_COMPILE_WORK_GROUP_SIZE);
|
||||
this.KERNEL_LOCAL_MEM_SIZE = kernel.getWorkGroupInfo(device, WEBCL.KernelWorkGroupInfo.KERNEL_LOCAL_MEM_SIZE);
|
||||
this.KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = kernel.getWorkGroupInfo(device, WEBCL.KernelWorkGroupInfo.KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE);
|
||||
this.KERNEL_PRIVATE_MEM_SIZE = kernel.getWorkGroupInfo(device, WEBCL.KernelWorkGroupInfo.KERNEL_PRIVATE_MEM_SIZE);
|
||||
this.KERNEL_WORK_GROUP_SIZE = kernel.getWorkGroupInfo(device, WEBCL.KernelWorkGroupInfo.KERNEL_WORK_GROUP_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
class CommandQueueInfo {
|
||||
CONTEXT: WEBCL.WebCLContext;
|
||||
DEVICE: WEBCL.WebCLDevice;
|
||||
PROPERTIES: WEBCL.CommandQueueProperties;
|
||||
|
||||
constructor(
|
||||
public queue: WEBCL.WebCLCommandQueue
|
||||
) {
|
||||
this.CONTEXT = queue.getInfo(WEBCL.ContextProperties.QUEUE_CONTEXT);
|
||||
this.DEVICE = queue.getInfo(WEBCL.ContextProperties.QUEUE_DEVICE);
|
||||
this.PROPERTIES = queue.getInfo(WEBCL.ContextProperties.QUEUE_PROPERTIES);
|
||||
}
|
||||
}
|
||||
|
||||
class MemoryObjectInfo {
|
||||
TYPE: WEBCL.MemObjectType;
|
||||
FLAGS: WEBCL.MemFlagsBits;
|
||||
SIZE: number;
|
||||
CONTEXT: WEBCL.WebCLContext;
|
||||
ASSOCIATED_MEMOBJECT: WEBCL.WebCLBuffer;
|
||||
OFFSET: number;
|
||||
|
||||
constructor(
|
||||
public memoryObj: WEBCL.WebCLMemoryObject
|
||||
) {
|
||||
this.TYPE = memoryObj.getInfo(WEBCL.MemInfo.MEM_TYPE);
|
||||
this.FLAGS = memoryObj.getInfo(WEBCL.MemInfo.MEM_FLAGS);
|
||||
this.SIZE = memoryObj.getInfo(WEBCL.MemInfo.MEM_SIZE);
|
||||
this.CONTEXT = memoryObj.getInfo(WEBCL.MemInfo.MEM_CONTEXT);
|
||||
this.ASSOCIATED_MEMOBJECT = memoryObj.getInfo(WEBCL.MemInfo.MEM_ASSOCIATED_MEMOBJECT);
|
||||
this.OFFSET = memoryObj.getInfo(WEBCL.MemInfo.MEM_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
class DeviceContext {
|
||||
deviceInfo: DeviceInfo;
|
||||
context: WEBCL.WebCLContext;
|
||||
|
||||
constructor(public device?: WEBCL.WebCLDevice) {
|
||||
if (!device) {
|
||||
this.context = window.webcl.createContext();
|
||||
this.device = this.context.getInfo(WEBCL.ContextInfo.CONTEXT_DEVICES)[0]; // just use the first default device
|
||||
}
|
||||
else {
|
||||
this.context = window.webcl.createContext(device); // use the specified device
|
||||
}
|
||||
this.deviceInfo = new DeviceInfo(this.device, undefined); // save all the info about the device
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* just enough for kernel args that are one of the
|
||||
* UInt8Array, UInt16Array, etc. interfaces because they already the extra
|
||||
* members.
|
||||
* They will be used as
|
||||
* either WEBCLBuffers or ArrayBufferViews
|
||||
* TODO: How to handle WEBCLImages and WEBCLSamples
|
||||
*/
|
||||
interface KernelArgArrayBufferView extends ArrayBufferView {
|
||||
BYTES_PER_ELEMENT: number;
|
||||
length: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This holds the information for an argument
|
||||
* passed as a WEBCLBuffer.
|
||||
* This holds the original host buffer as a convenience if the
|
||||
* same buffer is used for multiple calls.
|
||||
* Multiple kernels can use the same arguments
|
||||
*/
|
||||
class ArgCLBuffer {
|
||||
public buffer: WEBCL.WebCLBuffer;
|
||||
|
||||
constructor(
|
||||
public helper: WebCLHelper,
|
||||
public hostArray: KernelArgArrayBufferView, // NOTE: this can just be a UInt8Array, UInt16Array, etc.
|
||||
public cpu2gpu: boolean,
|
||||
public gpu2cpu: boolean
|
||||
) {
|
||||
this.makeCLBuffer(this.helper.devContext); // make it as a buffer with the host array as the template
|
||||
}
|
||||
|
||||
makeCLBuffer(context: DeviceContext): void {
|
||||
var rwflag: WEBCL.MemFlagsBits;
|
||||
if (this.cpu2gpu) {
|
||||
if (this.gpu2cpu) {
|
||||
rwflag = WEBCL.MemFlagsBits.MEM_READ_WRITE;
|
||||
}
|
||||
else {
|
||||
rwflag = WEBCL.MemFlagsBits.MEM_READ_ONLY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rwflag = WEBCL.MemFlagsBits.MEM_WRITE_ONLY;
|
||||
}
|
||||
|
||||
this.buffer = context.context.createBuffer(rwflag, this.hostArray.length * this.hostArray.BYTES_PER_ELEMENT,
|
||||
this.hostArray); // make the CLBuffer for the host array
|
||||
}
|
||||
|
||||
queueGPU2CPU() {
|
||||
if (this.gpu2cpu) {
|
||||
this.helper.queue.enqueueReadBuffer(this.buffer, false, 0, this.hostArray.length * this.hostArray.BYTES_PER_ELEMENT,
|
||||
this.hostArray); // queue up a write from the host mem to the GPU mem
|
||||
}
|
||||
}
|
||||
|
||||
queueCPU2GPU() {
|
||||
if (this.cpu2gpu) {
|
||||
this.helper.queue.enqueueWriteBuffer(this.buffer, false, 0, this.hostArray.length * this.hostArray.BYTES_PER_ELEMENT,
|
||||
this.hostArray); // queue up a write from the host mem to the GPU mem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder for a single kernel
|
||||
*/
|
||||
class Kernel {
|
||||
argCount: number = 0;
|
||||
CLBuffers: ArgCLBuffer[] = []; // the read and write buffers for the kernel
|
||||
localWS: number[] = [];
|
||||
globalWS: number[] = [];
|
||||
bufferOffsets: number[] = [];
|
||||
clEvent: WEBCL.WebCLEvent;
|
||||
public executionTime: number;
|
||||
|
||||
constructor(
|
||||
public helper: WebCLHelper,
|
||||
public name: string,
|
||||
public kernel: WEBCL.WebCLKernel,
|
||||
public workGroupInfo?: KernelWorkGroupInfo
|
||||
) { }
|
||||
|
||||
addArg(arg: ArgCLBuffer): number;
|
||||
addArg(arg: ArrayBufferView): number;
|
||||
addArg(arg: number): number;
|
||||
addArg(value: any): number {
|
||||
if (typeof (value) === "number") { // integer values
|
||||
this.kernel.setArg(this.argCount, new Int32Array([<number>value]));
|
||||
} else if (value instanceof ArgCLBuffer) { // clBuffer
|
||||
this.kernel.setArg(this.argCount,(<ArgCLBuffer> value).buffer); // use the CLBuffer
|
||||
this.CLBuffers.push(<ArgCLBuffer> value); // add to buffer array
|
||||
} else { // all ArrayBufferView types
|
||||
this.kernel.setArg(this.argCount, value);
|
||||
}
|
||||
this.argCount += 1;
|
||||
return this.argCount - 1;
|
||||
}
|
||||
|
||||
replaceArg(argIdx: number, arg: ArgCLBuffer): void;
|
||||
replaceArg(argIdx: number, arg: number): void;
|
||||
replaceArg(argIdx: number, arg: ArrayBufferView): void;
|
||||
replaceArg(argIdx: number, value: any): void {
|
||||
if (typeof (value) === "number") {
|
||||
this.kernel.setArg(argIdx, new Uint32Array([<number>value]));
|
||||
} else if (value instanceof ArgCLBuffer) {
|
||||
this.kernel.setArg(argIdx, (<ArgCLBuffer> value).buffer); // use the CLBuffer
|
||||
this.CLBuffers[argIdx] = <ArgCLBuffer> value; // replace entry is buffer array
|
||||
}
|
||||
else {
|
||||
this.kernel.setArg(this.argCount, value);
|
||||
}
|
||||
}
|
||||
|
||||
setWorkSections(globalThreads: number[], localThreads?: number[], offsets?: number[]) {
|
||||
this.globalWS = globalThreads;
|
||||
|
||||
if (localThreads) {
|
||||
this.localWS = [];
|
||||
localThreads.forEach((count, index) => {
|
||||
this.localWS.push(count);
|
||||
this.globalWS[index] = Math.ceil(globalThreads[index] / count) * count;
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
this.localWS = undefined;
|
||||
}
|
||||
|
||||
if (offsets) {
|
||||
this.bufferOffsets = offsets;
|
||||
}
|
||||
else {
|
||||
this.bufferOffsets = [];
|
||||
globalThreads.forEach(() => {
|
||||
this.bufferOffsets.push(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the transfers from CPU to GPU memory
|
||||
*/
|
||||
queueCPU2GPUBuffers(whichBuffers?: ArgCLBuffer[]) {
|
||||
var buffers: ArgCLBuffer[]; // which to use
|
||||
if (whichBuffers) {
|
||||
buffers = whichBuffers; // just the passed in ones
|
||||
} else { // use all of them
|
||||
buffers = this.CLBuffers;
|
||||
}
|
||||
|
||||
buffers.forEach((value, idx) => {
|
||||
if (value.cpu2gpu) {
|
||||
value.queueCPU2GPU();
|
||||
}
|
||||
}); // load up all the GPU memory from the host for all the read arrays
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the transfers from GPU to CPU memory
|
||||
*/
|
||||
queueGPU2CPUBuffers(whichBuffers?: ArgCLBuffer[]) {
|
||||
var buffers: ArgCLBuffer[]; // which to use
|
||||
if (whichBuffers) {
|
||||
buffers = whichBuffers; // just the passed in ones
|
||||
} else { // use all of them
|
||||
buffers = this.CLBuffers;
|
||||
}
|
||||
|
||||
buffers.forEach((value, idx) => {
|
||||
if (value.gpu2cpu) {
|
||||
value.queueGPU2CPU();
|
||||
}
|
||||
}); // load up all the host arrays from the gpu memory for all the write arrays
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* add this kernel to the queue for execution
|
||||
*/
|
||||
queueExecution() {
|
||||
this.clEvent = new WebCLEvent();
|
||||
this.helper.queue.enqueueNDRangeKernel(this.kernel, this.globalWS.length, this.bufferOffsets, this.globalWS, this.localWS, undefined, this.clEvent); // the kernel
|
||||
}
|
||||
|
||||
/**
|
||||
* Load up all the GPU memory, queue the kernel,
|
||||
* read the GPU memory back into the CPU memory
|
||||
*/
|
||||
queueBuffersAndExecute() {
|
||||
this.queueCPU2GPUBuffers(); // load up all the GPU memory from the host for all the read arrays
|
||||
|
||||
this.queueExecution();
|
||||
|
||||
this.queueGPU2CPUBuffers();
|
||||
|
||||
this.helper.finishQueue();
|
||||
|
||||
this.calcExecutionTime();
|
||||
|
||||
}
|
||||
|
||||
calcExecutionTime() {
|
||||
if (this.helper.profileFlag && this.clEvent) {
|
||||
var startTime: number;
|
||||
var endTime: number;
|
||||
|
||||
startTime = this.clEvent.getProfilingInfo(WEBCL.ProfilingInfo.PROFILING_COMMAND_START);
|
||||
endTime = this.clEvent.getProfilingInfo(WEBCL.ProfilingInfo.PROFILING_COMMAND_END);
|
||||
this.executionTime = endTime - startTime;
|
||||
}
|
||||
else {
|
||||
this.executionTime = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This holds all the information and setup for a platform and device
|
||||
* for a program. Multiple kernels and arguments can be created which are
|
||||
* passed back to the user to manage.
|
||||
*/
|
||||
|
||||
class WebCLHelper {
|
||||
platforms: PlatformInfo[] = new Array<PlatformInfo>();
|
||||
devContext: DeviceContext; // context or undefined if released
|
||||
queue: WEBCL.WebCLCommandQueue; // the command queue for the device
|
||||
programCode: string; // the code for this progam
|
||||
program: WEBCL.WebCLProgram;
|
||||
|
||||
// Create the helper and load up all the platforms and devices
|
||||
constructor(public profileFlag: boolean = false) {
|
||||
if (window.webcl == undefined) {
|
||||
throw (new CLHException("Webcl not found"));
|
||||
}
|
||||
else {
|
||||
// try {
|
||||
var platforms = window.webcl.getPlatforms();
|
||||
if (platforms.length < 1) {
|
||||
throw (new CLHException("WEBCL there but no platforms"));
|
||||
}
|
||||
else {
|
||||
var devicesCount = 0; // keep track of total devices
|
||||
platforms.forEach(
|
||||
(platform) => { // setup info for platform and get all of its devices
|
||||
var platformInfo = new PlatformInfo(platform);
|
||||
var devices = platform.getDevices();
|
||||
devicesCount += devices.length;
|
||||
devices.forEach(
|
||||
(device) => {
|
||||
var deviceInfo = new DeviceInfo(device, platformInfo); // get the info
|
||||
platformInfo.deviceInfos.push(deviceInfo); // add to this platform's devices
|
||||
});
|
||||
this.platforms.push(platformInfo);
|
||||
});
|
||||
|
||||
}
|
||||
if (devicesCount < 1) {
|
||||
throw (new CLHException("Webcl there with " + this.platforms.length + " platforms, but no devices"));
|
||||
}
|
||||
this.setDeviceContext(); // set the device context using the default, can explicitly set if desired.
|
||||
/* }
|
||||
catch (ex) {
|
||||
throw (ex)
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a context for a particular device type using a list of types
|
||||
* in preferred order. Normally this wouldn't be used since the helper constructor
|
||||
* sets the default device as the context.
|
||||
*/
|
||||
setDeviceContext(deviceTypes: WEBCL.DeviceTypeBits[]= [WEBCL.DeviceTypeBits.DEVICE_TYPE_DEFAULT] // optional, if empty default
|
||||
): DeviceContext {
|
||||
var device: DeviceInfo;
|
||||
|
||||
deviceTypes.some((type) => { // go through the input types in preference order
|
||||
if ((type & WEBCL.DeviceTypeBits.DEVICE_TYPE_DEFAULT) != 0) {
|
||||
device = null;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
device = this.platforms.reduce<DeviceInfo>((targetdevice, platform, index, array) => {
|
||||
if (!targetdevice) {
|
||||
platform.deviceInfos.some((deviceInfo: DeviceInfo) => {
|
||||
if ((deviceInfo.TYPE & type) != 0) {
|
||||
targetdevice = deviceInfo;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return targetdevice;
|
||||
}, undefined);
|
||||
return (device != undefined);
|
||||
} // find the first device of the specified type
|
||||
});
|
||||
|
||||
if (device === undefined) {
|
||||
throw ("No device found");
|
||||
}
|
||||
else {
|
||||
if (this.devContext) {
|
||||
this.devContext.context.release();
|
||||
this.devContext = undefined;
|
||||
}
|
||||
if (device === null) {
|
||||
this.devContext = new DeviceContext(); // get the default context
|
||||
}
|
||||
else { // use a specific one
|
||||
this.devContext = new DeviceContext(device.device); // get the context for the device
|
||||
}
|
||||
if (this.queue) {
|
||||
this.queue.release();
|
||||
this.queue = undefined;
|
||||
}
|
||||
|
||||
this.queue = this.devContext.context.createCommandQueue(this.devContext.device, this.profileFlag ? WEBCL.CommandQueueProperties.QUEUE_PROFILING_ENABLE : undefined);
|
||||
|
||||
return this.devContext;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* finish the queue
|
||||
*/
|
||||
finishQueue() {
|
||||
if (this.queue) {
|
||||
this.queue.finish();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set context, GPU preferred
|
||||
* Only used if the default device as set in the constructor isn't correct
|
||||
*/
|
||||
setGPUcontext(): DeviceContext {
|
||||
return this.setDeviceContext([WEBCL.DeviceTypeBits.DEVICE_TYPE_GPU, WEBCL.DeviceTypeBits.DEVICE_TYPE_CPU]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set context, CPU preferred
|
||||
* Only used if the default device as set in the constructor isn't correct
|
||||
*/
|
||||
setCPUcontext(): DeviceContext {
|
||||
return this.setDeviceContext([WEBCL.DeviceTypeBits.DEVICE_TYPE_CPU, WEBCL.DeviceTypeBits.DEVICE_TYPE_GPU]);
|
||||
}
|
||||
|
||||
/**
|
||||
* release the current context
|
||||
*/
|
||||
releaseContext() {
|
||||
if (this.devContext != undefined) {
|
||||
this.devContext.context.releaseAll;
|
||||
this.devContext = undefined;
|
||||
this.queue = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
createProgramFromElement(htmlID: string, options: string = undefined) {
|
||||
var element: JQuery = jQuery("#" + htmlID); //x_Utilities.JQueryUtils.tryJQuery(() => jQuery("#" + htmlID)); // get the kernel code item
|
||||
this.createProgram(element.text(), options);
|
||||
}
|
||||
|
||||
createProgram(code: string, options: string = undefined) {
|
||||
this.programCode = code;
|
||||
this.program = this.devContext.context.createProgram(this.programCode);
|
||||
this.program.build([this.devContext.device], options);
|
||||
}
|
||||
|
||||
createKernelFromString(programSource: string, kernelName: string, options: string = undefined): Kernel {
|
||||
this.createProgram(programSource, options);
|
||||
return this.createKernel(kernelName);
|
||||
}
|
||||
|
||||
createKernelFromElement(htmlID: string, kernelName: string, options: string = undefined) : Kernel {
|
||||
this.createProgramFromElement(htmlID, options);
|
||||
return this.createKernel(kernelName);
|
||||
}
|
||||
|
||||
createKernel(kernelName: string): Kernel {
|
||||
var kernel: WEBCL.WebCLKernel = this.program.createKernel(kernelName); // create the kernel
|
||||
var info: KernelWorkGroupInfo = new KernelWorkGroupInfo(kernel, this.devContext.device); // get the info about it's workgroup
|
||||
return new Kernel(this, kernelName, kernel, info); // create and return the kernel holder
|
||||
}
|
||||
|
||||
executeKernel(kernel: Kernel) {
|
||||
kernel.queueBuffersAndExecute ();
|
||||
}
|
||||
|
||||
createBufferArg(hostBuffer: KernelArgArrayBufferView, cpu2gpu: boolean, gpu2cpu: boolean): ArgCLBuffer {
|
||||
return new ArgCLBuffer(this, hostBuffer, cpu2gpu, gpu2cpu);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Vendored
+706
@@ -0,0 +1,706 @@
|
||||
// Type definitions for WebCL 1.0
|
||||
// Project: https://www.khronos.org/registry/webcl/specs/1.0.0/
|
||||
// Definitions by: Ralph Brown <https://github.com/NCARalph>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// Version 1.3 - Changed enums to static enums for TS 1.5
|
||||
// Version 1.2 - Fixed some more bugs, added WebCLEvent
|
||||
// Version 1.1 - Minor fixes to get more enums in place and fix some argument interface types
|
||||
// Version 1.0 - Initial version
|
||||
|
||||
interface Window {
|
||||
webcl: WEBCL.WebCL;
|
||||
}
|
||||
|
||||
declare var WebCLEvent: { new (): WEBCL.WebCLEvent; };
|
||||
|
||||
declare module WEBCL {
|
||||
// 3.6.1
|
||||
interface WebCLBuffer extends WebCLMemoryObject {
|
||||
createSubBuffer(memFlags: MemFlagsBits, origin: number, sizeInBytes: number): WebCLBuffer;
|
||||
}
|
||||
|
||||
//2.5
|
||||
interface WebCLCallback { (event: WebCLEvent): void }
|
||||
|
||||
|
||||
// 3.5
|
||||
interface WebCLCommandQueue {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copying: Buffer <-> Buffer, Image <-> Image, Buffer <-> Image
|
||||
//
|
||||
|
||||
enqueueCopyBuffer(
|
||||
srcBuffer: WebCLBuffer,
|
||||
dstBuffer: WebCLBuffer,
|
||||
srcOffset: number,
|
||||
dstOffset: number,
|
||||
numBytes: number,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueCopyBufferRect(
|
||||
srcBuffer: WebCLBuffer,
|
||||
dstBuffer: WebCLBuffer,
|
||||
srcOrigin: number[],
|
||||
dstOrigin: number[],
|
||||
region: number[],
|
||||
srcRowPitch: number,
|
||||
srcSlicePitch: number,
|
||||
dstRowPitch: number,
|
||||
dstSlicePitch: number,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueCopyImage(
|
||||
srcImage: WebCLImage,
|
||||
dstImage: WebCLImage,
|
||||
srcOrigin: number[],
|
||||
dstOrigin: number[],
|
||||
region: number[],
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueCopyImageToBuffer(
|
||||
srcImage: WebCLImage,
|
||||
dstBuffer: WebCLBuffer,
|
||||
srcOrigin: number[],
|
||||
srcRegion: number[],
|
||||
dstOffset: number,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueCopyBufferToImage(
|
||||
srcBuffer: WebCLBuffer,
|
||||
dstImage: WebCLImage,
|
||||
srcOffset: number,
|
||||
dstOrigin: number[],
|
||||
dstRegion: number[],
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Reading: Buffer -> Host, Image -> Host
|
||||
//
|
||||
|
||||
enqueueReadBuffer(
|
||||
buffer: WebCLBuffer,
|
||||
blockingRead: boolean,
|
||||
bufferOffset: number,
|
||||
numBytes: number,
|
||||
hostPtr: ArrayBufferView,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueReadBufferRect(
|
||||
buffer: WebCLBuffer,
|
||||
blockingRead: boolean,
|
||||
bufferOrigin: number[],
|
||||
hostOrigin: number[],
|
||||
region: number[],
|
||||
bufferRowPitch: number,
|
||||
bufferSlicePitch: number,
|
||||
hostRowPitch: number,
|
||||
hostSlicePitch: number,
|
||||
hostPtr: ArrayBufferView,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueReadImage(
|
||||
image: WebCLImage,
|
||||
blockingRead: boolean,
|
||||
origin: number[],
|
||||
region: number[],
|
||||
hostRowPitch: number,
|
||||
hostPtr: ArrayBufferView,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Writing: Host -> Buffer, Host -> Image
|
||||
//
|
||||
|
||||
enqueueWriteBuffer(
|
||||
buffer: WebCLBuffer,
|
||||
blockingWrite: boolean,
|
||||
bufferOffset: number,
|
||||
numBytes: number,
|
||||
hostPtr: ArrayBufferView,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueWriteBufferRect(
|
||||
buffer: WebCLBuffer,
|
||||
blockingWrite: boolean,
|
||||
bufferOrigin: number[],
|
||||
hostOrigin: number[],
|
||||
region: number[],
|
||||
bufferRowPitch: number,
|
||||
bufferSlicePitch: number,
|
||||
hostRowPitch: number,
|
||||
hostSlicePitch: number,
|
||||
hostPtr: ArrayBufferView,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
enqueueWriteImage(
|
||||
image: WebCLImage,
|
||||
blockingWrite: boolean,
|
||||
origin: number[],
|
||||
region: number[],
|
||||
hostRowPitch: number,
|
||||
hostPtr: ArrayBufferView,
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Executing kernels
|
||||
//
|
||||
|
||||
enqueueNDRangeKernel(
|
||||
kernel: WebCLKernel,
|
||||
workDim: number,
|
||||
globalWorkOffset: number[],
|
||||
globalWorkSize: number[],
|
||||
localWorkSize?: number[],
|
||||
eventWaitList?: WebCLEvent[],
|
||||
event?: WebCLEvent): void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Synchronization
|
||||
//
|
||||
|
||||
enqueueMarker(event: WebCLEvent): void;
|
||||
|
||||
enqueueBarrier(): void;
|
||||
|
||||
enqueueWaitForEvents(eventWaitList: WebCLEvent[]): void;
|
||||
|
||||
finish(whenFinished?: WebCLCallback): void;
|
||||
|
||||
flush(): void;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Querying command queue information
|
||||
//
|
||||
|
||||
getInfo(name: ContextProperties): any;
|
||||
|
||||
release(): void;
|
||||
}
|
||||
|
||||
//3.4
|
||||
interface WebCLContext {
|
||||
|
||||
createBuffer(memFlags: MemFlagsBits, sizeInBytes: number, hostPtr?: ArrayBufferView): WebCLBuffer;
|
||||
|
||||
createCommandQueue(device: WebCLDevice, properties?: CommandQueueProperties): WebCLCommandQueue;
|
||||
|
||||
createImage(memFlags: MemFlagsBits,
|
||||
descriptor: WebCLImageDescriptor,
|
||||
hostPtr?: ArrayBufferView): WebCLImage;
|
||||
|
||||
createProgram(source: string): WebCLProgram;
|
||||
|
||||
createSampler(normalizedCoords: number,
|
||||
addressingMode: AddressingMode,
|
||||
filterMode: FilterMode): WebCLSampler;
|
||||
|
||||
createUserEvent(): WebCLUserEvent;
|
||||
|
||||
getInfo(name: ContextInfo): any;
|
||||
|
||||
getSupportedImageFormats(memFlags?: MemFlagsBits): WebCLImageDescriptor[];
|
||||
|
||||
release(): void;
|
||||
|
||||
releaseAll(): void;
|
||||
}
|
||||
|
||||
// 3.3
|
||||
interface WebCLDevice {
|
||||
getInfo(name: DeviceInfo): any;
|
||||
getSupportedExtensions(): string[];
|
||||
enableExtension(extensionName: string): boolean;
|
||||
}
|
||||
|
||||
// 3.10
|
||||
interface WebCLEvent {
|
||||
getInfo(name: EventInfo): any;
|
||||
getProfilingInfo(name: ProfilingInfo): number;
|
||||
setCallback(commandExecCallbackType: CommandExecutionStatus, notify: WebCLCallback): void;
|
||||
release(): void;
|
||||
}
|
||||
|
||||
interface WebCLException extends DOMException {
|
||||
name: string; // A string representation of the numeric error code, e.g. "INVALID_VALUE"
|
||||
message: string; // An implementation-specific description of what caused the exception
|
||||
}
|
||||
|
||||
// 3.6.2
|
||||
interface WebCLImage extends WebCLMemoryObject {
|
||||
getInfo(): WebCLImageDescriptor;
|
||||
}
|
||||
|
||||
// 3.4.1
|
||||
interface WebCLImageDescriptor {
|
||||
channelOrder: ChannelOrder;
|
||||
channelType: ChannelType;
|
||||
width: number;
|
||||
height: number;
|
||||
rowPitch: number;
|
||||
}
|
||||
|
||||
// 3.9
|
||||
interface WebCLKernel {
|
||||
getInfo(name: KernelInfo): any;
|
||||
getWorkGroupInfo(device: WebCLDevice, name: KernelWorkGroupInfo): any;
|
||||
getArgInfo(index: number): WebCLKernelArgInfo;
|
||||
setArg(index: number, buffer: WebCLBuffer): void;
|
||||
setArg(index: number, image: WebCLImage): void;
|
||||
setArg(index: number, value: WebCLSampler): void;
|
||||
setArg(index: number, value: ArrayBufferView): void;
|
||||
release(): void;
|
||||
}
|
||||
|
||||
// 3.9.1
|
||||
interface WebCLKernelArgInfo {
|
||||
name: string;
|
||||
typeName: string; // 'char', 'float', 'uint4', 'image2d_t', 'sampler_t', etc.
|
||||
addressQualifier: string; // 'global', 'local', 'constant', or 'private'
|
||||
accessQualifier: string; // 'read_only', 'write_only', or 'none'
|
||||
}
|
||||
|
||||
// 3.6
|
||||
interface WebCLMemoryObject {
|
||||
getInfo(name: MemInfo): any;
|
||||
release(): void;
|
||||
}
|
||||
|
||||
// 3.2
|
||||
interface WebCLPlatform {
|
||||
getInfo(name: PlatformInfo): any;
|
||||
getDevices(deviceType?: DeviceTypeBits): WebCLDevice[];
|
||||
getSupportedExtensions(): string[];
|
||||
enableExtension(extensionName: string): boolean;
|
||||
}
|
||||
|
||||
//3.8
|
||||
interface WebCLProgram {
|
||||
getInfo(name: ProgramInfo): any;
|
||||
|
||||
getBuildInfo(device: WebCLDevice, name: ProgramBuildInfo): any;
|
||||
|
||||
build(devices?: WebCLDevice[],
|
||||
options?: string,
|
||||
whenFinished?: WebCLCallback): void;
|
||||
|
||||
createKernel(kernelName: string): WebCLKernel;
|
||||
|
||||
createKernelsInProgram(): WebCLKernel[];
|
||||
|
||||
release(): void;
|
||||
}
|
||||
|
||||
// 3.7
|
||||
interface WebCLSampler {
|
||||
getInfo(name: SamplerInfo): any;
|
||||
release(): void;
|
||||
}
|
||||
|
||||
// 3.10.1
|
||||
interface WebCLUserEvent extends WebCLEvent {
|
||||
setStatus(executionStatus: CommandExecutionStatus): void;
|
||||
}
|
||||
|
||||
/* Error Codes */
|
||||
const enum ErrorCodes {
|
||||
SUCCESS = 0,
|
||||
DEVICE_NOT_FOUND = -1,
|
||||
DEVICE_NOT_AVAILABLE = -2,
|
||||
COMPILER_NOT_AVAILABLE = -3,
|
||||
MEM_OBJECT_ALLOCATION_FAILURE = -4,
|
||||
OUT_OF_RESOURCES = -5,
|
||||
OUT_OF_HOST_MEMORY = -6,
|
||||
PROFILING_INFO_NOT_AVAILABLE = -7,
|
||||
MEM_COPY_OVERLAP = -8,
|
||||
IMAGE_FORMAT_MISMATCH = -9,
|
||||
IMAGE_FORMAT_NOT_SUPPORTED = -10,
|
||||
BUILD_PROGRAM_FAILURE = -11,
|
||||
MAP_FAILURE = -12,
|
||||
MISALIGNED_SUB_BUFFER_OFFSET = -13,
|
||||
EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST = -14,
|
||||
INVALID_VALUE = -30,
|
||||
INVALID_DEVICE_TYPE = -31,
|
||||
INVALID_PLATFORM = -32,
|
||||
INVALID_DEVICE = -33,
|
||||
INVALID_CONTEXT = -34,
|
||||
INVALID_QUEUE_PROPERTIES = -35,
|
||||
INVALID_COMMAND_QUEUE = -36,
|
||||
INVALID_HOST_PTR = -37,
|
||||
INVALID_MEM_OBJECT = -38,
|
||||
INVALID_IMAGE_FORMAT_DESCRIPTOR = -39,
|
||||
INVALID_IMAGE_SIZE = -40,
|
||||
INVALID_SAMPLER = -41,
|
||||
INVALID_BINARY = -42,
|
||||
INVALID_BUILD_OPTIONS = -43,
|
||||
INVALID_PROGRAM = -44,
|
||||
INVALID_PROGRAM_EXECUTABLE = -45,
|
||||
INVALID_KERNEL_NAME = -46,
|
||||
INVALID_KERNEL_DEFINITION = -47,
|
||||
INVALID_KERNEL = -48,
|
||||
INVALID_ARG_INDEX = -49,
|
||||
INVALID_ARG_VALUE = -50,
|
||||
INVALID_ARG_SIZE = -51,
|
||||
INVALID_KERNEL_ARGS = -52,
|
||||
INVALID_WORK_DIMENSION = -53,
|
||||
INVALID_WORK_GROUP_SIZE = -54,
|
||||
INVALID_WORK_ITEM_SIZE = -55,
|
||||
INVALID_GLOBAL_OFFSET = -56,
|
||||
INVALID_EVENT_WAIT_LIST = -57,
|
||||
INVALID_EVENT = -58,
|
||||
INVALID_OPERATION = -59,
|
||||
//INVALID_GL_OBJECT = -60, // moved to extension
|
||||
INVALID_BUFFER_SIZE = -61,
|
||||
//INVALID_MIP_LEVEL = -62, // moved to extension
|
||||
INVALID_GLOBAL_WORK_SIZE = -63,
|
||||
INVALID_PROPERTY = -64,
|
||||
}
|
||||
|
||||
/* cl_bool */
|
||||
const enum Bool {
|
||||
FALSE = 0,
|
||||
TRUE = 1,
|
||||
}
|
||||
|
||||
/* cl_platforinfo */
|
||||
const enum PlatformInfo {
|
||||
PLATFORM_PROFILE = 0x0900,
|
||||
PLATFORM_VERSION = 0x0901,
|
||||
PLATFORM_NAME = 0x0902,
|
||||
PLATFORM_VENDOR = 0x0903,
|
||||
PLATFORM_EXTENSIONS = 0x0904,
|
||||
}
|
||||
/* cl_device_type - bitfield */
|
||||
const enum DeviceTypeBits {
|
||||
DEVICE_TYPE_DEFAULT = 0x1,
|
||||
DEVICE_TYPE_CPU = 0x2,
|
||||
DEVICE_TYPE_GPU = 0x4,
|
||||
DEVICE_TYPE_ACCELERATOR = 0x8,
|
||||
DEVICE_TYPE_ALL = 0xFFFFFFFF,
|
||||
}
|
||||
/* cl_device_info */
|
||||
const enum DeviceInfo {
|
||||
DEVICE_TYPE = 0x1000,
|
||||
DEVICE_VENDOR_ID = 0x1001,
|
||||
DEVICE_MAX_COMPUTE_UNITS = 0x1002,
|
||||
DEVICE_MAX_WORK_ITEM_DIMENSIONS = 0x1003,
|
||||
DEVICE_MAX_WORK_GROUP_SIZE = 0x1004,
|
||||
DEVICE_MAX_WORK_ITEM_SIZES = 0x1005,
|
||||
DEVICE_PREFERRED_VECTOR_WIDTH_CHAR = 0x1006,
|
||||
DEVICE_PREFERRED_VECTOR_WIDTH_SHORT = 0x1007,
|
||||
DEVICE_PREFERRED_VECTOR_WIDTH_INT = 0x1008,
|
||||
DEVICE_PREFERRED_VECTOR_WIDTH_LONG = 0x1009,
|
||||
DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT = 0x100A,
|
||||
//DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE = 0x100B, // moved to extension
|
||||
DEVICE_MAX_CLOCK_FREQUENCY = 0x100C,
|
||||
DEVICE_ADDRESS_BITS = 0x100D,
|
||||
DEVICE_MAX_READ_IMAGE_ARGS = 0x100E,
|
||||
DEVICE_MAX_WRITE_IMAGE_ARGS = 0x100F,
|
||||
DEVICE_MAX_MEM_ALLOC_SIZE = 0x1010,
|
||||
DEVICE_IMAGE2D_MAX_WIDTH = 0x1011,
|
||||
DEVICE_IMAGE2D_MAX_HEIGHT = 0x1012,
|
||||
DEVICE_IMAGE3D_MAX_WIDTH = 0x1013,
|
||||
DEVICE_IMAGE3D_MAX_HEIGHT = 0x1014,
|
||||
DEVICE_IMAGE3D_MAX_DEPTH = 0x1015,
|
||||
DEVICE_IMAGE_SUPPORT = 0x1016,
|
||||
DEVICE_MAX_PARAMETER_SIZE = 0x1017,
|
||||
DEVICE_MAX_SAMPLERS = 0x1018,
|
||||
DEVICE_MEM_BASE_ADDR_ALIGN = 0x1019,
|
||||
//DEVICE_MIN_DATA_TYPE_ALIGN_SIZE = 0x101A, // removed, deprecated in Open1.2
|
||||
DEVICE_SINGLE_FP_CONFIG = 0x101B,
|
||||
DEVICE_GLOBAL_MEM_CACHE_TYPE = 0x101C,
|
||||
DEVICE_GLOBAL_MEM_CACHELINE_SIZE = 0x101D,
|
||||
DEVICE_GLOBAL_MEM_CACHE_SIZE = 0x101E,
|
||||
DEVICE_GLOBAL_MEM_SIZE = 0x101F,
|
||||
DEVICE_MAX_CONSTANT_BUFFER_SIZE = 0x1020,
|
||||
DEVICE_MAX_CONSTANT_ARGS = 0x1021,
|
||||
DEVICE_LOCAL_MEM_TYPE = 0x1022,
|
||||
DEVICE_LOCAL_MEM_SIZE = 0x1023,
|
||||
DEVICE_ERROR_CORRECTION_SUPPORT = 0x1024,
|
||||
DEVICE_PROFILING_TIMER_RESOLUTION = 0x1025,
|
||||
DEVICE_ENDIAN_LITTLE = 0x1026,
|
||||
DEVICE_AVAILABLE = 0x1027,
|
||||
DEVICE_COMPILER_AVAILABLE = 0x1028,
|
||||
DEVICE_EXECUTION_CAPABILITIES = 0x1029,
|
||||
DEVICE_QUEUE_PROPERTIES = 0x102A,
|
||||
DEVICE_NAME = 0x102B,
|
||||
DEVICE_VENDOR = 0x102C,
|
||||
DRIVER_VERSION = 0x102D,
|
||||
DEVICE_PROFILE = 0x102E,
|
||||
DEVICE_VERSION = 0x102F,
|
||||
DEVICE_EXTENSIONS = 0x1030,
|
||||
DEVICE_PLATFORM = 0x1031,
|
||||
//DEVICE_DOUBLE_FP_CONFIG = 0x1032, // moved to extension
|
||||
//DEVICE_HALF_FP_CONFIG = 0x1033, // moved to extension
|
||||
//DEVICE_PREFERRED_VECTOR_WIDTH_HALF = 0x1034, // moved to extension
|
||||
DEVICE_HOST_UNIFIED_MEMORY = 0x1035,
|
||||
DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 0x1036,
|
||||
DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 0x1037,
|
||||
DEVICE_NATIVE_VECTOR_WIDTH_INT = 0x1038,
|
||||
DEVICE_NATIVE_VECTOR_WIDTH_LONG = 0x1039,
|
||||
DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 0x103A,
|
||||
//DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 0x103B, // moved to extension
|
||||
//DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0x103C, // moved to extension
|
||||
DEVICE_OPENCL_C_VERSION = 0x103D,
|
||||
}
|
||||
/* cl_device_fp_config - bitfield */
|
||||
const enum DeviceFPConfigBits {
|
||||
FP_DENORM = 0x1,
|
||||
FP_INF_NAN = 0x2,
|
||||
FP_ROUND_TO_NEAREST = 0x4,
|
||||
FP_ROUND_TO_ZERO = 0x8,
|
||||
FP_ROUND_TO_INF = 0x10,
|
||||
FP_FMA = 0x20,
|
||||
FP_SOFT_FLOAT = 0x40,
|
||||
}
|
||||
/* cl_device_MEM_CACHE_type */
|
||||
const enum DeviceMemCacheType {
|
||||
NONE = 0x0,
|
||||
READ_ONLY_CACHE = 0x1,
|
||||
READ_WRITE_CACHE = 0x2,
|
||||
}
|
||||
/* cl_device_local_mem_type */
|
||||
const enum DeviceLocalMemType {
|
||||
LOCAL = 0x1,
|
||||
GLOBAL = 0x2,
|
||||
}
|
||||
/* cl_device_exec_capabilities - bitfield */
|
||||
const enum DeviceExecCapabilitiesBits {
|
||||
EXEC_KERNEL = 0x1,
|
||||
//EXEC_NATIVE_KERNEL = 0x2, // disallowed
|
||||
}
|
||||
/* cl_command_queue_properties - bitfield */
|
||||
const enum CommandQueueProperties {
|
||||
QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE = 0x1,
|
||||
QUEUE_PROFILING_ENABLE = 0x2,
|
||||
}
|
||||
/* cl_context_info */
|
||||
const enum ContextInfo {
|
||||
//CONTEXT_REFERENCE_COUNT = 0x1080, // disallowed
|
||||
CONTEXT_DEVICES = 0x1081,
|
||||
//CONTEXT_PROPERTIES = 0x1082, // disallowed, no context properties in WebCONTEXT_NUM_DEVICES = 0x1083,
|
||||
}
|
||||
/* cl_context_properties */
|
||||
const enum ContextProperties {
|
||||
//CONTEXT_PLATFORM = 0x1084, // disallowed, no context properties in Web /* cl_command_queue_info */
|
||||
QUEUE_CONTEXT = 0x1090,
|
||||
QUEUE_DEVICE = 0x1091,
|
||||
//QUEUE_REFERENCE_COUNT = 0x1092, // disallowed
|
||||
QUEUE_PROPERTIES = 0x1093,
|
||||
}
|
||||
/* cl_mem_flags - bitfield */
|
||||
const enum MemFlagsBits {
|
||||
MEM_READ_WRITE = 0x1,
|
||||
MEM_WRITE_ONLY = 0x2,
|
||||
MEM_READ_ONLY = 0x4,
|
||||
}
|
||||
/* cl_channel_order */
|
||||
const enum ChannelOrder {
|
||||
R = 0x10B0,
|
||||
A = 0x10B1,
|
||||
RG = 0x10B2,
|
||||
RA = 0x10B3,
|
||||
RGB = 0x10B4,
|
||||
RGBA = 0x10B5,
|
||||
BGRA = 0x10B6,
|
||||
ARGB = 0x10B7,
|
||||
INTENSITY = 0x10B8,
|
||||
LUMINANCE = 0x10B9,
|
||||
Rx = 0x10BA,
|
||||
RGx = 0x10BB,
|
||||
RGBx = 0x10BC,
|
||||
}
|
||||
/* cl_channel_type */
|
||||
const enum ChannelType {
|
||||
SNORM_INT8 = 0x10D0,
|
||||
SNORM_INT16 = 0x10D1,
|
||||
UNORM_INT8 = 0x10D2,
|
||||
UNORM_INT16 = 0x10D3,
|
||||
UNORM_SHORT_565 = 0x10D4,
|
||||
UNORM_SHORT_555 = 0x10D5,
|
||||
UNORM_INT_101010 = 0x10D6,
|
||||
SIGNED_INT8 = 0x10D7,
|
||||
SIGNED_INT16 = 0x10D8,
|
||||
SIGNED_INT32 = 0x10D9,
|
||||
UNSIGNED_INT8 = 0x10DA,
|
||||
UNSIGNED_INT16 = 0x10DB,
|
||||
UNSIGNED_INT32 = 0x10DC,
|
||||
HALF_FLOAT = 0x10DD,
|
||||
FLOAT = 0x10DE,
|
||||
}
|
||||
/* cl_meobject_type */
|
||||
const enum MemObjectType {
|
||||
MEM_OBJECT_BUFFER = 0x10F0,
|
||||
MEM_OBJECT_IMAGE2D = 0x10F1,
|
||||
MEM_OBJECT_IMAGE3D = 0x10F2,
|
||||
}
|
||||
/* cl_meinfo */
|
||||
const enum MemInfo {
|
||||
MEM_TYPE = 0x1100,
|
||||
MEM_FLAGS = 0x1101,
|
||||
MEM_SIZE = 0x1102,
|
||||
//MEM_HOST_PTR = 0x1103, // disallowed
|
||||
//MEM_MAP_COUNT = 0x1104, // disallowed
|
||||
//MEM_REFERENCE_COUNT = 0x1105, // disallowed
|
||||
MEM_CONTEXT = 0x1106,
|
||||
MEM_ASSOCIATED_MEMOBJECT = 0x1107,
|
||||
MEM_OFFSET = 0x1108,
|
||||
}
|
||||
/* cl_image_info */
|
||||
const enum ImageInfo {
|
||||
IMAGE_FORMAT = 0x1110,
|
||||
IMAGE_ELEMENT_SIZE = 0x1111,
|
||||
IMAGE_ROW_PITCH = 0x1112,
|
||||
IMAGE_WIDTH = 0x1114,
|
||||
IMAGE_HEIGHT = 0x1115,
|
||||
}
|
||||
/* cl_addressing_mode */
|
||||
const enum AddressingMode {
|
||||
//ADDRESS_NONE = 0x1130, // disallowed
|
||||
ADDRESS_CLAMP_TO_EDGE = 0x1131,
|
||||
ADDRESS_CLAMP = 0x1132,
|
||||
ADDRESS_REPEAT = 0x1133,
|
||||
ADDRESS_MIRRORED_REPEAT = 0x1134,
|
||||
}
|
||||
/* cl_filter_mode */
|
||||
const enum FilterMode {
|
||||
FILTER_NEAREST = 0x1140,
|
||||
FILTER_LINEAR = 0x1141,
|
||||
}
|
||||
/* cl_sampler_info */
|
||||
const enum SamplerInfo {
|
||||
//SAMPLER_REFERENCE_COUNT = 0x1150, // disallowed
|
||||
SAMPLER_CONTEXT = 0x1151,
|
||||
SAMPLER_NORMALIZED_COORDS = 0x1152,
|
||||
SAMPLER_ADDRESSING_MODE = 0x1153,
|
||||
SAMPLER_FILTER_MODE = 0x1154,
|
||||
}
|
||||
/* cl_map_flags - bitfield */
|
||||
//MAP_READ = 0x1, // disallowed
|
||||
//MAP_WRITE = 0x2, // disallowed
|
||||
|
||||
/* cl_prograinfo */
|
||||
const enum ProgramInfo {
|
||||
//PROGRAM_REFERENCE_COUNT = 0x1160, // disallowed
|
||||
PROGRAM_CONTEXT = 0x1161,
|
||||
PROGRAM_NUM_DEVICES = 0x1162,
|
||||
PROGRAM_DEVICES = 0x1163,
|
||||
PROGRAM_SOURCE = 0x1164,
|
||||
//PROGRAM_BINARY_SIZES = 0x1165, // disallowed
|
||||
//PROGRAM_BINARIES = 0x1166, // disallowed
|
||||
}
|
||||
/* cl_program_build_info */
|
||||
const enum ProgramBuildInfo {
|
||||
PROGRAM_BUILD_STATUS = 0x1181,
|
||||
PROGRAM_BUILD_OPTIONS = 0x1182,
|
||||
PROGRAM_BUILD_LOG = 0x1183,
|
||||
}
|
||||
/* cl_build_status */
|
||||
const enum BuildStatus {
|
||||
BUILD_SUCCESS = 0,
|
||||
BUILD_NONE = -1,
|
||||
BUILD_ERROR = -2,
|
||||
BUILD_IN_PROGRESS = -3,
|
||||
}
|
||||
/* cl_kernel_info */
|
||||
const enum KernelInfo {
|
||||
KERNEL_FUNCTION_NAME = 0x1190,
|
||||
KERNEL_NUM_RGS = 0x1191,
|
||||
//KERNEL_REFERENCE_COUNT = 0x1192, // disallowed
|
||||
KERNEL_CONTEXT = 0x1193,
|
||||
KERNEL_PROGRAM = 0x1194,
|
||||
}
|
||||
/* cl_kernel_work_group_info */
|
||||
const enum KernelWorkGroupInfo {
|
||||
KERNEL_WORK_GROUP_SIZE = 0x11B0,
|
||||
KERNEL_COMPILE_WORK_GROUP_SIZE = 0x11B1,
|
||||
KERNEL_LOCAL_MEM_SIZE = 0x11B2,
|
||||
KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x11B3,
|
||||
KERNEL_PRIVATE_MEM_SIZE = 0x11B4,
|
||||
}
|
||||
/* cl_event_info */
|
||||
const enum EventInfo {
|
||||
EVENT_COMMAND_QUEUE = 0x11D0,
|
||||
EVENT_COMMAND_TYPE = 0x11D1,
|
||||
//EVENT_REFERENCE_COUNT = 0x11D2, // disallowed
|
||||
EVENT_COMMAND_EXECUTION_STATUS = 0x11D3,
|
||||
EVENT_CONTEXT = 0x11D4,
|
||||
}
|
||||
/* cl_command_type */
|
||||
const enum CommandType {
|
||||
COMMAND_NDRANGE_KERNEL = 0x11F0,
|
||||
COMMAND_TASK = 0x11F1,
|
||||
//COMMAND_NATIVE_KERNEL = 0x11F2, // disallowed
|
||||
COMMAND_READ_BUFFER = 0x11F3,
|
||||
COMMAND_WRITE_BUFFER = 0x11F4,
|
||||
COMMAND_COPY_BUFFER = 0x11F5,
|
||||
COMMAND_READ_IMAGE = 0x11F6,
|
||||
COMMAND_WRITE_IMAGE = 0x11F7,
|
||||
COMMAND_COPY_IMAGE = 0x11F8,
|
||||
COMMAND_COPY_IMAGE_TO_BUFFER = 0x11F9,
|
||||
COMMAND_COPY_BUFFER_TO_IMAGE = 0x11FA,
|
||||
//COMMAND_MAP_BUFFER = 0x11FB, // disallowed
|
||||
//COMMAND_MAP_IMAGE = 0x11FC, // disallowed
|
||||
//COMMAND_UNMAP_MEM_OBJECT = 0x11FD, // disallowed
|
||||
COMMAND_MARKER = 0x11FE,
|
||||
//COMMAND_ACQUIRE_GL_OBJECTS = 0x11FF, // moved to extension
|
||||
//COMMAND_RELEASE_GL_OBJECTS = 0x1200, // moved to extension
|
||||
COMMAND_READ_BUFFER_RECT = 0x1201,
|
||||
COMMAND_WRITE_BUFFER_RECT = 0x1202,
|
||||
COMMAND_COPY_BUFFER_RECT = 0x1203,
|
||||
COMMAND_USER = 0x1204,
|
||||
}
|
||||
/* command execution status */
|
||||
const enum CommandExecutionStatus {
|
||||
COMPLETE = 0x0,
|
||||
RUNNING = 0x1,
|
||||
SUBMITTED = 0x2,
|
||||
QUEUED = 0x3,
|
||||
}
|
||||
/* cl_profiling_info */
|
||||
const enum ProfilingInfo {
|
||||
PROFILING_COMMAND_QUEUED = 0x1280,
|
||||
PROFILING_COMMAND_SUBMIT = 0x1281,
|
||||
PROFILING_COMMAND_START = 0x1282,
|
||||
PROFILING_COMMAND_END = 0x1283,
|
||||
}
|
||||
|
||||
interface WebCL {
|
||||
getPlatforms(): WebCLPlatform[];
|
||||
|
||||
createContext(deviceType?: DeviceTypeBits): WebCLContext;
|
||||
|
||||
createContext(platform: WebCLPlatform, deviceType?: DeviceTypeBits): WebCLContext;
|
||||
|
||||
createContext(device: WebCLDevice): WebCLContext;
|
||||
|
||||
createContext(devices: WebCLDevice[]): WebCLContext;
|
||||
|
||||
getSupportedExtensions(): string[];
|
||||
|
||||
enableExtension(extensionName: string): boolean;
|
||||
|
||||
waitForEvents(eventWaitList: WebCLEvent[],
|
||||
whenFinished?: WebCLCallback): void;
|
||||
|
||||
releaseAll(): void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user