mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
+ renaming module JSData_ to JSData since it is possible to declare var and module with the same name
This commit is contained in:
@@ -12,7 +12,7 @@ interface CustomScope extends ng.IScope {
|
||||
}
|
||||
|
||||
angular.module('myApp')
|
||||
.controller('commentsCtrl', function ($scope:CustomScope, store:JSData_.DS, Comment:JSData_.DSResourceDefinition<any>, User:JSData_.DSResourceDefinition<any>) {
|
||||
.controller('commentsCtrl', function ($scope:CustomScope, store:JSData.DS, Comment:JSData.DSResourceDefinition<any>, User:JSData.DSResourceDefinition<any>) {
|
||||
|
||||
Comment.findAll().then(function (comments) {
|
||||
$scope.comments = comments;
|
||||
@@ -54,7 +54,7 @@ angular.module('myApp')
|
||||
});
|
||||
|
||||
angular.module('myApp')
|
||||
.run(function (DS:JSData_.DS) {
|
||||
.run(function (DS:JSData.DS) {
|
||||
// We don't register the "User" resource
|
||||
// as a service, so it can only be used
|
||||
// via DS.<method>('user', ...)
|
||||
@@ -63,7 +63,7 @@ angular.module('myApp')
|
||||
// only ever have to inject "DS"
|
||||
DS.defineResource('user');
|
||||
})
|
||||
.factory('Comment', function (DS:JSData_.DS) {
|
||||
.factory('Comment', function (DS:JSData.DS) {
|
||||
// This code won't execute unless you actually
|
||||
// inject "Comment" somewhere in your code.
|
||||
// Thanks Angular...
|
||||
@@ -73,6 +73,6 @@ angular.module('myApp')
|
||||
});
|
||||
|
||||
angular.module('myApp')
|
||||
.config(function (DSProvider:JSData_.DSProvider) {
|
||||
.config(function (DSProvider:JSData.DSProvider) {
|
||||
DSProvider.defaults.basePath = '/myApi'; // etc.
|
||||
});
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@
|
||||
/// <reference path="../js-data/js-data.d.ts" />
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module JSData_ {
|
||||
declare module JSData {
|
||||
|
||||
interface DSProvider {
|
||||
defaults:DSConfiguration;
|
||||
|
||||
@@ -4,7 +4,7 @@ var adapter = new DSHttpAdapter();
|
||||
var store = new JSData.DS();
|
||||
store.registerAdapter('http', adapter, { default: true });
|
||||
|
||||
var ADocument:JSData_.DSResourceDefinition<any> = store.defineResource<any>('document');
|
||||
var ADocument:JSData.DSResourceDefinition<any> = store.defineResource<any>('document');
|
||||
|
||||
ADocument.inject({ id: 5, author: 'John' });
|
||||
|
||||
@@ -73,7 +73,7 @@ adapter.GET('/user/1').then(function (data) {
|
||||
data.config; //{...}
|
||||
});
|
||||
|
||||
var User:JSData_.DSResourceDefinition<any> = store.defineResource('user');
|
||||
var User:JSData.DSResourceDefinition<any> = store.defineResource('user');
|
||||
|
||||
var params:any = {
|
||||
age: {
|
||||
|
||||
Vendored
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
/// <reference path="../js-data/js-data.d.ts" />
|
||||
|
||||
declare module JSData_ {
|
||||
declare module JSData {
|
||||
|
||||
interface DSHttpAdapterOptions {
|
||||
serialize?: (resourceName:string, data:any)=>any;
|
||||
@@ -43,4 +43,4 @@ declare module JSData_ {
|
||||
}
|
||||
}
|
||||
|
||||
declare var DSHttpAdapter:JSData_.DSHttpAdapter;
|
||||
declare var DSHttpAdapter:JSData.DSHttpAdapter;
|
||||
+19
-19
@@ -127,7 +127,7 @@ interface IComment {
|
||||
profile?: any;
|
||||
}
|
||||
|
||||
var aComment:JSData_.DSResourceDefinition<IComment> = store.defineResource<IComment>('comment');
|
||||
var aComment:JSData.DSResourceDefinition<IComment> = store.defineResource<IComment>('comment');
|
||||
|
||||
// Get all comments where comment.userId == 5
|
||||
aComment.filter({
|
||||
@@ -276,7 +276,7 @@ interface IPost {
|
||||
|
||||
}
|
||||
|
||||
var Post:JSData_.DSResourceDefinition<IPost>;
|
||||
var Post:JSData.DSResourceDefinition<IPost>;
|
||||
|
||||
// Grab the first "page" of posts
|
||||
Post.filter({
|
||||
@@ -426,7 +426,7 @@ User.create({name: 'John'}, {
|
||||
|
||||
module CustomAdapterTest {
|
||||
|
||||
class MyCustomAdapter implements JSData_.IDSAdapter {
|
||||
class MyCustomAdapter implements JSData.IDSAdapter {
|
||||
|
||||
// All of the methods shown here must return a promise
|
||||
|
||||
@@ -437,52 +437,52 @@ module CustomAdapterTest {
|
||||
// was passed into the DS method that is calling
|
||||
// the adapter method
|
||||
|
||||
create(definition:JSData_.DSResourceDefinition<any>, attrs:Object, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
create(definition:JSData.DSResourceDefinition<any>, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the created item
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
find(definition:JSData_.DSResourceDefinition<any>, id:any, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
find(definition:JSData.DSResourceDefinition<any>, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the found item
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
findAll(definition:JSData_.DSResourceDefinition<any>, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
findAll(definition:JSData.DSResourceDefinition<any>, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the found items
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
update(definition:JSData_.DSResourceDefinition<any>, id:any, attrs:Object, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
update(definition:JSData.DSResourceDefinition<any>, id:any, attrs:Object, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the updated items
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
updateAll(definition:JSData_.DSResourceDefinition<any>, attrs:Object, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
updateAll(definition:JSData.DSResourceDefinition<any>, attrs:Object, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must resolve the promise with the updated items
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
destroy(definition:JSData_.DSResourceDefinition<any>, id:any, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
destroy(definition:JSData.DSResourceDefinition<any>, id:any, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must return a promise
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
|
||||
destroyAll(definition:JSData_.DSResourceDefinition<any>, params:JSData_.DSFilterParams, options:JSData_.DSConfiguration):JSData_.JSDataPromise<any> {
|
||||
destroyAll(definition:JSData.DSResourceDefinition<any>, params:JSData.DSFilterParams, options:JSData.DSConfiguration):JSData.JSDataPromise<any> {
|
||||
// Must return a promise
|
||||
|
||||
var promise:JSData_.JSDataPromise<any>;
|
||||
var promise:JSData.JSDataPromise<any>;
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
@@ -500,14 +500,14 @@ module CustomAdapterTest {
|
||||
|
||||
interface MyCustomDataStore {
|
||||
|
||||
myResource: JSData_.DSResourceDefinition<MyResourceDefinition>
|
||||
myResource: JSData.DSResourceDefinition<MyResourceDefinition>
|
||||
}
|
||||
|
||||
interface MyResourceDefinition {
|
||||
|
||||
}
|
||||
|
||||
module JSData_ {
|
||||
module JSData {
|
||||
|
||||
interface DS {
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -14,7 +14,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// defining what exists in JSData and how it looks
|
||||
declare module JSData_ {
|
||||
declare module JSData {
|
||||
|
||||
interface JSDataPromise<R> extends Promise<R> {
|
||||
|
||||
@@ -398,8 +398,8 @@ declare module JSData_ {
|
||||
|
||||
// declaring the existing global js object
|
||||
declare var JSData:{
|
||||
DS: JSData_.DS;
|
||||
DSErrors: JSData_.DSErrors;
|
||||
DS: JSData.DS;
|
||||
DSErrors: JSData.DSErrors;
|
||||
};
|
||||
|
||||
//Support node require
|
||||
|
||||
Reference in New Issue
Block a user