mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Update solid-auth-client API for 2.4 release (#42309)
* Update API for 2.4 release
Specifically, it added the stopTrackSession() method.
* Reflect that trackSession technically is async
It's typically only used for the callback, but it _is_ an async
function:
f8d53797af/src/solid-auth-client.js (L83)
This commit is contained in:
parent
4fe7e4448c
commit
65987f98bf
5
types/solid-auth-client/index.d.ts
vendored
5
types/solid-auth-client/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for solid-auth-client 2.3
|
||||
// Type definitions for solid-auth-client 2.4
|
||||
// Project: https://github.com/solid/solid-auth-client#readme
|
||||
// Definitions by: Vincent <https://github.com/Vinnl>
|
||||
// James <https://github.com/durandj>
|
||||
@ -25,7 +25,8 @@ interface LoginOptions {
|
||||
export interface SolidAuthClient extends EventEmitter {
|
||||
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
||||
currentSession(storage?: AsyncStorage): Promise<Session | undefined>;
|
||||
trackSession(callback: (session?: Session) => void): void;
|
||||
trackSession(callback: (session?: Session) => void): Promise<void>;
|
||||
stopTrackSession(callback: (session?: Session) => void): void;
|
||||
login(identityProvider: string, options?: LoginOptions): Promise<void>;
|
||||
logout(storage?: AsyncStorage): Promise<void>;
|
||||
popupLogin(params?: LoginOptions): Promise<Session>;
|
||||
|
||||
@ -7,6 +7,13 @@ auth.trackSession(session => {
|
||||
console.log(`The user is ${session.webId}`);
|
||||
});
|
||||
|
||||
auth.stopTrackSession(session => {
|
||||
if (!session)
|
||||
console.log('The user is not logged in');
|
||||
else
|
||||
console.log(`The user is ${session.webId}`);
|
||||
});
|
||||
|
||||
auth.fetch('https://timbl.com/timbl/Public/friends.ttl').then(console.log);
|
||||
|
||||
async function login(idp: string) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user