alex35mil / sourcebuster-js

Track the sources of your traffic
https://alexfedoseev.github.io/sbjs
MIT License
412 stars 92 forks source link

Require Typescript Declaration file #40

Open praveenrejeti opened 2 years ago

praveenrejeti commented 2 years ago

Am using typescript extensively, require d.ts file

Created one on my own but was unable to add the methods, can anyone share the d.ts having methods, here is my d.ts file

declare module "sourcebuster" {
    class sbjs{
        init(prefs:Preferences);
    }

    interface Preferences{
        lifetime?:number
        session_length?:number
        timezone_offset?:number
        campaign_param?:string
        term_param?:string
        content_param?:string
        user_ip?:string
        promocode?:boolean|PromoCode
        typein_attributes?:TypeInAttributes
        domain?:string | Domain
        callback:(data:any)=>void
    }

    interface Domain{
        host:string
    }

    interface TypeInAttributes{
        source:string,
        medium:string
    }

    interface PromoCode{
        max:number,
        min:number
    }
    export = new sbjs();
}