vue-socials
Version:
Social media share buttons and counts for Vue.js
17 lines (16 loc) • 614 B
TypeScript
declare type TJSONPCallbackRegistryFunction<T> = (response: T) => void;
declare type TJSONPCallback<T> = (err: Error | null, data: T | null) => void;
declare global {
interface Window {
callbackRegistry: {
[key: string]: TJSONPCallbackRegistryFunction<never>;
};
}
}
/**
* Simple implementation of JSONP.
* It creates window.callbackRegistry to minimize global window pollution.
* It uses callback to prevent adding the promise polyfill.
*/
export default function JSONP<T>(url: string, callback?: TJSONPCallback<T>, callbackName?: string): void;
export {};