mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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)
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
// 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>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.2
|
|
import { EventEmitter } from 'events';
|
|
|
|
export interface Session {
|
|
webId: string;
|
|
}
|
|
|
|
export interface AsyncStorage {
|
|
getItem(key: string): Promise<undefined | string>;
|
|
setItem(key: string, value: string): Promise<void>;
|
|
removeItem(key: string): Promise<void>;
|
|
}
|
|
|
|
interface LoginOptions {
|
|
callbackUri?: string;
|
|
popupUri?: string;
|
|
storage?: Storage | AsyncStorage;
|
|
}
|
|
|
|
export interface SolidAuthClient extends EventEmitter {
|
|
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
currentSession(storage?: AsyncStorage): Promise<Session | undefined>;
|
|
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>;
|
|
}
|
|
|
|
declare const instantiated: SolidAuthClient;
|
|
export default instantiated;
|