mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
updating angular resource and injector definitions
This commit is contained in:
Vendored
+69
-60
@@ -1,7 +1,6 @@
|
||||
// Type definitions for Angular JS 1.2 (ngResource module)
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions: https://github.com/daptiv/DefinitelyTyped
|
||||
|
||||
/// <reference path="angular.d.ts" />
|
||||
|
||||
@@ -19,10 +18,19 @@ declare module ng.resource {
|
||||
// that deeply.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IResourceService {
|
||||
|
||||
<T extends IResource<T>, U extends IResourceClass<T>>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): U;
|
||||
<T extends IResource<T>>(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<T>;
|
||||
(url: string, paramDefaults?: any,
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass;
|
||||
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
|
||||
where deleteDescriptor : IActionDescriptor */
|
||||
actionDescriptors?: any): IResourceClass<IResource<any>>;
|
||||
}
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
@@ -42,65 +50,66 @@ declare module ng.resource {
|
||||
// PATCH (in other words, methods with body). Otherwise, it's going
|
||||
// to be considered as parameters to the request.
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
interface IResourceClass {
|
||||
get(): IResource;
|
||||
get(dataOrParams: any): IResource;
|
||||
get(dataOrParams: any, success: Function): IResource;
|
||||
get(success: Function, error?: Function): IResource;
|
||||
get(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
save(): IResource;
|
||||
save(dataOrParams: any): IResource;
|
||||
save(dataOrParams: any, success: Function): IResource;
|
||||
save(success: Function, error?: Function): IResource;
|
||||
save(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
query(): IResource[];
|
||||
query(dataOrParams: any): IResource[];
|
||||
query(dataOrParams: any, success: Function): IResource[];
|
||||
query(success: Function, error?: Function): IResource[];
|
||||
query(params: any, data: any, success?: Function, error?: Function): IResource[];
|
||||
remove(): IResource;
|
||||
remove(dataOrParams: any): IResource;
|
||||
remove(dataOrParams: any, success: Function): IResource;
|
||||
remove(success: Function, error?: Function): IResource;
|
||||
remove(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
delete(): IResource;
|
||||
delete(dataOrParams: any): IResource;
|
||||
delete(dataOrParams: any, success: Function): IResource;
|
||||
delete(success: Function, error?: Function): IResource;
|
||||
delete(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
interface IResourceClass<T extends IResource<T>> {
|
||||
get(): T;
|
||||
get(dataOrParams: any): T;
|
||||
get(dataOrParams: any, success: Function): T;
|
||||
get(success: Function, error?: Function): T;
|
||||
get(params: any, data: any, success?: Function, error?: Function): T;
|
||||
save(): T;
|
||||
save(dataOrParams: any): T;
|
||||
save(dataOrParams: any, success: Function): T;
|
||||
save(success: Function, error?: Function): T;
|
||||
save(params: any, data: any, success?: Function, error?: Function): T;
|
||||
query(): T[];
|
||||
query(dataOrParams: any): T[];
|
||||
query(dataOrParams: any, success: Function): T[];
|
||||
query(success: Function, error?: Function): T[];
|
||||
query(params: any, data: any, success?: Function, error?: Function): T[];
|
||||
remove(): T;
|
||||
remove(dataOrParams: any): T;
|
||||
remove(dataOrParams: any, success: Function): T;
|
||||
remove(success: Function, error?: Function): T;
|
||||
remove(params: any, data: any, success?: Function, error?: Function): T;
|
||||
delete(): T;
|
||||
delete(dataOrParams: any): T;
|
||||
delete(dataOrParams: any, success: Function): T;
|
||||
delete(success: Function, error?: Function): T;
|
||||
delete(params: any, data: any, success?: Function, error?: Function): T;
|
||||
}
|
||||
|
||||
interface IResource {
|
||||
$get(): IResource;
|
||||
$get(dataOrParams: any): IResource;
|
||||
$get(dataOrParams: any, success: Function): IResource;
|
||||
$get(success: Function, error?: Function): IResource;
|
||||
$get(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
$save(): IResource;
|
||||
$save(dataOrParams: any): IResource;
|
||||
$save(dataOrParams: any, success: Function): IResource;
|
||||
$save(success: Function, error?: Function): IResource;
|
||||
$save(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
$query(): IResource[];
|
||||
$query(dataOrParams: any): IResource[];
|
||||
$query(dataOrParams: any, success: Function): IResource[];
|
||||
$query(success: Function, error?: Function): IResource[];
|
||||
$query(params: any, data: any, success?: Function, error?: Function): IResource[];
|
||||
$remove(): IResource;
|
||||
$remove(dataOrParams: any): IResource;
|
||||
$remove(dataOrParams: any, success: Function): IResource;
|
||||
$remove(success: Function, error?: Function): IResource;
|
||||
$remove(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
$delete(): IResource;
|
||||
$delete(dataOrParams: any): IResource;
|
||||
$delete(dataOrParams: any, success: Function): IResource;
|
||||
$delete(success: Function, error?: Function): IResource;
|
||||
$delete(params: any, data: any, success?: Function, error?: Function): IResource;
|
||||
interface IResource<T extends IResource<T>> {
|
||||
$get(): T;
|
||||
$get(dataOrParams: any): T;
|
||||
$get(dataOrParams: any, success: Function): T;
|
||||
$get(success: Function, error?: Function): T;
|
||||
$get(params: any, data: any, success?: Function, error?: Function): T;
|
||||
$save(): T;
|
||||
$save(dataOrParams: any): T;
|
||||
$save(dataOrParams: any, success: Function): T;
|
||||
$save(success: Function, error?: Function): T;
|
||||
$save(params: any, data: any, success?: Function, error?: Function): T;
|
||||
$query(): T[];
|
||||
$query(dataOrParams: any): T[];
|
||||
$query(dataOrParams: any, success: Function): T[];
|
||||
$query(success: Function, error?: Function): T[];
|
||||
$query(params: any, data: any, success?: Function, error?: Function): T[];
|
||||
$remove(): T;
|
||||
$remove(dataOrParams: any): T;
|
||||
$remove(dataOrParams: any, success: Function): T;
|
||||
$remove(success: Function, error?: Function): T;
|
||||
$remove(params: any, data: any, success?: Function, error?: Function): T;
|
||||
$delete(): T;
|
||||
$delete(dataOrParams: any): T;
|
||||
$delete(dataOrParams: any, success: Function): T;
|
||||
$delete(success: Function, error?: Function): T;
|
||||
$delete(params: any, data: any, success?: Function, error?: Function): T;
|
||||
}
|
||||
|
||||
/** when creating a resource factory via IModule.factory */
|
||||
interface IResourceServiceFactoryFunction {
|
||||
($resource: ng.resource.IResourceService): ng.resource.IResourceClass;
|
||||
interface IResourceServiceFactoryFunction<T extends IResource<T>> {
|
||||
($resource: ng.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: ng.resource.IResourceService): U;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +118,6 @@ declare module ng {
|
||||
|
||||
interface IModule {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule;
|
||||
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+14
-14
@@ -127,15 +127,15 @@ declare module ng {
|
||||
// this is necessary to be able to access the scoped attributes. it's not very elegant
|
||||
// because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way
|
||||
// this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656
|
||||
[name: string]: any;
|
||||
|
||||
// Adds the CSS class value specified by the classVal parameter to the
|
||||
// element. If animations are enabled then an animation will be triggered
|
||||
[name: string]: any;
|
||||
|
||||
// Adds the CSS class value specified by the classVal parameter to the
|
||||
// element. If animations are enabled then an animation will be triggered
|
||||
// for the class addition.
|
||||
$addClass(classVal: string): void;
|
||||
|
||||
// Removes the CSS class value specified by the classVal parameter from the
|
||||
// element. If animations are enabled then an animation will be triggered for
|
||||
// Removes the CSS class value specified by the classVal parameter from the
|
||||
// element. If animations are enabled then an animation will be triggered for
|
||||
// the class removal.
|
||||
$removeClass(classVal: string): void;
|
||||
|
||||
@@ -143,12 +143,12 @@ declare module ng {
|
||||
$set(key: string, value: any): void;
|
||||
|
||||
// Observes an interpolated attribute.
|
||||
// The observer function will be invoked once during the next $digest
|
||||
// following compilation. The observer is then invoked whenever the
|
||||
// The observer function will be invoked once during the next $digest
|
||||
// following compilation. The observer is then invoked whenever the
|
||||
// interpolated value changes.
|
||||
$observe(name: string, fn:(value?:any)=>any): Function;
|
||||
|
||||
// A map of DOM element attribute names to the normalized name. This is needed
|
||||
// A map of DOM element attribute names to the normalized name. This is needed
|
||||
// to do reverse lookup from normalized name back to actual name.
|
||||
$attr: Object;
|
||||
}
|
||||
@@ -451,12 +451,12 @@ declare module ng {
|
||||
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise<TResult>;
|
||||
|
||||
|
||||
|
||||
|
||||
catch<TResult>(onRejected: (reason: any) => IHttpPromise<TResult>): IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (reason: any) => IPromise<TResult>): IPromise<TResult>;
|
||||
catch<TResult>(onRejected: (reason: any) => TResult): IPromise<TResult>;
|
||||
|
||||
|
||||
finally<TResult>(finallyCallback: ()=>any):IPromise<TResult>;
|
||||
}
|
||||
|
||||
@@ -700,7 +700,7 @@ declare module ng {
|
||||
valueOf(value: any): any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEDelegateProvider
|
||||
// see http://docs.angularjs.org/api/ng.$sceDelegateProvider
|
||||
@@ -709,7 +709,7 @@ declare module ng {
|
||||
resourceUrlBlacklist(blacklist: any[]): void;
|
||||
resourceUrlWhitelist(whitelist: any[]): void;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Directive
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
|
||||
|
||||
Reference in New Issue
Block a user