Skip to content

Commit

Permalink
Added TypeScript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Feb 27, 2016
1 parent baadb4e commit 1ad91b9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var email = require("nativescript-email");
to: ['[email protected]', '[email protected]'],
cc: ['[email protected]'],
bcc: ['[email protected]', '[email protected]']
}).then(function(r) {
}).then(function() {
console.log("Email composer closed");
});
```
Expand Down
5 changes: 3 additions & 2 deletions email.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ exports.compose = function (arg) {
}
}

mail.putExtra(android.content.Intent.EXTRA_SUBJECT, arg.subject);

if (arg.subject) {
mail.putExtra(android.content.Intent.EXTRA_SUBJECT, arg.subject);
}
if (arg.to) {
mail.putExtra(android.content.Intent.EXTRA_EMAIL, toStringArray(arg.to));
}
Expand Down
38 changes: 38 additions & 0 deletions email.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
declare module "nativescript-email" {

/**
* The options object passed into the compose function.
*/
export interface ComposeOptions {
/**
* The subject of your email.
*/
subject?: string;

/**
* The plugin will automatically handle plain and html email content.
*/
body?: string;

/**
* A string array of email addresses.
* Known issue: on Android only the first item in the array is added.
*/
to?: string[];

/**
* A string array of email addresses.
* Known issue: on Android only the first item in the array is added.
*/
cc?: string[];

/**
* A string array of email addresses.
* Known issue: on Android only the first item in the array is added.
*/
bcc?: string[];
}

export function available(): Promise<boolean>;
export function compose(options: ComposeOptions): Promise<any>;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-email",
"version": "1.1.1",
"version": "1.1.2",
"description": "Email plugin for your NativeScript app",
"main": "email.js",
"nativescript": {
Expand Down

0 comments on commit 1ad91b9

Please sign in to comment.