Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ts): add ts declaration #166

Merged
merged 1 commit into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "cordova-plugin-firebasex",
"version": "6.1.0",
"description": "Cordova plugin for Google Firebase",
"types": "./types/index.d.ts",
"author": {
"name": "Dave Alden"
},
Expand Down
59 changes: 59 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
interface IChannelOptions {
id: string
name?: string
sound?: string
vibration?: boolean | number[]
light?: boolean
lightColor?: string
importance?: 0 | 1 | 2 | 3 | 4
badge?: boolean
visibility?: -1 | 0 | 1
}

interface FirebasePlugin {
getToken(success: (value: string) => void, error: (err: string) => void): void
onTokenRefresh(success: (value: string) => void, error: (err: string) => void): void
getAPNSToken(success: (value: string) => void, error: (err: string) => void): void
onMessageReceived(success: (value: object) => void, error: (err: string) => void): void
grantPermission(success: (value: boolean) => void, error: (err: string) => void): void
hasPermission(success: (value: boolean) => void, error: (err: string) => void): void
unregister(): void
setBadgeNumber(badgeNumber: number): void
getBadgeNumber(success: (badgeNumber: number) => void, error: (err: string) => void): void
clearAllNotifications(): void
subscribe(topic: string): void
unsubscribe(topic: string): void
createChannel(channel: IChannelOptions, success: () => void, error: (err: string) => void): void
setDefaultChannel(channel: IChannelOptions, success: () => void, error: (err: string) => void): void
deleteChannel(channel: string, success: () => void, error: (err: string) => void): void
listChannels(success: (list: { id: string; name: string }[]) => void, error: (err: string) => void): void
setAnalyticsCollectionEnabled(setEnabled: boolean): void
logEvent(eventName: string, eventProperties: object): void
setScreenName(screenName: string): void
setUserId(userId: string): void
setUserProperty(userName: string, userValue: string): void
setCrashlyticsCollectionEnabled(): void
setCrashlyticsUserId(userId: string): void
sendCrash(): void
logMessage(message: string): void
logError(errorMessage: string): void
verifyPhoneNumber(
phoneNumber: string,
timeOutDuration: number,
success: (value: string | object) => void,
error: (err: string) => void
): void
fetch(cacheExpirationSeconds: number, success: () => void, error: (err: string) => void): void
fetch(success: () => void, error: (err: string) => void): void
activateFetched(success: (activated: boolean) => void, error: (err: string) => void): void
getValue(key: string, success: (value: string) => void, error: (err: string) => void): void
getByteArray(key: string, success: (value: object) => void, error: (err: string) => void): void
getInfo(success: (info: object) => void, error: (err: string) => void): void
setConfigSettings(configSettings: object, success: (info: object) => void, error: (err: string) => void): void
setDefaults(defaultSettings: object, success: (info: object) => void, error: (err: string) => void): void
setPerformanceCollectionEnabled(setEnabled: boolean): void
startTrace(name: string, success: () => void, error: (err: string) => void): void
incrementCounter(name: string, counterName: string, success: () => void, error: (err: string) => void): void
stopTrace(name: string): void
}
declare var FirebasePlugin: FirebasePlugin;