Merge pull request #2 from borisyankov/master

Update
This commit is contained in:
Niklas Mollenhauer
2013-09-09 13:48:52 -07:00
27 changed files with 1119 additions and 224 deletions

View File

@@ -82,7 +82,7 @@ List of Definitions
* [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
* [History.js](https://github.com/balupton/History.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov))
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
* [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter))
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
@@ -225,4 +225,5 @@ Requested Definitions
* [Lo-Dash](http://lodash.com/)
* [java](https://github.com/nearinfinity/node-java)
* [SVG.js](http://www.svgjs.com/)
* [CreateJS](http://createjs.com/)
In addition you can find the [updated open requests that you can contribute here](https://github.com/borisyankov/DefinitelyTyped/issues?labels=request&page=1&state=open)

18
ace/ace.d.ts vendored
View File

@@ -50,7 +50,7 @@ declare module AceAjax {
export interface TokenInfo {
value: string;
}
}
export interface Position {
@@ -1023,7 +1023,7 @@ declare module AceAjax {
new (text: string[], mode?: string): IEditSession;
}
////////////////////////////////
/// Editor
////////////////////////////////
@@ -1040,7 +1040,7 @@ declare module AceAjax {
selectMoreLines(n: number);
onTextInput(text: string);
onCommandKey(e, hashId, keyCode);
commands: CommandManager;
@@ -1702,7 +1702,7 @@ declare module AceAjax {
}
var Editor: {
var Editor: {
/**
* Creates a new `Editor` object.
* @param renderer Associated `VirtualRenderer` that draws everything
@@ -1773,7 +1773,7 @@ declare module AceAjax {
new (session: Document, length: number, pos: number, others: string, mainClass: string, othersClass: string): PlaceHolder;
new (session: IEditSession, length: number, pos: Position, positions: Position[]): PlaceHolder;
}
}
////////////////
/// RangeList
@@ -1998,7 +1998,7 @@ declare module AceAjax {
var Range: {
fromPoints(pos1: Position, pos2: Position): Range;
new(startRow: number, startColumn: number, endRow: number, endColumn: number): Range;
}
}
////////////////
/// RenderLoop
@@ -2157,7 +2157,7 @@ declare module AceAjax {
/**
* Gets the current position of the cursor.
**/
getCursor(): number;
getCursor(): Position;
/**
* Sets the row and column position of the anchor. This function also emits the `'changeSelection'` event.
@@ -2377,7 +2377,7 @@ declare module AceAjax {
* @param session The session to use
**/
new(session: IEditSession): Selection;
}
}
////////////////
/// Split
@@ -2529,7 +2529,7 @@ declare module AceAjax {
* @param flag Any additional regular expression flags to pass (like "i" for case insensitive)
**/
new(rules: any, flag: string): Tokenizer;
}
}
//////////////////
/// UndoManager

View File

@@ -32,6 +32,7 @@ declare module ng {
bootstrap(element: string, modules?: any[]): auto.IInjectorService;
bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService;
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
bootstrap(element: Document, modules?: any[]): auto.IInjectorService;
copy(source: any, destination?: any): any;
element: IAugmentedJQueryStatic;
equals(value1: any, value2: any): boolean;
@@ -138,7 +139,8 @@ declare module ng {
$valid: boolean;
$invalid: boolean;
$error: any;
$setDirty(dirty: boolean): void;
$setDirty(): void;
$setPristine(): void;
}
///////////////////////////////////////////////////////////////////////////

View File

@@ -1,3 +1,5 @@
/// <reference path="camljs.d.ts" />
var caml = new CamlBuilder().Where()
.Any(
CamlBuilder.Expression().TextField("Email").EqualTo("support@google.com"),
@@ -7,16 +9,16 @@ var caml = new CamlBuilder().Where()
)
.ToString();
var caml = new CamlBuilder().Where()
caml = new CamlBuilder().Where()
.UserField("AssignedTo").EqualToCurrentUser()
.Or()
.UserField("AssignedTo").Membership.CurrentUserGroups()
.GroupBy("Category")
.OrderBy("Priority").ThenBy("Title")
.ToString();
var caml = new CamlBuilder().Where()
caml = new CamlBuilder().Where()
.All(
CamlBuilder.Expression().All(
CamlBuilder.Expression().BooleanField("Enabled").IsTrue(),
@@ -28,18 +30,18 @@ var caml = new CamlBuilder().Where()
)
)
.ToString();
var caml = new CamlBuilder().Where()
caml = new CamlBuilder().Where()
.LookupIdField("Category").In([2, 3, 10])
.And()
.DateField("ExpirationDate").GreaterThan(CamlBuilder.CamlValues.Now)
.OrderBy("ExpirationDate")
.ToString()
var caml = new CamlBuilder().Where().CounterField("ID").In([1, 2, 3]).ToString();
var caml = CamlBuilder.Expression()
caml = new CamlBuilder().Where().CounterField("ID").In([1, 2, 3]).ToString();
caml = CamlBuilder.Expression()
.All(
CamlBuilder.Expression().DateField("BroadcastExpires").GreaterThanOrEqualTo(CamlBuilder.CamlValues.Today),
CamlBuilder.Expression().Any(
@@ -49,5 +51,5 @@ var caml = CamlBuilder.Expression()
CamlBuilder.Expression().DateRangesOverlap(CamlBuilder.DateRangesOverlapType.Year, new Date().toISOString())
)
.ToString();
var caml = new CamlBuilder().Where().DateTimeField("Created").GreaterThan(new Date(Date.UTC(2013,0,1))).ToString();
caml = new CamlBuilder().Where().DateTimeField("Created").GreaterThan(new Date(Date.UTC(2013,0,1))).ToString();

4
d3/d3.d.ts vendored
View File

@@ -740,7 +740,7 @@ declare module D3 {
*/
sort<T>(comparator?: (a: T, b: T) => number): Selection;
order: () => Selection;
node: () => SVGLocatable;
node: () => HTMLElement;
}
export interface EnterSelection {
@@ -748,7 +748,7 @@ declare module D3 {
insert: (name: string, before: string) => Selection;
select: (selector: string) => Selection;
empty: () => boolean;
node: () => SVGLocatable;
node: () => HTMLElement;
}
export interface UpdateSelection extends Selection {

527
durandal/durandal-1.x.d.ts vendored Normal file
View File

@@ -0,0 +1,527 @@
// Type definitions for durandal 1.1.1
// Project: http://durandaljs.com
// Definitions by: Evan Larsen <http://nouvosoft.com/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../knockout/knockout.d.ts" />
declare module "durandal/system" {
/**
* Returns the module id associated with the specified object
*/
export var getModuleId: (obj: any) => string;
/**
* Sets the module id on the module.
*/
export var setModuleId: (obj, id: string) => void;
/**
* Call this function to enable or disable Durandal's debug mode. Calling it with no parameters will return true if the framework is currently in debug mode, false otherwise.
*/
export var debug: (debug?: boolean) => boolean;
/**
* Checks if the obj is an array
*/
export var isArray: (obj: any) => boolean;
/**
* Logs data to the console. Pass any number of parameters to be logged. Log output is not processed if the framework is not running in debug mode.
*/
export var log: (...msgs: any[]) => void;
/**
* Creates a deferred object which can be used to create a promise. Optionally pass a function action to perform which will be passed an object used in resolving the promise.
*/
export var defer: (action?: Function) => JQueryDeferred<any>;
/**
* Creates a simple V4 UUID. This should not be used as a PK in your database. It can be used to generate internal, unique ids.
*/
export var guid: () => string;
/**
* Uses require.js to obtain a module. This function returns a promise which resolves with the module instance. You can pass more than one module id to this function. If more than one is passed, then the promise will resolve with one callback parameter per module.
*/
export var acquire: (...modules: string[]) => JQueryPromise<any>;
}
declare module "durandal/app" {
/**
* Sets the title for the app. You must set this before calling start. This will set the document title and the default message box header. It is also used internally by the router to set the document title when pages change.
*/
export var title: string;
/**
* simple helper function that wraps a call to modalDialog.show()
*/
export var showModal: (obj, activationData?, context?) => JQueryPromise<any>;
/**
* A simple helper function that translates to return modalDialog.show(new MessageBox(message, title, options));
*/
export var showMessage: (message: string, title?: string, options?: any) => JQueryPromise<any>;
/**
* Call this function to bootstrap the Durandal framework. It returns a promise which is resolved when the framework is configured and the dom is ready. At that point you are ready to set your root.
*/
export var start: () => JQueryPromise<any>;
/**
* This sets the root view or view model and displays the composed application in the specified application host.
* @param root parameter is required and can be anything that the composition module understands as a view or view model. This includes strings and objects.
* @param transition If you have a splash screen, you may want to specify an optional transition to animate from the splash to your main shell.
* @param applicationHost parameter is optional. If provided it should be an element id for the node into which the UI should be composed. If it is not provided the default is to look for an element with an id of "applicationHost".
*/
export var setRoot: (root: any, transition?: string, applicationHost?: string) => void;
/**
* If you intend to run on mobile, you should also call app.adaptToDevice() before setting the root.
*/
export var adaptToDevice: () => void;
/**
* The events parameter is a space delimited string containing one or more event identifiers. When one of these events is triggered, the callback is called and passed the event data provided by the trigger. The special events value of "all" binds all events on the object to the callback. If a context is provided, it will be bound to this for the callback. If the callback is omitted, then a promise-like object is returned from on. This object represents a subscription and has a then function used to register callbacks.
*/
export var on: (events: string, callback: Function, context?) => IEventSubscription;
/**
* Unwires callbacks from events. If no context is specified, all callbacks with different contexts will be removed. If no callback is specified, all callbacks for the event will be removed. If no event is specified, all event callbacks on the object will be removed.
*/
export var off: (events: string, callback: Function, context?) => any;
/**
* Triggers an event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks.
*/
export var trigger: (events: string, ...args: any[]) => any;
/**
* Provides a function which can be used as a callback to trigger the events. This is useful in combination with jQuery events which may need to trigger the aggregator's events.
*/
export var proxy: (events) => Function;
}
declare module "durandal/composition" {
/**
* sets activate: true on every compose binding
*/
export var activateDuringComposition: boolean;
/**
* changes the convention for finding where transitions are located
*/
export var convertTransitionToModuleId: (name: string) => string;
/**
* sets a default transition for all compositions
*/
export var defaultTransitionName: string;
/**
* the default implementation for switching the content during composition
*/
export var switchContent: (parent: HTMLElement, newChild: HTMLElement, settings: any) => void;
/**
* the default implementation on binding and showing content during composition
*/
export var bindAndShow: (element: HTMLElement, view: HTMLElement, settings: any) => void;
/**
* the default strategy which is: return viewLocator.locateViewForObject(settings.model, settings.viewElements);
*/
export var defaultStrategy: (settings: any) => JQueryPromise<any>;
/**
* the default method for getting settings from the binding handler compose.
*/
export var getSettings: (valueAccessor: any) => any;
/**
* the default method for executing a strategy during composition
*/
export var executeStrategy: (element: HTMLElement, settings: any) => void;
/**
* the default method for injecting during composition
*/
export var inject: (element: HTMLElement, settings: any) => void;
/**
* the default method for composing
*/
export var compose: (element: HTMLElement, settings: any, bindingContext: any) => void;
}
declare module "durandal/http" {
/**
* the default is 'callback'
*/
export var defaultJSONPCallbackParam: string;
/**
* Performs an HTTP GET request on the specified URL. This function returns a promise which resolves with the returned response data. You can optionally return a query object whose properties will be used to construct a query string.
*/
export var get: (url: string, query: Object) => JQueryPromise<any>;
/**
* Performs a JSONP request to the specified url. You can optionally include a query object whose properties will be used to construct the query string. Also, you can pass the name of the API's callback parameter. If none is specified, it defaults to "callback". This api returns a promise. If you are using a callback parameter other than "callback" consistently throughout your application, then you may want to set the http module's defaultJSONPCallbackParam so that you don't need to specify it on every request.
*/
export var jsonp: (url: string, query: Object, callbackParam: string) => JQueryPromise<any>;
/**
* Performs an HTTP POST request on the specified URL with the supplied data. The data object is converted to JSON and the request is sent with an application/json content type. Thie function returns a promise which resolves with the returned response data.
*/
export var post: (url: string, data: Object) => JQueryPromise<any>;
}
declare module "durandal/modalDialog" {
/**
* the default is 1050
*/
export var currentZIndex: number;
/**
* This is a helper function which can be used in the creation of custom modal contexts. Each time it is called, it returns a successively higher zIndex value than the last time.
*/
export var getNextZIndex: () => number;
/**
* This is a helper function which will tell you if any modals are currently open.
*/
export var isModalOpen: () => boolean;
/**
* You may wish to customize modal displays or add additional contexts in order to display modals in different ways. To alter the default context, you would acquire it by calling getContext() and then alter it's pipeline. If you don't provide a value for name it returns the default context.
*/
export var getContext: (name: string) => any;
/**
* Pass a name and an object which defines the proper modal display pipeline via the functions described in the next section. This creates a new modal context or "modal style."
*/
export var addContext: (name: string, modalContext: any) => JQueryPromise<any>;
/**
* creates a settings obj from the supplied params
*/
export var createCompositionSettings: (obj: any, modalContext: any) => any;
/**
* This API uses the composition module to compose your obj into a modal popover. It also uses the viewModel module to check and enforce any screen lifecycle needs that obj may have. A promise is returned which will be resolved when the modal dialog is dismissed. The obj is the view model for your modal dialog, or a moduleId for the view model to load. Your view model instance will have a single property added to it by this mechanism called modal which represents the dialog infrastructure itself. This modal object has a single function called close which can be invoked to close the modal. You may also pass data to close which will be returned via the promise mechanism. The modal object also references it's owner, activator, the composition settings it was created with and its display context. Speaking of context, this parameter represents the display context or modal style. By default, there is one context registered with the system, named 'default'. If no context is specified, the default context with be used to display the modal. You can also specify activationData which is an arbitrary object that will be passed to your modal's activate function, if it has one.
*/
export var show: (obj: any, activationData: any, context: any) => JQueryPromise<any>;
}
declare module "durandal/viewEngine" {
/**
* The file extension that view source files are expected to have.
*/
export var viewExtension: string;
/**
* The name of the RequireJS loader plugin used by the viewLocator to obtain the view source. (Use requirejs to map the plugin's full path).
*/
export var viewPlugin: string;
/**
* Returns true if the potential string is a url for a view, according to the view engine.
*/
export var isViewUrl: (url: string) => boolean;
/**
* Converts a view url into a view id.
*/
export var convertViewUrlToViewId: (url: string) => string;
/**
* Converts a view id into a full RequireJS path.
*/
export var convertViewIdToRequirePath: (viewId: string) => string;
/**
* Parses some markup and turns it into a dom element.
*/
export var parseMarkup: (markup: string) => HTMLElement;
/**
* Returns a promise for a dom element identified by the viewId parameter.
*/
export var createView: (viewId: string) => JQueryPromise<any>;
}
declare module "durandal/viewLocator" {
/**
* Allows you to set up a convention for mapping module folders to view folders. modulesPath is a string in the path that will be replaced by viewsPath. Partial views will be mapped to the "views" folder unless an areasPath is specified. All parameters are optional. If none are specified, the convention will map modules in a "viewmodels" folder to views in a "views" folder.
*/
export var useConvention: (modulesPath?: string, viewsPath?: string, areasPath?: string) => string;
/**
* This function takes in an object instance, which it then maps to a view id. That id is then passed to the locateView function and it is processed as above. If elementsToSearch are provided, those are passed along to locateView. Following is a description of how locateViewForObject determines the view for a given object instance.
*/
export var locateViewForObject: (obj: {}, elementsToSearch: HTMLElement[]) => JQueryPromise<any>;
/**
* This function does nothing by default which is why editCustomer.js is mapped to editCustomer.html (both have the same underlying id of editCustomer). Replace this function with your own implementation to easily create your own mapping logic based on moduleId.
*/
export var convertModuleIdToViewId: (moduleId: string) => string;
/**
* As mentioned above, if no view id can be determined, the system falls back to attempting to determine the object's type and then uses that. This function contains the implementation of that fallback behavior. Replace it if you desire something different. Under normal usage however, this function should not be called.
*/
export var determineFallbackViewId: (obj: any) => string;
/**
* When a view area is specified, it along with the requested view id will be passed to this function, allowing you to customize the path of your view. You can specify area as part of the locateView call, but more commonly you would specify it as part of a compose binding. Any compose binding that does not include a model, but only a view, has a default area of 'partial'.
*/
export var translateViewIdToArea: (viewId: string, area?: string) => string;
/**
* The viewOrUrlOrId parameter represents a url/id for the view. The file extension is not necessary (ie. .html). When this function is called, the viewEngine will be used to construct the view. The viewEngine is passed the finalized id and returns a constructed DOM sub-tree, which is returned from this function. If the viewOrUrlOrId is not a string but is actually a DOM node, then the DOM node will be immediately returned. Optionally, you can pass an area string and it along with the url will be passed to the view locator's translateViewIdToArea before constructing the final id to pass to the view engine. If you provide an array of DOM elements for elementsToSearch, before we call the view engine, we will search the existing array for a match and return it if found.
*/
export var locateView: (viewOrUrlOrId: any, area: string, elementsToSearch: HTMLElement[]) => JQueryPromise<any>;
}
declare module "durandal/viewModel" {
/**
* A property which is the home to some basic settings and functions that control how all activators work. These are used to create the instance settings object for each activator. They can be overriden on a per-instance-basis by passing a settings object when creating an activator or by accessing the settings property of the activator. To change them for all activators, change them on the defaults property. The two most common customizations are presented below. See the source for additional information.
*/
export var defaults: IViewModelDefaults;
/**
* This creates a computed observable which enforces a lifecycle on all values the observable is set to. When creating the activator, you can specify an initialActiveItem to activate. You can also specify a settings object. Use of the settings object is for advanced scenarios and will not be detailed much here.
*/
export var activator: {
(): IDurandalViewModelActiveItem;
(initialActiveItem: any, settings?: IViewModelDefaults): IDurandalViewModelActiveItem;
};
}
declare module "durandal/viewModelBinder" {
/**
* Applies bindings to a view using a pre-existing bindingContext. This is used by the composition module when a view is supplied without a model. It allows the parent binding context to be preserved. If the optional obj parameter is supplied, a new binding context will be created that is a child of bindingContext with its model set to obj. This is used by the widget framework to provide the widget binding while allowing templated parts to access their surrounding scope.
*/
export var bindContext: (bindingContext: KnockoutBindingContext, view: HTMLElement, obj?: any) => void;
/**
* Databinds obj, which can be an arbitrary object, to view which is a dom sub-tree. If obj has a function called setView, then, following binding, this function will be called, providing obj with an opportunity to interact directly with the dom fragment that it is bound to.
*/
export var bind: (obj: any, view: HTMLElement) => void;
}
interface IViewModelDefaults {
/**
* When the activator attempts to activate an item as described below, it will only activate the new item, by default, if it is a different instance than the current. Overwrite this function to change that behavior.
*/
areSameItem(currentItem, newItem, activationData): boolean;
/**
* default is true
*/
closeOnDeactivate: boolean;
/**
* Interprets values returned from guard methods like canActivate and canDeactivate by transforming them into bools. The default implementation translates string values "Yes" and "Ok" as true...and all other string values as false. Non string values evaluate according to the truthy/falsey values of JavaScript. Replace this function with your own to expand or set up different values. This transformation is used by the activator internally and allows it to work smoothly in the common scenario where a deactivated item needs to show a message box to prompt the user before closing. Since the message box returns a promise that resolves to the button option the user selected, it can be automatically processed as part of the activator's guard check.
*/
interpretResponse(value: any): boolean;
/**
* called before activating a module
*/
beforeActivate(newItem: any): any;
/**
* called after deactivating a module
*/
afterDeactivate(): any;
}
interface IDurandalViewModelActiveItem {
/**
* knockout observable
*/
(val?): any;
/**
* A property which is the home to some basic settings and functions that control how all activators work. These are used to create the instance settings object for each activator. They can be overriden on a per-instance-basis by passing a settings object when creating an activator or by accessing the settings property of the activator. To change them for all activators, change them on the defaults property. The two most common customizations are presented below. See the source for additional information.
*/
settings: IViewModelDefaults;
/**
* This observable is set internally by the activator during the activation process. It can be used to determine if an activation is currently happening.
*/
isActivating(val?: boolean): boolean;
/**
* Pass a specific item as well as an indication of whether it should be closed, and this function will tell you the answer.
*/
canDeactivateItem(item, close): JQueryPromise<any>;
/**
* Deactivates the specified item (optionally closing it). Deactivation follows the lifecycle and thus only works if the item can be deactivated.
*/
deactivateItem(item, close): JQueryDeferred<any>;
/**
* Determines if a specific item can be activated. You can pass an arbitrary object to this function, which will be passed to the item's canActivate function , if present. This is useful if you are manually controlling activation and you want to provide some context for the operation.
*/
canActivateItem(newItem, activationData?): JQueryPromise<any>;
/**
* Activates a specific item. Activation follows the lifecycle and thus only occurs if possible. activationData functions as stated above.
*/
activateItem(newItem, activationData?): JQueryPromise<any>;
/**
* Checks whether or not the activator itself can be activated...that is whether or not it's current item or initial value can be activated.
*/
canActivate(): JQueryPromise<any>;
/**
* Activates the activator...that is..it activates it's current item or initial value.
*/
activate(): JQueryPromise<any>;
/**
* Checks whether or not the activator itself can be deactivated...that is whether or not it's current item can be deactivated.
*/
canDeactivate(): JQueryPromise<any>;
/**
* Deactivates the activator...interpreted as deactivating its current item.
*/
deactivate(): JQueryDeferred<any>;
/**
* Adds canActivate, activate, canDeactivate and deactivate functions to the provided model which pass through to the corresponding functions on the activator.
*/
includeIn(includeIn: any): JQueryPromise<any>;
/**
* Sets up a collection representing a pool of objects which the activator will activate. See below for details. Activators without an item boolean always close their values on deactivate. Activators with an items pool only deactivate, but do not close them.
*/
forItems(items): IDurandalViewModelActiveItem;
}
/**
* A router plugin, currently based on SammyJS. The router abstracts away the core configuration of Sammy and re-interprets it in terms of durandal's composition and activation mechanism. To use the router, you must require it, configure it and bind it in the UI.
* Documentation at http://durandaljs.com/documentation/Router/
*/
declare module "durandal/plugins/router" {
/**
* Parameters to the map function. or information on route url patterns, see the SammyJS documentation. But
* basically, you can have simple routes my/route/, parameterized routes customers/:id or Regex routes. If you
* have a parameter in your route, then the activation data passed to your module's activate function will have a
* property for every parameter in the route (rather than the splat array, which is only present for automapped
* routes).
*/
interface IRouteInfo {
url: string;
moduleId: string;
name: string;
/** used to set the document title */
caption: string;
/** determines whether or not to include it in the router's visibleRoutes array for easy navigation UI binding */
visible: boolean;
settings: Object;
hash: string;
/** only present on visible routes to track if they are active in the nav */
isActive?: KnockoutComputed<boolean>;
}
/**
* Parameters to the map function. e only required parameter is url the rest can be derived. The derivation
* happens by stripping parameters from the url and casing where appropriate. You can always explicitly provide
* url, name, moduleId, caption, settings, hash and visible. In 99% of situations, you should not need to provide
* hash; it's just there to simplify databinding for you. Most of the time you may want to teach the router how
* to properly derive the moduleId and name based on a url. If you want to do that, overwrite.
*/
interface IRouteInfoParameters {
/** your url pattern. The only required parameter */
url: any;
/** if not supplied, router.convertRouteToName derives it */
moduleId?: string;
/** if not supplied, router.convertRouteToModuleId derives it */
name?: string;
/** used to set the document title */
caption?: string;
/** determines whether or not to include it in the router's visibleRoutes array for easy navigation UI binding */
visible?: boolean;
settings?: Object;
}
/**
* observable that is called when the router is ready
*/
export var ready: KnockoutObservable<boolean>;
/**
* An observable array containing all route info objects.
*/
export var allRoutes: KnockoutObservableArray<IRouteInfo>;
/**
* An observable array containing route info objects configured with visible:true (or by calling the mapNav function).
*/
export var visibleRoutes: KnockoutObservableArray<IRouteInfo>;
/**
* An observable boolean which is true while navigation is in process; false otherwise.
*/
export var isNavigating: KnockoutObservable<boolean>;
/**
* An observable whose value is the currently active item/module/page.
*/
export var activeItem: IDurandalViewModelActiveItem;
/**
* An observable whose value is the currently active route.
*/
export var activeRoute: KnockoutObservable<IRouteInfo>;
/**
* called after an a new module is composed
*/
export var afterCompose: () => void;
/**
* Returns the activatable instance from the supplied module.
*/
export var getActivatableInstance: (routeInfo: IRouteInfo, params: any, module: any) => any;
/**
* Causes the router to move backwards in page history.
*/
export var navigateBack: () => void;
/**
* Use router default convention.
*/
export var useConvention: () => void;
/**
* Causes the router to navigate to a specific url.
*/
export var navigateTo: (url: string) => void;
/**
* replaces the windows.location w/ the url
*/
export var replaceLocation: (url: string) => void;
/**
* akes a route in and returns a calculated name.
*/
export var convertRouteToName: (route: string) => string;
/**
* Takes a route in and returns a calculated moduleId. Simple transformations of this can be done via the useConvention function above. For more advanced transformations, you can override this function.
*/
export var convertRouteToModuleId: (url: string) => string;
/**
* This can be overwritten to provide your own convention for automatically converting routes to module ids.
*/
export var autoConvertRouteToModuleId: (url: string) => string;
/**
* This should not normally be overwritten. But advanced users can override this to completely transform the developer's routeInfo input into the final version used to configure the router.
*/
export var prepareRouteInfo: (info: IRouteInfo) => void;
/**
* This should not normally be overwritten. But advanced users can override this to completely transform the developer's routeInfo input into the final version used to configure the router.
*/
export var handleInvalidRoute: (route: IRouteInfo, parameters: any) => void;
/**
* Once the router is required, you can call router.mapAuto(). This is the most basic configuration option. When you call this function (with no parameters) it tells the router to directly correlate route parameters to module names in the viewmodels folder.
*/
export var mapAuto: (path?: string) => void;
/**
* Works the same as mapRoute except that routes are automatically added to the visibleRoutes array.
*/
export var mapNav: (url: string, moduleId?: string, name?: string) => IRouteInfo;
/**
* You can pass a single routeInfo to this function, or you can pass the basic configuration parameters. url is your url pattern, moduleId is the module path this pattern will map to, name is used as the document title and visible determines whether or not to include it in the router's visibleRoutes array for easy navigation UI binding.
*/
export var mapRoute: {
(route: IRouteInfoParameters): IRouteInfo;
(url: string, moduleId?: string, name?: string, visible?: boolean): IRouteInfo;
}
/**
* This function takes an array of routeInfo objects or a single routeInfo object and uses it to configure the router. The finalized routeInfo (or array of infos) is returned.
*/
export var map: {
(routeOrRouteArray: IRouteInfoParameters): IRouteInfo;
(routeOrRouteArray: IRouteInfoParameters[]): IRouteInfo[];
}
/**
* After you've configured the router, you need to activate it. This is usually done in your shell. The activate function of the router returns a promise that resolves when the router is ready to start. To use the router, you should add an activate function to your shell and return the result from that. The application startup infrastructure of Durandal will detect your shell's activate function and call it at the appropriate time, waiting for it's promise to resolve. This allows Durandal to properly orchestrate the timing of composition and databinding along with animations and splash screen display.
*/
export var activate: (defaultRoute: string) => JQueryPromise<any>;
/**
* Before any route is activated, the guardRoute funtion is called. You can plug into this function to add custom logic to allow, deny or redirect based on the requested route. To allow, return true. To deny, return false. To redirect, return a string with the hash or url. You may also return a promise for any of these values.
*/
export var guardRoute: (routeInfo: IRouteInfo, params: any, instance: any) => any;
}
declare module "durandal/widget" {
/**
* Use this function to create a widget through code. The element should reference a dom element that the widget will be created on. The settings can be either a string or an object. If it's a string, it should specify the widget kind. If it's an object, it represents settings that will be passed along to the widget. This object should have a kind property used to identify the widget kind to create. Optionally, you can specify a bindingContext of which you want the widget's binding context to be created as a child.
*/
export function create(element: any, settings: any, bindingContext?: any);
/**
* By default, you can create widgets in html by using the widget binding extension. Calling registerKind allows you to easily create a custom binding handler for your widget kind. Without calling registerKind you might declare a widget binding for an expander control with
*/
export function registerKind(kind: string);
/**
* Use this to re-map a widget kind identifier to a new viewId or moduleId representing the 'skin' and 'behavior' respectively.
*/
export function mapKind(kind: string, viewId?: string, moduleId?: string);
/**
* Developers implementing widgets may wish to use this function to acquire the resolved template parts for a widget. Pass a single dom element or an array of elements and get back an object keyed by part name whose values are the dom elements corresponding to each part in that scope.
*/
export function getParts(elements: any): any;
/**
* (overrridable) Replace this to re-interpret the kind id as a module path. By default it does a lookup for any custom maps added through mapKind and then falls back to the path "durandal/widgets/{kind}/controller".
*/
export function convertKindToModuleId(kind): string;
/**
* (overridable) Replace this to re-interpret the kind id as a view id. The default does a lookup for any custom maps added through mapKind and then falls back to the path "durandal/widgets/{kind}/view".
*/
export function convertKindToViewId(kind): string;
}
interface IEventSubscription
{
/**
* This function adding callback to event subscription
*/
then(thenCallback: any): void;
/**
* This function removing current subscription from event handlers
*/
off(): void;
}

View File

@@ -116,13 +116,13 @@ declare module 'durandal/system' {
* @param {object} extension* Uses to extend the target object.
*/
export function extend(obj: any, ...extensions: any[]): any;
/**
* Uses a setTimeout to wait the specified milliseconds.
* @param {number} milliseconds The number of milliseconds to wait.
* @returns {JQueryPromise}
*/
export function wait(milliseconds: number): JQueryPromise;
export function wait(milliseconds: number): JQueryPromise<any>;
/**
* Gets all the owned keys of the specified object.
@@ -226,7 +226,7 @@ declare module 'durandal/viewEngine' {
* @returns {boolean} True if the url is a view url, false otherwise.
*/
export function isViewUrl(url: string):boolean;
/**
* Converts a view url into a view id.
* @param {string} url The url to convert.
@@ -389,7 +389,7 @@ declare module 'durandal/binder' {
* @param {object} [obj] The data to bind to, causing the creation of a child binding context if present.
*/
export function bindContext(bindingContext: KnockoutBindingContext, view: HTMLElement, obj?: any): BindingInstruction;
/**
* Binds the view, preserving the existing binding context. Optionally, a new context can be created, parented to the previous context.
* @param {object} obj The data to bind to.
@@ -463,7 +463,7 @@ declare module 'durandal/activator' {
* @returns {boolean}
*/
isActivating: KnockoutObservable<boolean>;
/**
* Determines whether or not the specified item can be deactivated.
* @param {object} item The item to check.
@@ -536,7 +536,7 @@ declare module 'durandal/activator' {
* @property {ActivatorSettings} defaults
*/
export var defaults: ActivatorSettings;
/**
* Creates a new activator.
* @method create
@@ -568,7 +568,7 @@ declare module 'durandal/viewLocator' {
* @param {string} [areasPath] Partial views are mapped to the "views" folder if not specified. Use this parameter to change their location.
*/
export function useConvention(modulesPath?: string, viewsPath?: string, areasPath?: string): void;
/**
* Maps an object instance to a view instance.
* @param {object} obj The object to locate the view for.
@@ -577,7 +577,7 @@ declare module 'durandal/viewLocator' {
* @returns {Promise} A promise of the view.
*/
export function locateViewForObject(obj: any, area:string, elementsToSearch?: HTMLElement[]): JQueryPromise<HTMLElement>;
/**
* Converts a module id into a view id. By default the ids are the same.
* @param {string} moduleId The module id.
@@ -599,7 +599,7 @@ declare module 'durandal/viewLocator' {
* @returns {string} The translated view id.
*/
export function translateViewIdToArea(viewId: string, area: string): string;
/**
* Locates the specified view.
* @param {string|DOMElement} view A view. It will be immediately returned.
@@ -608,7 +608,7 @@ declare module 'durandal/viewLocator' {
* @returns {Promise} A promise of the view.
*/
export function locateView(view: HTMLElement, area?: string, elementsToSearch?: HTMLElement[]): JQueryPromise<HTMLElement>;
/**
* Locates the specified view.
* @param {string|DOMElement} viewUrlOrId A view url or view id to locate.
@@ -732,7 +732,7 @@ declare module 'durandal/app' {
* The title of your application.
*/
export var title: string;
/**
* Shows a dialog via the dialog plugin.
* @param {object|string} obj The object (or moduleId) to display as a dialog.
@@ -740,7 +740,7 @@ declare module 'durandal/app' {
* @param {string} [context] The name of the dialog context to use. Uses the default context if none is specified.
* @returns {Promise} A promise that resolves when the dialog is closed and returns any data passed at the time of closing.
*/
export function showDialog(obj: any, activationData?: any, context?: string):JQueryPromise;
export function showDialog(obj: any, activationData?: any, context?: string):JQueryPromise<any>;
/**
* Shows a message box via the dialog plugin.
@@ -750,7 +750,7 @@ declare module 'durandal/app' {
* @returns {Promise} A promise that resolves when the message box is closed and returns the selected option.
*/
export function showMessage(message: string, title?: string, options?: string[]): JQueryPromise<string>;
/**
* Configures one or more plugins to be loaded and installed into the application.
* @method configurePlugins
@@ -763,7 +763,7 @@ declare module 'durandal/app' {
* Starts the application.
* @returns {promise}
*/
export function start(): JQueryPromise;
export function start(): JQueryPromise<any>;
/**
* Sets the root module/view for the application.
@@ -908,7 +908,7 @@ declare module 'plugins/dialog' {
owner: any;
context: DialogContext;
activator: activator.Activator<any>;
close(): JQueryPromise;
close(): JQueryPromise<any>;
settings: composition.CompositionContext;
}
@@ -947,7 +947,7 @@ declare module 'plugins/dialog' {
* @param {DialogContext} dialogContext The context to add.
*/
export function addContext(name: string, modalContext: DialogContext): void;
/**
* Gets the dialog model that is associated with the specified object.
* @param {object} obj The object for whom to retrieve the dialog.
@@ -969,7 +969,7 @@ declare module 'plugins/dialog' {
* @param {string} [context] The name of the dialog context to use. Uses the default context if none is specified.
* @returns {Promise} A promise that resolves when the dialog is closed and returns any data passed at the time of closing.
*/
export function show(obj: any, activationData?: any, context?: string): JQueryPromise;
export function show(obj: any, activationData?: any, context?: string): JQueryPromise<any>;
/**
* Shows a message box.
@@ -1121,14 +1121,14 @@ declare module 'plugins/http' {
* @default callback
*/
export var callbackParam: string;
/**
* Makes an HTTP GET request.
* @param {string} url The url to send the get request to.
* @param {object} [query] An optional key/value object to transform into query string parameters.
* @returns {Promise} A promise of the get response data.
*/
export function get(url: string, query?: Object): JQueryPromise;
export function get(url: string, query?: Object): JQueryPromise<any>;
/**
* Makes an JSONP request.
@@ -1137,15 +1137,15 @@ declare module 'plugins/http' {
* @param {string} [callbackParam] The name of the callback parameter the api expects (overrides the default callbackParam).
* @returns {Promise} A promise of the response data.
*/
export function jsonp(url: string, query?: Object, callbackParam?: string): JQueryPromise;
export function jsonp(url: string, query?: Object, callbackParam?: string): JQueryPromise<any>;
/**
* Makes an HTTP POST request.
* @param {string} url The url to send the post request to.
* @param {object} data The data to post. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
* @returns {Promise} A promise of the response data.
*/
export function post(url: string, data: Object): JQueryPromise;
export function post(url: string, data: Object): JQueryPromise<any>;
}
/**
@@ -1155,7 +1155,7 @@ declare module 'plugins/http' {
* @requires knockout
*/
declare module 'plugins/observable' {
function observable(obj: any, property: string): KnockoutObservable;
function observable(obj: any, property: string): KnockoutObservable<any>;
module observable {
/**
@@ -1171,7 +1171,7 @@ declare module 'plugins/observable' {
* @param {object} [original] The original value of the property. If not specified, it will be retrieved from the object.
* @returns {KnockoutObservable} The underlying observable.
*/
export function convertProperty(obj: any, propertyName: string, original?: any): KnockoutObservable;
export function convertProperty(obj: any, propertyName: string, original?: any): KnockoutObservable<any>;
/**
* Defines a computed property using ES5 getters and setters.
@@ -1703,7 +1703,7 @@ declare module 'durandal/typescript' {
* Activates the router and the underlying history tracking mechanism.
* @returns {Promise} A promise that resolves when the router is ready.
*/
activate(options?: history.HistoryOptions): JQueryPromise;
activate(options?: history.HistoryOptions): JQueryPromise<any>;
/**
* Disable history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
@@ -1715,4 +1715,4 @@ declare module 'durandal/typescript' {
*/
install(): void;
}
}
}

4
ember/ember.d.ts vendored
View File

@@ -204,7 +204,7 @@ interface EmberStatic {
$; // jQuery
// API Doc Members
A(arr: any[]): Ember.NativeArray;
A(arr: any[]): Ember.NativeArray<any>;
addBeforeObserver(obj: Object, path: string, target: Object, method: Function);
addListener(obj: Object, eventName: string, target: Object, method: Function);
addObserver(obj: Object, path: string, target: Object, method: Function);
@@ -292,4 +292,4 @@ interface EmberStatic {
wrap(func: Function, superFunc: Function);
}
declare var Em: EmberStatic;
declare var Em: EmberStatic;

View File

@@ -1,4 +1,4 @@
// Type definitions for Hammer.js 0.6
// Type definitions for Hammer.js 1.0.5
// Project: http://eightmedia.github.com/hammer.js/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -6,26 +6,36 @@
/// <reference path="../jquery/jquery.d.ts"/>
// Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options
interface HammerOptions {
prevent_default?: boolean;
css_hacks?: boolean;
swipe?: boolean;
swipe_time?: number;
swipe_min_distance?: number;
drag?: boolean;
drag_vertical?: boolean;
drag_horizontal?: boolean;
drag_block_horizontal?: boolean;
drag_block_vertical?: boolean;
drag_lock_to_axis?: boolean;
drag_max_touches?: number;
drag_min_distance?: number;
transform?: boolean;
scale_treshold?: number;
rotation_treshold?: number;
tap?: boolean;
tap_double?: boolean;
tap_max_interval?: number;
tap_max_distance?: number;
tap_double_distance?: number;
hold?: boolean;
hold_threshold?: number;
hold_timeout?: number;
prevent_default?: boolean;
prevent_mouseevents?: boolean;
release?: boolean;
show_touches?: boolean;
stop_browser_behavior?: any;
swipe?: boolean;
swipe_max_touches?: number;
swipe_velocity?: number;
tap?: boolean;
tap_always?: boolean;
tap_max_distance?: number;
tap_max_touchtime?: number;
doubletap_distance?: number;
doubletap_interval?: number;
touch?: boolean;
transform?: boolean;
transform_always_block?: boolean;
transform_min_rotation?: number;
transform_min_scale?: number;
}
interface HammerPoint {

92
i18next/i18next.d.ts vendored
View File

@@ -17,49 +17,49 @@ interface IResourceStoreKey {
}
interface I18nextOptions {
lng?: string; // Default value: undefined
load?: string; // Default value: 'all'
preload?: string[]; // Default value: []
lowerCaseLng?: boolean; // Default value: false
returnObjectTrees?: boolean; // Default value: false
fallbackLng?: string; // Default value: 'dev'
detectLngQS?: string; // Default value: 'setLng'
ns?: any; // Default value: 'translation' (string), can also be an object
nsseparator?: string; // Default value: '::'
keyseparator?: string; // Default value: '.'
selectorAttr?: string; // Default value: 'data-i18n'
debug?: boolean; // Default value: false
resGetPath?: string; // Default value: 'locales/__lng__/__ns__.json'
resPostPath?: string; // Default value: 'locales/add/__lng__/__ns__'
getAsync?: boolean; // Default value: true
postAsync?: boolean; // Default value: true
resStore?: IResourceStore; // Default value: undefined
useLocalStorage?: boolean; // Default value: false
localStorageExpirationTime?: number; // Default value: 7 * 24 * 60 * 60 * 1000 (in ms default one week)
dynamicLoad?: boolean; // Default value: false
sendMissing?: boolean; // Default value: false
sendMissingTo?: string; // Default value: 'fallback'. Other options are: current | all
sendType?: string; // Default value: 'POST'
interpolationPrefix?: string; // Default value: '__'
interpolationSuffix?: string; // Default value: '__'
reusePrefix?: string; // Default value: '$t('
reuseSuffix?: string; // Default value: ')'
pluralSuffix?: string; // Default value: '_plural'
pluralNotFound?: string; // Default value: ['plural_not_found' Math.random()].join( '' )
contextNotFound?: string; // Default value: ['context_not_found' Math.random()].join( '' )
setJqueryExt?: boolean; // Default value: true
defaultValueFromContent?: boolean; // Default value: true
useDataAttrOptions?: boolean; // Default value: false
cookieExpirationTime?: number; // Default value: undefined
useCookie?: boolean; // Default value: true
cookieName?: string; // Default value: 'i18next'
lng?: string; // Default value: undefined
load?: string; // Default value: 'all'
preload?: string[]; // Default value: []
lowerCaseLng?: boolean; // Default value: false
returnObjectTrees?: boolean; // Default value: false
fallbackLng?: string; // Default value: 'dev'
detectLngQS?: string; // Default value: 'setLng'
ns?: any; // Default value: 'translation' (string), can also be an object
nsseparator?: string; // Default value: '::'
keyseparator?: string; // Default value: '.'
selectorAttr?: string; // Default value: 'data-i18n'
debug?: boolean; // Default value: false
resGetPath?: string; // Default value: 'locales/__lng__/__ns__.json'
resPostPath?: string; // Default value: 'locales/add/__lng__/__ns__'
getAsync?: boolean; // Default value: true
postAsync?: boolean; // Default value: true
resStore?: IResourceStore; // Default value: undefined
useLocalStorage?: boolean; // Default value: false
localStorageExpirationTime?: number; // Default value: 7 * 24 * 60 * 60 * 1000 (in ms default one week)
dynamicLoad?: boolean; // Default value: false
sendMissing?: boolean; // Default value: false
sendMissingTo?: string; // Default value: 'fallback'. Other options are: current | all
sendType?: string; // Default value: 'POST'
interpolationPrefix?: string; // Default value: '__'
interpolationSuffix?: string; // Default value: '__'
reusePrefix?: string; // Default value: '$t('
reuseSuffix?: string; // Default value: ')'
pluralSuffix?: string; // Default value: '_plural'
pluralNotFound?: string; // Default value: ['plural_not_found' Math.random()].join( '' )
contextNotFound?: string; // Default value: ['context_not_found' Math.random()].join( '' )
setJqueryExt?: boolean; // Default value: true
defaultValueFromContent?: boolean; // Default value: true
useDataAttrOptions?: boolean; // Default value: false
cookieExpirationTime?: number; // Default value: undefined
useCookie?: boolean; // Default value: true
cookieName?: string; // Default value: 'i18next'
postProcess?: string; // Default value: undefined
}
@@ -83,8 +83,8 @@ interface I18nextStatic {
toLanguages(language: string): string[];
regexEscape(str: string): string;
};
init(callback?: (t: (key: string, options?: any) => string) => void ): JQueryDeferred;
init(options?: I18nextOptions, callback?: (t: (key: string, options?: any) => string) => void ): JQueryDeferred;
init(callback?: (t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
init(options?: I18nextOptions, callback?: (t: (key: string, options?: any) => string) => void ): JQueryDeferred<any>;
lng(): string;
loadNamespace(namespace: string, callback?: () => void ): void;
loadNamespaces(namespaces: string[], callback?: () => void ): void;
@@ -124,4 +124,4 @@ interface JQuery {
i18n: (options?: I18nextOptions) => void;
}
declare var i18next: I18nextStatic;
declare var i18next: I18nextStatic;

View File

@@ -1,6 +1,6 @@
// Type definitions for jQuery.form.js 3.26.0-2013.01.28
// Type definitions for jQuery.form.js 3.26.0-2013.01.28
// Project: http://malsup.com/jquery/form/
// Definitions by: François Guillot <http://fguillot.developpez.com/>
// Definitions by: François Guillot <http://fguillot.developpez.com/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

2
jquery/jquery.d.ts vendored
View File

@@ -774,6 +774,7 @@ interface JQuery {
nextUntil(selector?: string, filter?: string): JQuery;
nextUntil(element?: Element, filter?: string): JQuery;
nextUntil(obj?: JQuery, filter?: string): JQuery;
not(selector: string): JQuery;
not(func: (index: any) => any): JQuery;
@@ -796,6 +797,7 @@ interface JQuery {
prevUntil(selector?: string, filter?: string): JQuery;
prevUntil(element?: Element, filter?: string): JQuery;
prevUntil(obj?: JQuery, filter?: string): JQuery;
siblings(selector?: string): JQuery;

View File

@@ -9,7 +9,9 @@
interface JQueryMobileEvent { (event: Event, ui): void; }
interface DialogOptions {
closeBtn?: string;
closeBtnText?: string;
corners?: boolean;
initSelector?: string;
overlayTheme?: string;
}
@@ -105,6 +107,8 @@ interface CollapsibleSetEvents {
}
interface TextInputOptions {
clearBtn?: boolean;
clearBtnText?: string;
disabled?: boolean;
initSelector?: string;
mini?: boolean;
@@ -190,6 +194,14 @@ interface NavbarOptions {
iconpos: string;
}
interface ControlgroupOptions {
corners?: boolean;
excludeInvisible?: boolean;
mini?: boolean;
shadow?: boolean;
type?: string;
}
interface JQueryMobileOptions {
activeBtnClass?: string;
activePageClass?: string;
@@ -349,8 +361,10 @@ interface JQuery {
button(): JQuery;
button(command: string): JQuery;
buttonMarkup(options: ButtonOptions): JQuery;
button(options?: ButtonOptions): JQuery;
button(events: ButtonEvents): JQuery;
buttonMarkup(options?: ButtonOptions): JQuery;
collapsible(): JQuery;
collapsible(command: string): JQuery;
@@ -392,6 +406,10 @@ interface JQuery {
table(): JQuery;
table(command: string): JQuery;
controlgroup(): JQuery;
controlgroup(command: string): JQuery;
controlgroup(options: ControlgroupOptions): JQuery;
}

View File

@@ -498,7 +498,7 @@ declare module JQueryUI {
}
interface SortableEvent {
(event: Event, ui: SortableUIParams): void;
(event: JQueryEventObject, ui: SortableUIParams): void;
}
interface SortableEvents {
@@ -955,7 +955,7 @@ interface JQuery {
slider(methodName: 'values', index: number): number;
slider(methodName: string, index: number, value: number): void;
slider(methodName: 'values', index: number, value: number): void;
slider(methodName: string, values: Array<number>): void;
slider(methodName: string, values: Array<number>): void;
slider(methodName: 'values', values: Array<number>): void;
slider(methodName: 'widget'): JQuery;
slider(options: JQueryUI.SliderOptions): JQuery;

View File

@@ -808,7 +808,7 @@ declare module L {
* Subdomains of the tile service. Can be passed in the form of one string (where
* each letter is a subdomain name) or an array of strings.
*/
subdomains?: string;
subdomains?: any;
/**
* URL to the tile image to show in place of the tile that failed to load.

18
node/node.d.ts vendored
View File

@@ -246,7 +246,7 @@ declare module "http" {
export interface ServerRequest extends events.NodeEventEmitter, stream.ReadableStream {
method: string;
url: string;
headers: string;
headers: any;
trailers: string;
httpVersion: string;
setEncoding(encoding?: string): void;
@@ -351,13 +351,13 @@ declare module "zlib" {
export interface InflateRaw extends stream.ReadWriteStream { }
export interface Unzip extends stream.ReadWriteStream { }
export function createGzip(options: ZlibOptions): Gzip;
export function createGunzip(options: ZlibOptions): Gunzip;
export function createDeflate(options: ZlibOptions): Deflate;
export function createInflate(options: ZlibOptions): Inflate;
export function createDeflateRaw(options: ZlibOptions): DeflateRaw;
export function createInflateRaw(options: ZlibOptions): InflateRaw;
export function createUnzip(options: ZlibOptions): Unzip;
export function createGzip(options?: ZlibOptions): Gzip;
export function createGunzip(options?: ZlibOptions): Gunzip;
export function createDeflate(options?: ZlibOptions): Deflate;
export function createInflate(options?: ZlibOptions): Inflate;
export function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
export function createInflateRaw(options?: ZlibOptions): InflateRaw;
export function createUnzip(options?: ZlibOptions): Unzip;
export function deflate(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void;
export function deflateRaw(buf: NodeBuffer, callback: (error: Error, result: any) =>void ): void;
@@ -1083,4 +1083,4 @@ declare module "domain" {
export function bind(cb: (er: Error, data: any) =>any): any;
export function intercept(cb: (data: any) => any): any;
export function dispose(): void;
}
}

View File

@@ -363,6 +363,7 @@ interface LocalFileSystem {
interface LocalFileSystem {
PERSISTENT: number;
TEMPORARY: number;
}
declare var LocalFileSystem: LocalFileSystem;
@@ -373,6 +374,20 @@ interface Metadata {
interface FileError {
code: number;
}
declare var FileError: {
NOT_FOUND_ERR: number;
SECURITY_ERR: number;
ABORT_ERR: number;
NOT_READABLE_ERR: number;
ENCODING_ERR: number;
NO_MODIFICATION_ALLOWED_ERR: number;
INVALID_STATE_ERR: number;
SYNTAX_ERR: number;
INVALID_MODIFICATION_ERR: number;
QUOTA_EXCEEDED_ERR: number;
TYPE_MISMATCH_ERR: number;
PATH_EXISTS_ERR: number;
}
interface FileTransferError {
code: number;
@@ -380,6 +395,12 @@ interface FileTransferError {
target: string;
http_status: number;
}
declare var FileTransferError: {
FILE_NOT_FOUND_ERR: number;
INVALID_URL_ERR: number;
CONNECTION_ERR: number;
ABORT_ERR: number;
}
interface GeolocationOptions {
enableHighAccuracy?: boolean;

View File

@@ -307,5 +307,6 @@ interface RequireDefine {
}
// Ambient declarations for 'require' and 'define'
declare var requirejs: Require;
declare var require: Require;
declare var define: RequireDefine;

View File

@@ -72,12 +72,12 @@ declare module Sys {
getAllResponseHeaders(): string;
getResponseHeader(key: string): string;
}
export class NetworkRequestEventArgs extends EventArgs {
get_webRequest(): WebRequest;
}
export class WebRequestManager {
static get_defaultExecutorType(): string;
static set_defaultExecutorType(value: string): void;
@@ -86,10 +86,10 @@ declare module Sys {
static executeRequest(request: WebRequest):void;
static add_completedRequest(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void ): void;
static remove_completedRequest(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void ): void;
static remove_completedRequest(handler: (executor: WebRequestExecutor, args: Sys.EventArgs) => void ): void;
static add_invokingRequest(handler: (executor: WebRequestExecutor, args: NetworkRequestEventArgs) => void ): void;
static remove_invokingRequest(handler: (executor: WebRequestExecutor, args: NetworkRequestEventArgs ) => void ): void;
}
static remove_invokingRequest(handler: (executor: WebRequestExecutor, args: NetworkRequestEventArgs ) => void ): void;
}
export class WebServiceProxy {
static invoke(
@@ -104,7 +104,7 @@ declare module Sys {
enableJsonp?: boolean,
jsonpCallbackParameter?: string): WebRequest;
}
export class WebServiceError {
get_errorObject(): any;
get_exceptionType(): any;
@@ -263,7 +263,7 @@ interface MQuery
(element: HTMLElement): MQueryResultSetElements;
(object: MQueryResultSetElements): MQueryResultSetElements;
<T>(object: MQueryResultSet<T>): MQueryResultSet<T>;
<T>(object: T): MQueryResultSet<T>;
<T>(object: T): MQueryResultSet<T>;
(elementArray: HTMLElement[]): MQueryResultSetElements;
<T>(array: T[]): MQueryResultSet<T>;
<T>(): MQueryResultSet<T>;
@@ -330,7 +330,7 @@ interface MQuery
data(element: HTMLElement, key: string): any;
data(element: HTMLElement): any;
removeData(element: HTMLElement, name?: string): MQueryResultSet;
removeData(element: HTMLElement, name?: string): MQueryResultSet<any>;
hasData(element: HTMLElement): boolean;
}
@@ -341,10 +341,10 @@ interface MQueryResultSetElements extends MQueryResultSet<HTMLElement>{
bind(eventType: string, handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements;
unbind(eventType: string, handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements;
trigger(eventType: string): MQueryResultSet;
trigger(eventType: string): MQueryResultSet<any>;
one(eventType: string, handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements;
detach(): MQueryResultSet;
detach(): MQueryResultSet<any>;
find(selector: string): MQueryResultSetElements;
closest(selector: string, context?: any): MQueryResultSetElements;
@@ -442,26 +442,26 @@ interface MQueryResultSetElements extends MQueryResultSet<HTMLElement>{
submit(): MQueryResultSetElements;
submit(handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements;
unload(): MQueryResultSetElements;
unload(handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements;
unload(handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements;
}
interface MQueryResultSet<T> {
interface MQueryResultSet<T> {
[index: number]: T;
contains(contained: T): boolean;
filter(fn: (elementOfArray: T, indexInArray: number) => boolean, context?: any): MQueryResultSet<T>;
filter(fn: (elementOfArray: T) => boolean, context?: any): MQueryResultSet<T>;
filter(fn: (elementOfArray: T) => boolean, context?: any): MQueryResultSet<T>;
every(fn: (elementOfArray: T, indexInArray: number) => boolean, context?: any): boolean;
every(fn: (elementOfArray: T) => boolean, context?: any): boolean;
some(fn: (elementOfArray: T, indexInArray: number) => boolean, context?: any): boolean;
some(fn: (elementOfArray: T) => boolean, context?: any): boolean;
map(callback: (elementOfArray: T, indexInArray: number) => any): MQueryResultSet<T>;
map(callback: (elementOfArray: T) => any): MQueryResultSet<T>;
forEach(fn: (elementOfArray: T, indexInArray: number) => void, context?: any): void;
forEach(fn: (elementOfArray: T) => void, context?: any): void;
@@ -1212,7 +1212,7 @@ declare module SPClientTemplates {
export interface TemplateOverrides {
View?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template
Body?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template
Body?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template
/** Defines templates for rendering groups (aggregations). */
Group?: GroupCallback;
/** Defines templates for list items rendering. */
@@ -1236,10 +1236,10 @@ declare module SPClientTemplates {
/** <20>allbacks called after rendered html inserted into DOM. Can be function (ctx: RenderContext) => void or array of functions.*/
OnPostRender?: any;
/** View style (SPView.StyleID) for which the templates should be applied.
/** View style (SPView.StyleID) for which the templates should be applied.
If not defined, the templates will be applied only to default view style. */
ViewStyle?: number;
/** List template type (SPList.BaseTemplate) for which the template should be applied.
/** List template type (SPList.BaseTemplate) for which the template should be applied.
If not defined, the templates will be applied to all lists. */
ListTemplateType?: number;
/** Base view ID (SPView.BaseViewID) for which the template should be applied.
@@ -2249,8 +2249,8 @@ declare module SP {
get_versionString(): string;
}
export class AppCatalog {
static getAppInstances(context: SP.ClientRuntimeContext, web: SP.Web): SP.ClientObjectList;
static getDeveloperSiteAppInstancesByIds(context: SP.ClientRuntimeContext, site: SP.Site, appInstanceIds: SP.Guid[]): SP.ClientObjectList;
static getAppInstances(context: SP.ClientRuntimeContext, web: SP.Web): SP.ClientObjectList<any>;
static getDeveloperSiteAppInstancesByIds(context: SP.ClientRuntimeContext, site: SP.Site, appInstanceIds: SP.Guid[]): SP.ClientObjectList<any>;
static isAppSideloadingEnabled(context: SP.ClientRuntimeContext): SP.BooleanResult;
}
export class AppContextSite extends SP.ClientObject {
@@ -2271,7 +2271,7 @@ declare module SP {
get_status(): SP.AppInstanceStatus;
get_title(): string;
get_webId(): SP.Guid;
getErrorDetails(): SP.ClientObjectList;
getErrorDetails(): SP.ClientObjectList<any>;
uninstall(): SP.GuidResult;
upgrade(appPackageStream: any[]): void;
cancelAllJobs(): SP.BooleanResult;
@@ -2402,12 +2402,12 @@ declare module SP {
/** Specifies a Collaborative Application Markup Language (CAML) query on a list. */
export class CamlQuery extends SP.ClientValueObject {
constructor();
/** This method creates a Collaborative Application Markup Language (CAML) string
that can be used to recursively get all of the items in a list, including
/** This method creates a Collaborative Application Markup Language (CAML) string
that can be used to recursively get all of the items in a list, including
the items in the subfolders. */
static createAllItemsQuery(): SP.CamlQuery;
/** This method creates a Collaborative Application Markup Language (CAML) string
that can be used to recursively get all of the folders in a list, including
/** This method creates a Collaborative Application Markup Language (CAML) string
that can be used to recursively get all of the folders in a list, including
the subfolders. */
static createAllFoldersQuery(): SP.CamlQuery;
/** Returns true if the query returns dates in Coordinated Universal Time (UTC) format. */
@@ -3686,7 +3686,7 @@ declare module SP {
choiceField,
minMaxField,
textField,
}
}
/** Represents an item or row in a list. */
export class ListItem extends SP.SecurableObject {
get_fieldValues(): any;
@@ -3921,7 +3921,7 @@ declare module SP {
get_isSharedWithMany(): boolean;
get_isSharedWithSecurityGroup(): boolean;
get_pendingAccessRequestsLink(): string;
getSharedWithUsers(): SP.ClientObjectList;
getSharedWithUsers(): SP.ClientObjectList<any>;
static getListItemSharingInformation(context: SP.ClientRuntimeContext, listID: SP.Guid, itemID: number, excludeCurrentUser: boolean, excludeSiteAdmin: boolean, excludeSecurityGroups: boolean, retrieveAnonymousLinks: boolean, retrieveUserInfoDetails: boolean, checkForAccessRequests: boolean): SP.ObjectSharingInformation;
static getWebSharingInformation(context: SP.ClientRuntimeContext, excludeCurrentUser: boolean, excludeSiteAdmin: boolean, excludeSecurityGroups: boolean, retrieveAnonymousLinks: boolean, retrieveUserInfoDetails: boolean, checkForAccessRequests: boolean): SP.ObjectSharingInformation;
static getObjectSharingInformation(context: SP.ClientRuntimeContext, securableObject: SP.SecurableObject, excludeCurrentUser: boolean, excludeSiteAdmin: boolean, excludeSecurityGroups: boolean, retrieveAnonymousLinks: boolean, retrieveUserInfoDetails: boolean, checkForAccessRequests: boolean, retrievePermissionLevels: boolean): SP.ObjectSharingInformation;
@@ -4193,7 +4193,7 @@ declare module SP {
editor,
}
export class ServerSettings {
static getAlternateUrls(context: SP.ClientRuntimeContext): SP.ClientObjectList;
static getAlternateUrls(context: SP.ClientRuntimeContext): SP.ClientObjectList<any>;
static getGlobalInstalledLanguages(context: SP.ClientRuntimeContext, compatibilityLevel: number): SP.Language[];
}
export class Site extends SP.ClientObject {
@@ -4644,7 +4644,7 @@ declare module SP {
getAppBdcCatalog(): SP.BusinessData.AppBdcCatalog;
getSubwebsForCurrentUser(query: SP.SubwebQuery): SP.WebCollection;
getAppInstanceById(appInstanceId: SP.Guid): SP.AppInstance;
getAppInstancesByProductId(productId: SP.Guid): SP.ClientObjectList;
getAppInstancesByProductId(productId: SP.Guid): SP.ClientObjectList<any>;
loadAndInstallAppInSpecifiedLocale(appPackageStream: any[], installationLocaleLCID: number): SP.AppInstance;
loadApp(appPackageStream: any[], installationLocaleLCID: number): SP.AppInstance;
loadAndInstallApp(appPackageStream: any[]): SP.AppInstance;
@@ -5819,7 +5819,7 @@ declare module SP {
/** Contains information about an actor retrieved from server. An actor is a user, document, site, or tag. */
export class SocialActor extends SP.ClientValueObject {
/** The AccountName property returns the user account name.
/** The AccountName property returns the user account name.
This property is only available for social actors of type "user". */
get_accountName(): string;
/** Identifies whether the actor is a user, document, site, or tag. */
@@ -5850,7 +5850,7 @@ declare module SP {
get_personalSiteUri(): string;
/** Represents the status of retrieving the actor */
get_status(): SocialStatusCode;
/** The StatusText property returns the most recent post of the user.
/** The StatusText property returns the most recent post of the user.
This property is only available for social actors of type "user". */
get_statusText(): string;
/** Returns the GUID of the tag.
@@ -5865,10 +5865,10 @@ declare module SP {
/** Identifies an actor to the server. An actor can be a user, document, site, or tag. */
export class SocialActorInfo extends SP.ClientValueObject {
/** User account name.
/** User account name.
This property is only available for social actors of type "user". */
get_accountName(): string;
/** User account name.
/** User account name.
This property is only available for social actors of type "user". */
set_accountName(value: string): string;
/** Identifies whether the actor is a user, document, site, or tag. */
@@ -5979,7 +5979,7 @@ declare module SP {
}
/** Provides information about an overlay.
An overlay is a substring in a post that represents a user, document, site, tag, or link.
An overlay is a substring in a post that represents a user, document, site, tag, or link.
The SocialPost class contains an array of SocialDataOverlay objects.
Each of the SocialDataOverlay objects specifies a link or one or more actors. */
export class SocialDataOverlay extends SP.ClientValueObject {
@@ -6016,8 +6016,8 @@ declare module SP {
The most recent post that was requested can be removed from the feed if the current user does not have access to it.
Consequently, the feed does not always contain the post with the date specified in this property. */
get_newestProcessed(): string;
/** The OldestProcessed property returns the date-time of the oldest post that was requested.
The oldest post that was requested can be removed from the feed if the current user does not have access to it.
/** The OldestProcessed property returns the date-time of the oldest post that was requested.
The oldest post that was requested can be removed from the feed if the current user does not have access to it.
Consequently, the feed does not always contain the post with the date specified in this property */
get_oldestProcessed(): string;
/** Contains the social threads in the feed. */
@@ -6034,7 +6034,7 @@ declare module SP {
get_owner(): SocialActor;
/** Specifies the URI of the personal site portal. */
get_personalSitePortalUri(): string;
/** Creates a post in the current user's newsfeed, in the specified user's feed, or in the specified thread.
/** Creates a post in the current user's newsfeed, in the specified user's feed, or in the specified thread.
This method returns a new or a modified thread.
@param targetId Optional, specifies the target of the post.
If this parameter is null, the post is created as a root post in the current user's feed.
@@ -6067,19 +6067,19 @@ declare module SP {
getFullThread(threadId: string): SocialThread;
/** Returns a feed containing mention reference threads from the current user's personal feed. */
getMentions(clearUnreadMentions: boolean, options: SocialFeedOptions): SocialFeed;
/** Returns the server's count of unread mentions of the current user.
The server maintains a count of unread mentions in posts, but does not track which mentions have been read.
When a new mention is stored on the server, it increments the unread mention for the user specified by the mention.
/** Returns the server's count of unread mentions of the current user.
The server maintains a count of unread mentions in posts, but does not track which mentions have been read.
When a new mention is stored on the server, it increments the unread mention for the user specified by the mention.
The unread mention count is cleared by the GetMentions method. */
getUnreadMentionCount(): SP.IntResult;
/** Specifies that the current user likes the specified post.
Returns a digest thread containing the specified post.
/** Specifies that the current user likes the specified post.
Returns a digest thread containing the specified post.
A digest thread contains the root post and a selection of reply posts */
likePost(postId: string): SocialThread;
/** Specifies that the current user does not like the specified post.
/** Specifies that the current user does not like the specified post.
Returns a digest thread containing the specified post. */
unlikePost(postId: string): SocialThread;
/** Prevents any user from adding a new reply post to the specified thread.
/** Prevents any user from adding a new reply post to the specified thread.
Once a thread is locked, no new reply posts can be added until after the thread has been unlocked with the unlockThread method.
This method returns a digest of the locked thread */
lockThread(threadId: string): SocialThread;
@@ -6119,9 +6119,9 @@ declare module SP {
get_followedSitesUri(): string;
/** Adds the specified actor to the current user's list of followed items.
Returns one of the following values, wrapped into the SP.IntResult object:
0 = ok,
1 = alreadyFollowing,
2 = limitReached,
0 = ok,
1 = alreadyFollowing,
2 = limitReached,
3 = internalError */
follow(actor: SocialActorInfo): SP.IntResult;
stopFollowing(actor: SocialActorInfo): SP.BooleanResult;
@@ -6254,10 +6254,10 @@ declare module SP {
get_text(): string;
/** Specifies the text that is substituted for the placeholder */
set_text(value: string): string;
/** Specifies the URI of the document, site, or link.
/** Specifies the URI of the document, site, or link.
This property is only available if the ItemType property specifies that the item is a Document, Link, or Site. */
get_uri(): string;
/** Specifies the URI of the document, site, or link.
/** Specifies the URI of the document, site, or link.
This property is only available if the ItemType property specifies that the item is a Document, Link, or Site. */
set_uri(value: string): string;
}
@@ -7134,7 +7134,7 @@ declare module SP {
/** Gets suggestions for who the current user might want to follow.
Note: The recommended API to use for this task is SocialFollowingManager.getSuggestions.
Returns list of PersonProperties objects */
getMySuggestions(): SP.ClientObjectList;
getMySuggestions(): SP.ClientObjectList<any>;
/** Removes the specified user from the user's list of suggested people to follow. */
hideSuggestion(accountName: string): void;
follow(accountName: string): void;
@@ -7146,10 +7146,10 @@ declare module SP {
@param tagId GUID of the tag to stop following. */
stopFollowingTag(tagId: string): void;
amIFollowing(accountName: string): SP.BooleanResult;
getPeopleFollowedByMe(): SP.ClientObjectList;
getPeopleFollowedBy(accountName: string): SP.ClientObjectList;
getMyFollowers(): SP.ClientObjectList;
getFollowersFor(accountName: string): SP.ClientObjectList;
getPeopleFollowedByMe(): SP.ClientObjectList<any>;
getPeopleFollowedBy(accountName: string): SP.ClientObjectList<any>;
getMyFollowers(): SP.ClientObjectList<any>;
getFollowersFor(accountName: string): SP.ClientObjectList<any>;
amIFollowedBy(accountName: string): SP.BooleanResult;
/** Uploads and sets the user profile picture.
Pictures in bmp, jpg and png formats and up to 5,000,000 bytes are supported.
@@ -7225,7 +7225,7 @@ declare module SP {
/** Specifies the person's title. */
get_title(): string;
/** Represents all user profile properties including custom.
The privacy settings affect which properties can be retrieved.
The privacy settings affect which properties can be retrieved.
Multiple values are delimited by the vertical bar "|".
Null values are specified as empty strings. */
get_userProfileProperties(): { [name: string]: string; };
@@ -7314,7 +7314,7 @@ declare module SP {
/** Updates the properties for followed item with specified URL.
@param url URL that identifies the followed item.
The url parameter can identify an existing document or site using the url property of the original item.
The url parameter can also identify a document with the following format: http://host/site?listId=<listGuid>&itemId=<itemId>
The url parameter can also identify a document with the following format: http://host/site?listId=<listGuid>&itemId=<itemId>
@param data Application-defined data stored with the followed item. */
updateData(url: string, data: FollowedItemData): void;
/** Returns the refreshed item that is being pointed to in the Social list.
@@ -7384,11 +7384,11 @@ declare module SP {
/** Specifies the site identification (GUID) in the Content database for this item if this item is a site, or for its parent site if this item is not a site. */
set_siteId(value: string): string;
/** Specifies the subtype of this item.
If the ItemType is Site, the Subtype specifies the web template identification.
If the ItemType is Site, the Subtype specifies the web template identification.
If the ItemType is Document, the Subtype has a value of 1. */
get_subtype(): number;
/** Specifies the subtype of this item.
If the ItemType is Site, the Subtype specifies the web template identification.
If the ItemType is Site, the Subtype specifies the web template identification.
If the ItemType is Document, the Subtype has a value of 1. */
set_subtype(value: number): number;
/** Specifies the item of this item */
@@ -7502,7 +7502,7 @@ declare module SP {
static getLayoutsPageUrl(pageName: string): string;
static getImageUrl(imageName: string): string;
static createWikiPageInContextWeb(context: SP.ClientRuntimeContext, parameters: SP.Utilities.WikiPageCreationInformation): SP.File;
static localizeWebPartGallery(context: SP.ClientRuntimeContext, items: SP.ListItemCollection): SP.ClientObjectList;
static localizeWebPartGallery(context: SP.ClientRuntimeContext, items: SP.ListItemCollection): SP.ClientObjectList<any>;
static getAppLicenseInformation(context: SP.ClientRuntimeContext, productId: SP.Guid): SP.AppLicenseCollection;
static importAppLicense(context: SP.ClientRuntimeContext, licenseTokenToImport: string, contentMarket: string, billingMarket: string, appName: string, iconUrl: string, providerName: string, appSubtype: number): void;
static getAppLicenseDeploymentId(context: SP.ClientRuntimeContext): SP.GuidResult;
@@ -7638,7 +7638,7 @@ declare module SP {
toString(): string;
}
}
export module DateTimeUtil {
export class SimpleDate {
construction(year: number, month: number, day: number, era: number);

171
should/should-tests.ts Normal file
View File

@@ -0,0 +1,171 @@
/// <reference path="should.d.ts" />
import should = require('should');
should.fail('actual', 'expected', 'msg', 'operator');
should.assert('value', 'msg');
should.ok('value');
should.equal('actual', 'expected');
should.notEqual('actual', 'expected');
should.deepEqual('actual', 'expected');
should.notDeepEqual('actual', 'expected');
should.strictEqual('actual', 'expected');
should.notStrictEqual('actual', 'expected');
should.throws(() => {});
should.doesNotThrow(() => {});
should.ifError('value');
class User {
name: string;
pets: string[];
age: number;
}
var user = {
name: 'tj',
pets: ['tobi', 'loki', 'jane', 'bandit'],
age: 17
};
user.should.have.property('name', 'tj');
user.should.have.property('pets').with.lengthOf(4);
should.exist('hello');
should.exist([]);
should.exist(null);
should.not.exist(false);
should.not.exist('');
should.not.exist({});
user.should.have.property('pets').with.lengthOf(4);
user.pets.should.have.lengthOf(4);
user.should.be.a('object').and.have.property('name', 'tj');
'foo'.should.equal('bar');
should.exist({});
should.exist([]);
should.exist('');
should.exist(0);
should.exist(null);
should.exist(undefined);
should.not.exist(undefined);
should.not.exist(null);
should.not.exist('');
should.not.exist({});
true.should.be.ok;
'yay'.should.be.ok;
(1).should.be.ok;
false.should.not.be.ok;
''.should.not.be.ok;
(0).should.not.be.ok;
true.should.be.true
'1'.should.not.be.true
false
false.should.be.false;
(0).should.not.be.false;
var args = (a: string, b: string, c: string) => { return arguments; };
args.should.be.arguments;
['a'].should.not.be.arguments;
['a'].should.be.empty;
''.should.be.empty;
({ length: 0 }).should.be.empty;
({ foo: 'bar' }).should.eql({ foo: 'bar' });
[1, 2, 3].should.eql([1, 2, 3]);
(4).should.equal(4);
'test'.should.equal('test');
[1, 2, 3].should.not.equal([1, 2, 3]);
user.age.should.be.within(5, 50);
user.should.be.a('object');
'test'.should.be.a('string');
user.should.be.an.instanceof(User);
['a'].should.be.an.instanceOf(Array);
user.age.should.be.above(5);
user.age.should.not.be.above(100);
user.age.should.be.below(100);
user.age.should.not.be.below(5);
'username'.should.match(/^\w+$/);
user.pets.should.have.length(5);
user.pets.should.have.lengthOf(5);
user.should.have.property('name');
user.should.have.property('age', 15);
user.should.not.have.property('rawr');
user.should.not.have.property('age', 0);
({ foo: 'bar' }).should.have.ownProperty('foo');
var res = {};
res.should.have.status(200);
res.should.have.header('content-length');
res.should.have.header('Content-Length', '123');
res.should.have.header('content-length', '123');
res.should.be.json;
res.should.be.html;
[1, 2, 3].should.include(3);
[1, 2, 3].should.include(2);
[1, 2, 3].should.not.include(4);
'foo bar baz'.should.include('foo');
'foo bar baz'.should.include('bar');
'foo bar baz'.should.include('baz');
'foo bar baz'.should.not.include('FOO');
var tobi = { name: 'Tobi', age: 1 };
var jane = { name: 'Jane', age: 5 };
var tj = { name: 'TJ', pet: tobi };
tj.should.include({ pet: tobi });
tj.should.include({ pet: tobi, name: 'TJ' });
tj.should.not.include({ pet: jane });
tj.should.not.include({ name: 'Someone' });
[[1], [2], [3]].should.includeEql([3]);
[[1], [2], [3]].should.includeEql([2]);
[[1], [2], [3]].should.not.includeEql([4]);
(function () {
throw new Error('fail');
}).should.throw();
(function () {
}).should.not.throw();
(function () {
throw new Error('fail');
}).should.throw('fail');
(function () {
throw new Error('failed to foo');
}).should.throw(/^fail/);
(function () {
throw new Error('failed to baz');
}).should.throwError(/^fail.*/);
var obj = { foo: 'bar', baz: 'raz' };
obj.should.have.keys('foo', 'bar');
obj.should.have.keys(['foo', 'bar']);
(1).should.eql(0, 'some useful description');

85
should/should.d.ts vendored Normal file
View File

@@ -0,0 +1,85 @@
// Type definitions for should.js 1.2.2
// Project: https://github.com/visionmedia/should.js
// Definitions by: Alex Varju <https://github.com/varju/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Object {
should: ShouldAssertion;
}
interface ShouldAssertion {
// basic grammar
an: ShouldAssertion;
// a: ShouldAssertion;
and: ShouldAssertion;
be: ShouldAssertion;
have: ShouldAssertion;
with: ShouldAssertion;
not: ShouldAssertion;
// validators
arguments: ShouldAssertion;
empty: ShouldAssertion;
ok: ShouldAssertion;
true: ShouldAssertion;
false: ShouldAssertion;
eql(expected: any, description?: string): ShouldAssertion;
equal(expected: any, description?: string): ShouldAssertion;
within(start: number, finish: number, description?: string): ShouldAssertion;
approximately(value: number, delta: number, description?: string): ShouldAssertion;
a(expected: any, description?: string): ShouldAssertion;
instanceof(constructor: Function, description?: string): ShouldAssertion;
above(n: number, description?: string): ShouldAssertion;
below(n: number, description?: string): ShouldAssertion;
match(regexp: RegExp, description?: string): ShouldAssertion;
length(n: number, description?: string): ShouldAssertion;
property(name: string, description?: string): ShouldAssertion;
property(name: string, val: any, description?: string): ShouldAssertion;
ownProperty(name: string, description?: string): ShouldAssertion;
include(obj: any, description?: string): ShouldAssertion;
includeEql(obj: Array, description?: string): ShouldAssertion;
contain(obj: any): ShouldAssertion;
keys(...allKeys: string[]): ShouldAssertion;
keys(allKeys: string[]): ShouldAssertion;
header(field: string, val?: string): ShouldAssertion;
status(code: number): ShouldAssertion;
json: ShouldAssertion;
html: ShouldAssertion;
throw(message?: any): ShouldAssertion;
// aliases
instanceOf(constructor: Function, description?: string): ShouldAssertion;
throwError(message?: any): ShouldAssertion;
lengthOf(n: number, description?: string): ShouldAssertion;
key(key: string): ShouldAssertion;
haveOwnProperty(name: string, description?: string): ShouldAssertion;
greaterThan(n: number, description?: string): ShouldAssertion;
lessThan(n: number, description?: string): ShouldAssertion;
}
interface ShouldInternal {
// should.js's extras
exist(actual: any): void;
exists(actual: any): void;
not: ShouldInternal;
}
interface Internal extends ShouldInternal {
// node.js's assert functions
fail(actual: any, expected: any, message: string, operator: string): void;
assert(value: any, message: string): void;
ok(value: any, message?: string): void;
equal(actual: any, expected: any, message?: string): void;
notEqual(actual: any, expected: any, message?: string): void;
deepEqual(actual: any, expected: any, message?: string): void;
notDeepEqual(actual: any, expected: any, message?: string): void;
strictEqual(actual: any, expected: any, message?: string): void;
notStrictEqual(actual: any, expected: any, message?: string): void;
throws(block: any, error?: any, message?: string): void;
doesNotThrow(block: any, message?: string): void;
ifError(value: any): void;
}
declare module "should" {
export = Internal;
}

View File

@@ -53,10 +53,19 @@ function test_connection() {
interface MyHubConnection extends HubConnection {
someState: string;
SomeFunction: Function;
// My Hubs Client functions:
client: {
addMessage: (message: string) => void;
}
// My Hubs Server function:
server: {
send(message: string);
}
}
interface SignalR {
chat: HubConnection;
chat: MyHubConnection;
myHub: MyHubConnection;
}
@@ -106,4 +115,23 @@ function test_hubs() {
});
var connection = $.hubConnection('http://localhost:8081/');
connection.start({ jsonp: true });
}
}
// Sample from : https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs#javascript--html
$(function () {
// Proxy created on the fly
var chat = $.connection.chat;
// Declare a function on the chat hub so the server can invoke it
chat.client.addMessage = function (message) {
$('#messages').append('<li>' + message + '</li>');
};
// Start the connection
$.connection.hub.start().done(function () {
$("#broadcast").click(function () {
// Call the chat method on the server
chat.server.send($('#msg').val());
});
});
});

View File

@@ -7,4 +7,18 @@ socketManager.sockets.on('connection', socket => {
socket.on('my other event', data => {
console.log(data);
});
});
// Storing data Associated to a client.
// Server side sample
io.listen(80).sockets.on('connection', function (socket) {
socket.on('set nickname', function (name) {
socket.set('nickname', name, function () { socket.emit('ready'); });
});
socket.on('msg', function () {
socket.get('nickname', function (err, name) {
console.log('Chat message by ', name);
});
});
});

View File

@@ -24,7 +24,7 @@ interface Socket {
join(name: string, fn: Function): Socket;
unjoin(name: string, fn: Function): Socket;
set(key: string, value: any, fn: Function): Socket;
get(key: string, value: any, fn: Function): Socket;
get(key: string, fn: Function): Socket;
has(key: string, fn: Function): Socket;
del(key: string, fn: Function): Socket;
disconnect(): Socket;

2
spin/spin.d.ts vendored
View File

@@ -34,7 +34,7 @@ declare class Spinner {
* spinning, it is automatically removed from its previous target by calling
* stop() internally.
*/
spin(target?: any): Spinner;
spin(target?: HTMLElement): Spinner;
/**
* Stops and removes the Spinner.

View File

@@ -23,6 +23,7 @@ _.where(listOfPlays, { author: "Shakespeare", year: 1611 });
var odds = _.reject([1, 2, 3, 4, 5, 6], (num) => num % 2 == 0);
_.all([true, 1, null, 'yes'], _.identity);
_.all([true, 1, null, 'yes']);
_.any([null, 0, 'yes', false]);
@@ -157,23 +158,6 @@ _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" });
_.clone({ name: 'moe' });
_.clone(['i', 'am', 'an', 'object!']);
_([1, 2, 3, 4])
.chain()
.filter((num: number) => {
return num % 2 == 0;
}).tap(alert)
.map((num: number) => {
return num * num;
})
.value();
_.chain([1, 2, 3, 200])
.filter(function (num: number) { return num % 2 == 0; })
.tap(alert)
.map(function (num: number) { return num * num })
.value();
_.has({ a: 1, b: 2, c: 3 }, "b");
var moe = { name: 'moe', luckyNumbers: [13, 27, 34] };
@@ -266,4 +250,33 @@ template2({ name: "Mustache" });
_.template("Using 'with': <%= data.answer %>", { answer: 'no' }, { variable: 'data' });
_(['test', 'test']).pick(['test2', 'test2']);
_(['test', 'test']).pick(['test2', 'test2']);
//////////////// Chain Tests
function chain_tests() {
var list:number[] = _.chain([1, 2, 3, 4, 5, 6, 7, 8])
.filter(n => n % 2 == 0)
.map(n => n * n)
.value();
_([1, 2, 3, 4])
.chain()
.filter((num: number) => {
return num % 2 == 0;
}).tap(alert)
.map((num: number) => {
return num * num;
})
.value();
_.chain([1, 2, 3, 200])
.filter(function (num: number) { return num % 2 == 0; })
.tap(alert)
.map(function (num: number) { return num * num })
.value();
}

View File

@@ -295,13 +295,13 @@ declare module _ {
* Returns true if all of the values in the list pass the iterator truth test. Delegates to the
* native method every, if present.
* @param list Truth test against all elements within this list.
* @param iterator Trust test iterator function for each element in `list`.
* @param iterator Trust test iterator function for each element in `list`, optional.
* @param context `this` object in `iterator`, optional.
* @return True if all elements passed the truth test, otherwise false.
**/
export function all<T>(
list: Collection<T>,
iterator: ListIterator<T, boolean>,
iterator?: ListIterator<T, boolean>,
context?: any): boolean;
/**
@@ -309,7 +309,7 @@ declare module _ {
**/
export function every<T>(
list: Collection<T>,
iterator: ListIterator<T, boolean>,
iterator?: ListIterator<T, boolean>,
context?: any): boolean;
/**
@@ -799,7 +799,7 @@ declare module _ {
start: number,
stop: number,
step?: number): number[];
/**
* @see _.range
* @param stop Stop here.
@@ -1030,9 +1030,8 @@ declare module _ {
* @keys The key/value pairs to keep on `object`.
* @return Copy of `object` with only the `keys` properties.
**/
export function pick(
object: any,
...keys: string[]): any;
export function pick(object: any, ...keys: string[]): any;
export function pick(object: any, keys: string[]): any;
/**
* Return a copy of the object, filtered to omit the blacklisted keys (or array of keys).
@@ -2648,6 +2647,7 @@ interface _Chain<T> {
* @see _.pick
**/
pick(...keys: string[]): _Chain;
pick(keys: string[]): _Chain;
/**
* Wrapped type `object`.
@@ -2847,7 +2847,7 @@ interface _Chain<T> {
* Wrapped type `any`.
* @see _.value
**/
value<TResult>(): _Chain;
value<TResult>(): TResult;
}
declare module "underscore" {