Unify without the "I" prefix.

This commit is contained in:
in-async
2014-11-17 14:06:04 +09:00
parent a1639fb602
commit b42ec19d71
3 changed files with 73 additions and 73 deletions
+2 -2
View File
@@ -20,8 +20,8 @@ interface AngularFire {
$remove(key?: string): ng.IPromise<Firebase>;
$update(key: string, data: Object): ng.IPromise<Firebase>;
$update(data: any): ng.IPromise<Firebase>;
$transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<IFirebaseDataSnapshot>;
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<IFirebaseDataSnapshot>;
$transaction(updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<FirebaseDataSnapshot>;
$transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise<FirebaseDataSnapshot>;
}
interface AngularFireObject extends AngularFireSimpleObject {
+31 -31
View File
@@ -151,7 +151,7 @@ var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com/');
*/
() => {
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com');
var onAuthChange = function (authData: IFirebaseAuthData) { /*...*/ };
var onAuthChange = function (authData: FirebaseAuthData) { /*...*/ };
firebaseRef.onAuth(onAuthChange);
// Sometime later...
firebaseRef.offAuth(onAuthChange);
@@ -337,7 +337,7 @@ wilmaRef.transaction(function(currentData) {
console.log('User wilma already exists.');
return; // Abort the transaction.
}
}, function(error: any, committed: boolean, snapshot: IFirebaseDataSnapshot) {
}, function(error: any, committed: boolean, snapshot: FirebaseDataSnapshot) {
if (error)
console.log('Transaction failed abnormally!', error);
else if (!committed)
@@ -438,16 +438,16 @@ wilmaRef.transaction(function(currentData) {
}
//var messageListRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
//var lastMessagesQuery:IFirebaseQuery = messageListRef.endAt().limit(500);
//lastMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ });
//var lastMessagesQuery:FirebaseQuery = messageListRef.endAt().limit(500);
//lastMessagesQuery.on('child_added', function(childSnapshot: FirebaseDataSnapshot) { /* handle child add */ });
//var messageListRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
//var firstMessagesQuery:IFirebaseQuery = messageListRef2.startAt().limit(500);
//firstMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ });
//var firstMessagesQuery:FirebaseQuery = messageListRef2.startAt().limit(500);
//firstMessagesQuery.on('child_added', function(childSnapshot: FirebaseDataSnapshot) { /* handle child add */ });
//var usersRef3: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users');
//var usersQuery: IFirebaseQuery = usersRef3.startAt(1000).limit(50);
//usersQuery.on('child_added', function(userSnapshot: IFirebaseDataSnapshot) { /* handle user */ });
//var usersQuery: FirebaseQuery = usersRef3.startAt(1000).limit(50);
//usersQuery.on('child_added', function(userSnapshot: FirebaseDataSnapshot) { /* handle user */ });
/*
* Firebase.goOffline()
@@ -460,7 +460,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.on()
* FirebaseQuery.on()
*/
() => {
firebaseRef.on('value', function (dataSnapshot) {
@@ -485,10 +485,10 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.off()
* FirebaseQuery.off()
*/
() => {
var onValueChange = function (dataSnapshot: IFirebaseDataSnapshot) { /* handle... */ };
var onValueChange = function (dataSnapshot: FirebaseDataSnapshot) { /* handle... */ };
firebaseRef.on('value', onValueChange);
// Sometime later...
firebaseRef.off('value', onValueChange);
@@ -502,7 +502,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.once()
* FirebaseQuery.once()
*/
() => {
// Basic usage of .once() to read the data located at firebaseRef.
@@ -527,7 +527,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.orderByChild()
* FirebaseQuery.orderByChild()
*/
() => {
// For example, using our sample Firebase of dinosaur facts,
@@ -539,7 +539,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.orderByKey()
* FirebaseQuery.orderByKey()
*/
() => {
// For example, using our sample Firebase of dinosaur facts,
@@ -552,7 +552,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.orderByPriority()
* FirebaseQuery.orderByPriority()
*/
() => {
// For example, using our sample Firebase of dinosaur facts,
@@ -564,7 +564,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.startAt()
* FirebaseQuery.startAt()
*/
() => {
// For example, using our sample Firebase of dinosaur facts,
@@ -577,7 +577,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.endAt()
* FirebaseQuery.endAt()
*/
() => {
// For example, using our sample Firebase of dinosaur facts,
@@ -590,7 +590,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.equalTo()
* FirebaseQuery.equalTo()
*/
() => {
// For example, using our sample Firebase of dinosaur facts,
@@ -603,7 +603,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.limitToFirst
* FirebaseQuery.limitToFirst
*/
() => {
// Using our sample Firebase of dinosaur facts,
@@ -615,7 +615,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.limitToLast
* FirebaseQuery.limitToLast
*/
() => {
// Using our sample Firebase of dinosaur facts,
@@ -627,7 +627,7 @@ wilmaRef.transaction(function(currentData) {
}
/*
* IFirebaseQuery.ref()
* FirebaseQuery.ref()
*/
() => {
// The Firebase reference returned by ref() is equivalent to the Firebase reference used to create the Query.
@@ -708,7 +708,7 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.child()
*/
(dataSnapshot:IFirebaseDataSnapshot) => {
(dataSnapshot:FirebaseDataSnapshot) => {
// Given a DataSnapshot containing a child 'name' that has children 'first'
// (set to 'Fred') and 'last' (set to 'Flintstone'):
var nameSnapshot = dataSnapshot.child('name');
@@ -727,7 +727,7 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.forEach()
*/
(dataSnapshot:IFirebaseDataSnapshot) => {
(dataSnapshot:FirebaseDataSnapshot) => {
// Given a DataSnapshot containing a child "fred" and a child "wilma", this callback
// function will be called twice
dataSnapshot.forEach(function (childSnapshot) {
@@ -738,7 +738,7 @@ wilmaRef.transaction(function(currentData) {
var childData = childSnapshot.val();
});
}
(dataSnapshot:IFirebaseDataSnapshot) => {
(dataSnapshot:FirebaseDataSnapshot) => {
// Given a DataSnapshot containing a child "fred" and a child "wilma", this callback
// funciton will only be called once (since we return true)
dataSnapshot.forEach(function (childSnapshot) {
@@ -750,7 +750,7 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.hasChild()
*/
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
// Given a DataSnapshot with child 'fred' and no other children:
var x = dataSnapshot.hasChild('fred');
var y = dataSnapshot.hasChild('whales');
@@ -760,7 +760,7 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.hasChildren()
*/
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
// Given a DataSnapshot containing a child 'name' with children 'first'
// (set to 'Fred') and 'last' (set to 'Flintstone'):
var x = dataSnapshot.hasChildren();
@@ -811,7 +811,7 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.numChildren()
*/
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
// Given a DataSnapshot containing a child 'name' with children 'first'
// (set to 'Fred') and 'last' (set to 'Flintstone'):
var x = dataSnapshot.numChildren();
@@ -836,7 +836,7 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.getPriority()
*/
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
// Given a snapshot for data with priority 1000:
var x = dataSnapshot.getPriority();
// x is now 1000.
@@ -845,21 +845,21 @@ wilmaRef.transaction(function(currentData) {
/*
* DataSnapshot.exportVal()
*/
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
firebaseRef.setWithPriority('hello', 500);
firebaseRef.once('value', function (dataSnapshot) {
var x = dataSnapshot.exportVal();
// x now contains { '.value': 'hello', '.priority': 500 }
});
}
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
firebaseRef.set('hello');
firebaseRef.once('value', function (dataSnapshot) {
var x = dataSnapshot.exportVal();
// x now contains 'hello'
});
}
(dataSnapshot: IFirebaseDataSnapshot) => {
(dataSnapshot: FirebaseDataSnapshot) => {
// Note: To access these variables in JavaScript, you can use x['.value'] and x['.priority'].
firebaseRef.setWithPriority({ a: 'hello', b: 'hi' }, 500);
firebaseRef.once('value', function (dataSnapshot) {
+40 -40
View File
@@ -3,12 +3,12 @@
// Definitions by: Vincent Botone <https://github.com/vbortone/>, Shin1 Kashimura <https://github.com/in-async/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface IFirebaseAuthResult {
interface FirebaseAuthResult {
auth: any;
expires: number;
}
interface IFirebaseDataSnapshot {
interface FirebaseDataSnapshot {
/**
* Gets the JavaScript object representation of the DataSnapshot.
*/
@@ -16,12 +16,12 @@ interface IFirebaseDataSnapshot {
/**
* Gets a DataSnapshot for the location at the specified relative path.
*/
child(childPath: string): IFirebaseDataSnapshot;
child(childPath: string): FirebaseDataSnapshot;
/**
* Enumerates through the DataSnapshots children (in the default order).
*/
forEach(childAction: (childSnapshot: IFirebaseDataSnapshot) => void): boolean;
forEach(childAction: (childSnapshot: IFirebaseDataSnapshot) => boolean): boolean;
forEach(childAction: (childSnapshot: FirebaseDataSnapshot) => void): boolean;
forEach(childAction: (childSnapshot: FirebaseDataSnapshot) => boolean): boolean;
/**
* Returns true if the specified child exists.
*/
@@ -58,7 +58,7 @@ interface IFirebaseDataSnapshot {
exportVal(): Object;
}
interface IFirebaseOnDisconnect {
interface FirebaseOnDisconnect {
/**
* Ensures the data at this location is set to the specified value when the client is disconnected
* (due to closing the browser, navigating to a new page, or network issues).
@@ -86,90 +86,90 @@ interface IFirebaseOnDisconnect {
cancel(onComplete?: (error: any) => void): void;
}
interface IFirebaseQuery {
interface FirebaseQuery {
/**
* Listens for data changes at a particular location.
*/
on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: (error: any) => void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
on(eventType: string, callback: (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: (error: any) => void, context?: Object): (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void;
/**
* Detaches a callback previously attached with on().
*/
off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
off(eventType?: string, callback?: (dataSnapshot: FirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
/**
* Listens for exactly one event of the specified event type, and then stops listening.
*/
once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, context?: Object): void;
once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: (error: any) => void, context?: Object): void;
once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, context?: Object): void;
once(eventType: string, successCallback: (dataSnapshot: FirebaseDataSnapshot) => void, failureCallback?: (error: any) => void, context?: Object): void;
/**
* Generates a new Query object ordered by the specified child key.
*/
orderByChild(key: string): IFirebaseQuery;
orderByChild(key: string): FirebaseQuery;
/**
* Generates a new Query object ordered by key name.
*/
orderByKey(): IFirebaseQuery;
orderByKey(): FirebaseQuery;
/**
* Generates a new Query object ordered by priority.
*/
orderByPriority(): IFirebaseQuery;
orderByPriority(): FirebaseQuery;
/**
* @deprecated Use limitToFirst() and limitToLast() instead.
* Generates a new Query object limited to the specified number of children.
*/
limit(limit: number): IFirebaseQuery;
limit(limit: number): FirebaseQuery;
/**
* Creates a Query with the specified starting point.
* The generated Query includes children which match the specified starting point.
*/
startAt(value: string, key?: string): IFirebaseQuery;
startAt(value: number, key?: string): IFirebaseQuery;
startAt(value: string, key?: string): FirebaseQuery;
startAt(value: number, key?: string): FirebaseQuery;
/**
* Creates a Query with the specified ending point.
* The generated Query includes children which match the specified ending point.
*/
endAt(value: string, key?: string): IFirebaseQuery;
endAt(value: number, key?: string): IFirebaseQuery;
endAt(value: string, key?: string): FirebaseQuery;
endAt(value: number, key?: string): FirebaseQuery;
/**
* Creates a Query which includes children which match the specified value.
*/
equalTo(value: string, key?: string): IFirebaseQuery;
equalTo(value: number, key?: string): IFirebaseQuery;
equalTo(value: string, key?: string): FirebaseQuery;
equalTo(value: number, key?: string): FirebaseQuery;
/**
* Generates a new Query object limited to the first certain number of children.
*/
limitToFirst(limit: number): IFirebaseQuery;
limitToFirst(limit: number): FirebaseQuery;
/**
* Generates a new Query object limited to the last certain number of children.
*/
limitToLast(limit: number): IFirebaseQuery;
limitToLast(limit: number): FirebaseQuery;
/**
* Gets a Firebase reference to the Query's location.
*/
ref(): Firebase;
}
interface Firebase extends IFirebaseQuery {
interface Firebase extends FirebaseQuery {
/**
* @deprecated Use authWithCustomToken() instead.
* Authenticates a Firebase client using the provided authentication token or Firebase Secret.
*/
auth(authToken: string, onComplete?: (error: any, result: IFirebaseAuthResult) => void, onCancel?:(error: any) => void): void;
auth(authToken: string, onComplete?: (error: any, result: FirebaseAuthResult) => void, onCancel?:(error: any) => void): void;
/**
* Authenticates a Firebase client using an authentication token or Firebase Secret.
*/
authWithCustomToken(autoToken: string, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?:Object): void;
authWithCustomToken(autoToken: string, onComplete: (error: any, authData: FirebaseAuthData) => void, options?:Object): void;
/**
* Authenticates a Firebase client using a new, temporary guest account.
*/
authAnonymously(onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void;
authAnonymously(onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
/**
* Authenticates a Firebase client using an email / password combination.
*/
authWithPassword(credentials: IFirebaseCredentials, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void;
authWithPassword(credentials: FirebaseCredentials, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
/**
* Authenticates a Firebase client using a popup-based OAuth flow.
*/
authWithOAuthPopup(provider: string, onComplete:(error: any, authData: IFirebaseAuthData) => void, options?: Object): void;
authWithOAuthPopup(provider: string, onComplete:(error: any, authData: FirebaseAuthData) => void, options?: Object): void;
/**
* Authenticates a Firebase client using a redirect-based OAuth flow.
*/
@@ -177,20 +177,20 @@ interface Firebase extends IFirebaseQuery {
/**
* Authenticates a Firebase client using OAuth access tokens or credentials.
*/
authWithOAuthToken(provider: string, credentials: string, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void;
authWithOAuthToken(provider: string, credentials: Object, onComplete: (error: any, authData: IFirebaseAuthData) => void, options?: Object): void;
authWithOAuthToken(provider: string, credentials: string, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
authWithOAuthToken(provider: string, credentials: Object, onComplete: (error: any, authData: FirebaseAuthData) => void, options?: Object): void;
/**
* Synchronously access the current authentication state of the client.
*/
getAuth(): IFirebaseAuthData;
getAuth(): FirebaseAuthData;
/**
* Listen for changes to the client's authentication state.
*/
onAuth(onComplete: (authData: IFirebaseAuthData) => void, context?: Object): void;
onAuth(onComplete: (authData: FirebaseAuthData) => void, context?: Object): void;
/**
* Detaches a callback previously attached with onAuth().
*/
offAuth(onComplete: (authData: IFirebaseAuthData) => void, context?: Object): void;
offAuth(onComplete: (authData: FirebaseAuthData) => void, context?: Object): void;
/**
* Unauthenticates a Firebase client.
*/
@@ -250,11 +250,11 @@ interface Firebase extends IFirebaseQuery {
/**
* Atomically modifies the data at this location.
*/
transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: boolean, snapshot: IFirebaseDataSnapshot) => void, applyLocally?: boolean): void;
transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: boolean, snapshot: FirebaseDataSnapshot) => void, applyLocally?: boolean): void;
/**
* Creates a new user account using an email / password combination.
*/
createUser(credentials: IFirebaseCredentials, onComplete: (error: any) => void): void;
createUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void;
/**
* Change the password of an existing user using an email / password combination.
*/
@@ -262,12 +262,12 @@ interface Firebase extends IFirebaseQuery {
/**
* Removes an existing user account using an email / password combination.
*/
removeUser(credentials: IFirebaseCredentials, onComplete: (error: any) => void): void;
removeUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void;
/**
* Sends a password-reset email to the owner of the account, containing a token that may be used to authenticate and change the user password.
*/
resetPassword(credentials: { email: string }, onComplete: (error: any) => void): void;
onDisconnect(): IFirebaseOnDisconnect;
onDisconnect(): FirebaseOnDisconnect;
}
interface FirebaseStatic {
/**
@@ -294,7 +294,7 @@ interface FirebaseStatic {
declare var Firebase: FirebaseStatic;
// Reference: https://www.firebase.com/docs/web/api/firebase/getauth.html
interface IFirebaseAuthData {
interface FirebaseAuthData {
uid: string;
provider: string;
token: string;
@@ -302,7 +302,7 @@ interface IFirebaseAuthData {
auth: Object;
}
interface IFirebaseCredentials {
interface FirebaseCredentials {
email: string;
password: string;
}