forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 24bf981.
- Loading branch information
Showing
2 changed files
with
3 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,94 +11,6 @@ dataRef.auth(AUTH_TOKEN, function(error, result) { | |
} | ||
}); | ||
|
||
// Log me in | ||
dataRef.authWithCustomToken(AUTH_TOKEN, function(error, authData) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
console.log('Authenticated successfully with payload:', authData); | ||
} | ||
}); | ||
|
||
// Log me in | ||
dataRef.authAnonymously(function(error, authData) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
console.log('Authenticated successfully with payload:', authData); | ||
} | ||
}); | ||
|
||
// Log me in | ||
dataRef.authWithPassword({ | ||
"email" : "[email protected]", | ||
"password" : "correcthorsebatterystaple" | ||
}, function(error, authData) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
console.log('Authenticated successfully with payload:', authData); | ||
} | ||
}); | ||
|
||
// Log me in | ||
dataRef.authWithOAuthPopup("twitter", function(error, authData) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
console.log('Authenticated successfully with payload:', authData); | ||
} | ||
}); | ||
|
||
// Log me in | ||
dataRef.authWithOAuthRedirect("twitter", function(error) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
// We'll never get here, as the page will redirect on success. | ||
} | ||
}); | ||
|
||
// Authenticate with Facebook using an existing OAuth 2.0 access token | ||
dataRef.authWithOAuthToken("facebook", "<ACCESS-TOKEN>", function(error, authData) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
console.log('Authenticated successfully with payload:', authData); | ||
} | ||
}); | ||
// Authenticate with Twitter using an existing OAuth 1.0a credential set | ||
dataRef.authWithOAuthToken("twitter", { | ||
"user_id" : "<USER-ID>", | ||
"oauth_token" : "<ACCESS-TOKEN>", | ||
"oauth_token_secret" : "<ACCESS-TOKEN-SECRET>", | ||
}, function(error, authData) { | ||
if (error) { | ||
console.log('Login Failed!', error); | ||
} else { | ||
console.log('Authenticated successfully with payload:', authData); | ||
} | ||
}); | ||
|
||
var authData = dataRef.getAuth(); | ||
if (authData) { | ||
console.log('Authenticated user with uid:', authData.uid); | ||
} | ||
|
||
var firebaseRef = new Firebase('https://samplechat.firebaseio-demo.com'); | ||
firebaseRef.onAuth(function(authData) { | ||
if (authData) { | ||
console.log('Client is authenticated with uid ' + authData.uid); | ||
} else { | ||
// Client is unauthenticated | ||
} | ||
}); | ||
|
||
var onAuthChange = function(authData) { /*...*/ }; | ||
firebaseRef.onAuth(onAuthChange); | ||
// Sometime later... | ||
firebaseRef.offAuth(onAuthChange); | ||
|
||
//Time to log out! | ||
dataRef.unauth(); | ||
|
||
|
@@ -120,64 +32,10 @@ var sampleChatRef2 :Firebase= fredRef2.root(); | |
var x3:string = sampleChatRef2.toString(); | ||
// x is now 'https://SampleChat.firebaseIO-demo.com'. | ||
|
||
var fredRef = new Firebase("https://samplechat.firebaseio-demo.com/users/fred"); | ||
var key = fredRef.key(); // key === "fred" | ||
key = fredRef.child("name/last").key(); // key === "last" | ||
key = fredRef.root().key(); // key === null, since fredRef refers to the root of the Firebase. | ||
|
||
var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred'); | ||
var x4:string = fredRef3.name(); | ||
// x is now 'fred'. | ||
|
||
/* | ||
* $set | ||
*/ | ||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); | ||
fredNameRef.child('first').set('Fred'); | ||
fredNameRef.child('last').set('Flintstone'); | ||
// We've written 'Fred' to the Firebase location storing fred's first name, | ||
// and 'Flintstone' to the location storing his last name | ||
|
||
fredNameRef.set({ first: 'Fred', last: 'Flintstone' }); | ||
// Exact same effect as the previous example, except we've written | ||
// fred's first and last name simultaneously | ||
|
||
var onComplete = function(error) { | ||
if (error) { | ||
console.log('Synchronization failed'); | ||
} else { | ||
console.log('Synchronization succeeded'); | ||
} | ||
}; | ||
fredNameRef.set({ first: 'Fred', last: 'Flintstone' }, onComplete); | ||
// Same as the previous example, except we will also log a message | ||
// when the data has finished synchronizing | ||
|
||
|
||
/* | ||
* $update | ||
*/ | ||
var fredNameRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred/name'); | ||
// Modify the 'first' and 'last' children, but leave other data at fredNameRef unchanged | ||
fredNameRef.update({ first: 'Fred', last: 'Flintstone' }); | ||
|
||
// Same as the previous example, except we will also display an alert | ||
// message when the data has finished synchronizing. | ||
var onComplete = function(error) { | ||
if (error) { | ||
console.log('Synchronization failed'); | ||
} else { | ||
console.log('Synchronization succeeded'); | ||
} | ||
}; | ||
fredNameRef.update({ first: 'Wilma', last: 'Flintstone' }, onComplete); | ||
|
||
var fredRef = new Firebase('https://samplechat.firebaseio-demo.com/users/fred'); | ||
//The following 2 function calls are equivalent | ||
fredRef.update({ name: { first: 'Fred', last: 'Flintstone' }}); | ||
fredRef.child('name').set({ first: 'Fred', last: 'Flintstone' }); | ||
|
||
|
||
// Increment Fred's rank by 1. | ||
var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank'); | ||
fredRankRef.transaction(function(currentRank: number) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters