UNPKG

@repugraf/cross-domain-storage

Version:

Enables shared cross domain localStorage and sessionStorage

42 lines 1.05 kB
import { IMethod, IStorageType } from "./shared.js"; interface IAllowedDomain { /** RegExp of allowed domain */ origin: RegExp; allowedMethods?: IMethod[]; allowedStorageTypes?: IStorageType[]; } interface IServerConfig { /** List of allowed domains. Domains not included in this list will be rejected */ allowedDomains: IAllowedDomain[]; /** Will log errors, warnings and useful info */ debug?: boolean; } /** * Creates a server to listen to clients * * Call `listen` to start accepting client connections * * ```js * const server = getServer({ * allowedDomains: [ * { * origin: /sub1.example.com$/, * allowedMethods: ["get", "set", "remove"] * }, * { * origin: /sub2.example.com$/, * allowedMethods: ["get"] * } * ] * }); * * await server.listen(); * ``` */ declare const getServer: (config: IServerConfig) => { listen: () => void; stopListening: () => void; readonly clients: string[]; }; export { getServer }; //# sourceMappingURL=server.d.ts.map