-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add TypeScript declaration files (#15)
- Loading branch information
Showing
16 changed files
with
157 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "./tsconfig", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"noEmit": false, | ||
"emitDeclarationOnly": true | ||
}, | ||
"exclude": ["__tests__", "__mocks__"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
jest.mock('./RNBackgroundActionsModule'); | ||
jest.mock('./src/RNBackgroundActionsModule.js', () => ({ | ||
start: jest.fn(), | ||
stop: jest.fn(), | ||
})); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export default RNBackgroundActions; | ||
declare const RNBackgroundActions: any; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
export default backgroundServer; | ||
export type BackgroundTaskOptions = { | ||
taskName: string; | ||
taskTitle: string; | ||
taskDesc: string; | ||
taskIcon: { | ||
name: string; | ||
type: string; | ||
package?: string | undefined; | ||
}; | ||
color?: string | undefined; | ||
parameters?: any; | ||
}; | ||
declare const backgroundServer: BackgroundServer; | ||
/** | ||
* @typedef {{taskName: string, | ||
* taskTitle: string, | ||
* taskDesc: string, | ||
* taskIcon: {name: string, type: string, package?: string}, | ||
* color?: string, | ||
* parameters?: any}} BackgroundTaskOptions | ||
*/ | ||
declare class BackgroundServer { | ||
_runnedTasks: number; | ||
_stopTask: () => void; | ||
_isRunning: boolean; | ||
/** | ||
* Returns if the current background task is running. | ||
* | ||
* It returns `true` if `start()` has been called and the task has not finished. | ||
* | ||
* It returns `false` if `stop()` has been called, **even if the task has not finished**. | ||
*/ | ||
isRunning(): boolean; | ||
/** | ||
* @param {(taskData: any) => Promise<void>} task | ||
* @param {BackgroundTaskOptions} options | ||
* @returns {Promise<void>} | ||
*/ | ||
async start(task: (taskData: any) => Promise<void>, options: { | ||
taskName: string; | ||
taskTitle: string; | ||
taskDesc: string; | ||
taskIcon: { | ||
name: string; | ||
type: string; | ||
package?: string | undefined; | ||
}; | ||
color?: string | undefined; | ||
parameters?: any; | ||
}): Promise<void>; | ||
/** | ||
* @private | ||
* @param {(taskData: any) => Promise<void>} task | ||
* @param {any} [parameters] | ||
*/ | ||
private _generateTask; | ||
/** | ||
* @private | ||
* @param {BackgroundTaskOptions} options | ||
*/ | ||
private _normalizeOptions; | ||
/** | ||
* Stops the background task. | ||
* | ||
* @returns {Promise<void>} | ||
*/ | ||
async stop(): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true, | ||
"noEmit": true, | ||
"strict": true, | ||
"skipLibCheck": true, | ||
}, | ||
"include": ["src/index.js", "__tests__/", "__mocks__/"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters