react-shareable-buttons
Version:
Social media share buttons and share counts for React and Nextjs.
73 lines (72 loc) • 2.91 kB
TypeScript
declare global {
interface Window {
OK: {
Share: {
count: (index: number, _count: number) => void;
};
callbacks: ((count?: number) => void)[];
};
ODKL: {
updateCount: (index: string, count: string) => void;
};
}
interface Window {
VK: {
Share?: {
count: (index: number, count: number) => void;
};
callbacks?: ((count?: number) => void)[];
};
}
}
/**
* Retrieves the share count of a Facebook post or URL.
*
* @param shareUrl - The URL or post to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
* @param appId - The Facebook app ID (optional).
* @param appSecret - The Facebook app secret (optional).
*/
export declare function getFacebookShareCount(shareUrl: string, callback: (shareCount?: number) => void, appId?: string, appSecret?: string): void;
/**
* Retrieves the share count of a URL on Hatena Bookmark.
*
* @param shareUrl - The URL to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
*/
export declare function getHatenaShareCount(shareUrl: string, callback: (shareCount?: number) => void): void;
/**
* Retrieves the share count of a URL on OK.ru (Odnoklassniki).
*
* @param shareUrl - The URL to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
*/
export declare function getOKShareCount(shareUrl: string, callback: (shareCount?: number) => void): () => void;
/**
* Retrieves the share count of a URL on Pinterest.
*
* @param shareUrl - The URL to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
*/
export declare function getPinterestShareCount(shareUrl: string, callback: (shareCount?: number) => void): void;
/**
* Retrieves the share count of a URL on Reddit.
*
* @param shareUrl - The URL to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
*/
export declare function getRedditShareCount(shareUrl: string, callback: (shareCount?: number) => void): void;
/**
* Retrieves the share count of a URL on Tumblr.
*
* @param shareUrl - The URL to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
*/
export declare function getTumblrShareCount(shareUrl: string, callback: (shareCount?: number) => void): () => void;
/**
* Retrieves the share count of a URL on VK.com (VKontakte).
*
* @param shareUrl - The URL to retrieve the share count for.
* @param callback - The callback function to be called with the share count.
*/
export declare function getVKShareCount(shareUrl: string, callback: (shareCount?: number) => void): () => void;