skynet-mysky-utils
Version:
Skynet common MySky utilities
51 lines • 1.89 kB
TypeScript
/**
* Creates an invisible iframe with the given src and adds it to the page.
*
* @param srcUrl - The URL to use as src for the iframe.
* @param name - The name for the iframe element.
* @returns - The iframe element.
* @throws - Will throw if the iframe could not be created.
*/
export declare function createIframe(srcUrl: string, name: string): HTMLIFrameElement;
/**
* Creates a full-screen iframe with the given src and adds it to the page.
*
* @param srcUrl - The URL to use as src for the iframe.
* @param name - The name for the iframe element.
* @returns - The iframe element.
* @throws - Will throw if the iframe could not be created.
*/
export declare function createFullScreenIframe(srcUrl: string, name: string): HTMLIFrameElement;
/**
* Ensures that the given string is a URL.
*
* @param url - The given string.
* @returns - The URL.
*/
export declare function ensureUrl(url: string): string;
/**
* Removes duplicate adjacent characters from the given string.
*
* @param str - The given string.
* @param char - The character to remove duplicates of.
* @returns - The string without duplicate adjacent characters.
*/
export declare function removeAdjacentChars(str: string, char: string): string;
/**
* Removes a suffix from the end of the string.
*
* @param str - The string to process.
* @param suffix - The suffix to remove.
* @param [limit] - Maximum amount of times to trim. No limit by default.
* @returns - The processed string.
*/
export declare function trimSuffix(str: string, suffix: string, limit?: number): string;
/**
* Prepends the prefix to the given string only if the string does not already start with the prefix.
*
* @param str - The string.
* @param prefix - The prefix.
* @returns - The prefixed string.
*/
export declare function ensurePrefix(str: string, prefix: string): string;
//# sourceMappingURL=utils.d.ts.map