diff --git a/cordova-ionic/cordova-ionic.d.ts b/cordova-ionic/cordova-ionic.d.ts index c9b1e635b..5f0adee3e 100644 --- a/cordova-ionic/cordova-ionic.d.ts +++ b/cordova-ionic/cordova-ionic.d.ts @@ -5,10 +5,6 @@ /// -interface Cordova { - plugins:Plugins; -} - -interface Plugins { +interface CordovaPlugins { Keyboard:Ionic.Keyboard; } diff --git a/cordova-plugin-email-composer/cordova-plugin-email-composer-tests.ts b/cordova-plugin-email-composer/cordova-plugin-email-composer-tests.ts new file mode 100644 index 000000000..ccd1e725d --- /dev/null +++ b/cordova-plugin-email-composer/cordova-plugin-email-composer-tests.ts @@ -0,0 +1,19 @@ +/// +/// + +cordova.plugins.email.isAvailable((isAvailable) => {}, {}); +cordova.plugins.email.open({ + to: ['foo@bar.com'], + body: 'foo bar' +}); +cordova.plugins.email.open(); +cordova.plugins.email.open({}, () => {}); +cordova.plugins.email.open({}, () => {}, {}); + +cordova.plugins.email.openDraft({ + to: ['foo@bar.com'], + body: 'foo bar' +}); +cordova.plugins.email.openDraft(); +cordova.plugins.email.openDraft({}, () => {}); +cordova.plugins.email.openDraft({}, () => {}, {}); diff --git a/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts b/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts new file mode 100644 index 000000000..9472ccf35 --- /dev/null +++ b/cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts @@ -0,0 +1,33 @@ +// Type definitions for Apache Cordova Email Composer plugin +// Project: https://github.com/katzer/cordova-plugin-email-composer +// Definitions by: Dave Taylor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * The plugin provides access to the standard interface that manages the + * editing and sending an email message + */ +interface CordovaPluginEmailComposer { + /** Determine if the device is capable to send emails */ + isAvailable(callback:(isAvailable:boolean) => void, scope?:any):void; + /** Open a pre-filled email draft */ + open(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void; + openDraft(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void; +} + +interface ICordovaPluginEmailComposerOpenOptions { + /** An configured email account is required to send emails */ + to?:string[]; + body?:string; + cc?:string[]; + bcc?:string[]; + /** Attachments can be either base64 encoded datas, files from the the device storage or assets from within the www folder */ + attachments?:any[]; + subject?:string; + /** The default value for isHTML is true */ + isHtml?:boolean; +} + +interface CordovaPlugins { + email:CordovaPluginEmailComposer; +} diff --git a/cordova/cordova.d.ts b/cordova/cordova.d.ts index 75b77ebe2..32ef0a76b 100644 --- a/cordova/cordova.d.ts +++ b/cordova/cordova.d.ts @@ -43,8 +43,12 @@ interface Cordova { define(moduleName: string, factory: (require: any, exports: any, module: any) => any): void; /** Access a Cordova module by name. */ require(moduleName: string): any; + /** Namespace for Cordova plugin functionality */ + plugins:CordovaPlugins; } +interface CordovaPlugins {} + interface Document { addEventListener(type: "deviceready", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void;