Compare commits

..

42 Commits

Author SHA1 Message Date
Ibby Hadeed
8c842b00b6 3.8.1 2017-05-16 05:53:15 -04:00
Ibby Hadeed
c6feaafcca tslint 2017-05-16 05:49:09 -04:00
Ibby Hadeed
a7f7b26a76 reafactor(): amend last commit 2017-05-16 05:44:50 -04:00
Ibby Hadeed
d0dec7a17d fix(file): various fixes
closes #1564
2017-05-16 05:44:01 -04:00
Ibby Hadeed
7487293d33 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-16 05:31:42 -04:00
Ibby Hadeed
4f6ec0cfcd test(): update tests 2017-05-16 05:31:35 -04:00
Daniel Sogl
b35417a017 fix(document-viewer): fix params and docs for canViewDocument (#1568)
* refactor(document-viewer): fix example

* Update index.ts

* Update index.ts
2017-05-16 04:32:31 -04:00
David Routhieau
adf9c5a323 fix(file): fix repo link (#1566) 2017-05-16 00:38:39 -04:00
Raman Rasliuk
7c797123f5 fix(file): add toInternalURL (#1561)
* Put back toInternalURL

What was the reason to remove `toInternalURL` from `Entry`?
Fixes #1560

* Remove trailing whitespace
2017-05-15 04:55:06 -04:00
Daniel Sogl
bd1794d7f5 github(template): issue template (#1559)
* github(tempalte): issue template

* Update ISSUE_TEMPLATE.md
2017-05-15 03:23:54 -04:00
Daniel Sogl
46502cb864 docs(ionic-site): CLI V3 command (#1556) 2017-05-14 05:30:34 -04:00
Ibby Hadeed
02cc615c21 ci-tests fixes 2017-05-14 03:26:11 -04:00
Ibby Hadeed
749fd8af43 tests(): add basic tests (#1555) 2017-05-14 03:25:33 -04:00
Ibby Hadeed
e2acde5332 chore(): test plugin changes when PR is submitted (#1554)
* ci tests

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update
2017-05-14 03:19:48 -04:00
Ibby Hadeed
5203d026d4 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-14 02:09:11 -04:00
Ibby Hadeed
362ae4422b docs(sqlite): fix doc generation issue 2017-05-14 02:09:07 -04:00
Nicolas Molina Monroy
965a90c52c feat(mix-panel): add timeEvent (#1536)
* feat(mix-panel): add timeEvent

* style(mixpanel): remove params
2017-05-14 00:58:22 -04:00
Ibby Hadeed
a28de660bc refactor(): no implicit any 2017-05-14 00:55:16 -04:00
Ibby Hadeed
fec19b734c fix(sqlite): fix implementation and improve typings 2017-05-14 00:52:30 -04:00
Ibby Hadeed
6773ed341c chore(): add --ignore-errors flag 2017-05-14 00:20:38 -04:00
Ibby Hadeed
23ad074d04 chore(): update changelog 2017-05-13 23:12:36 -04:00
Ibby Hadeed
912668d8f8 3.8.0 2017-05-13 23:12:29 -04:00
Ibby Hadeed
cf531af244 Merge branch 'master' of github.com:driftyco/ionic-native 2017-05-13 23:12:20 -04:00
Ibby Hadeed
a94651dc75 chore(): update templates 2017-05-13 22:53:04 -04:00
Alexandru Albu
ad0680bd90 docs(google-map): update install command (#1525)
command for adding plugin has changed
2017-05-13 22:47:01 -04:00
IonicOnCouch
66a82dd5ce docs(): maximumImagesCount works only for Android. (#1540)
The option "maximumImagesCount" works only for Android. So there should be a comment.
2017-05-13 22:46:41 -04:00
jasonmamy
8ea8ac40e5 refactor(wheel-selector): fixed the interfaces and default values (#1544) 2017-05-13 22:46:19 -04:00
Daniel Sogl
2d477ba9a0 docs(readme): https + removed V2 tag (#1551) 2017-05-13 22:46:09 -04:00
Ibby Hadeed
f98f90a9a3 fix(file): various fixes (#1553)
* save schanges

* save changes

* save changes

* save changes
2017-05-13 22:44:10 -04:00
wleberre
fba0ce2bb6 docs(): fix typo (#1548) 2017-05-13 21:28:22 -04:00
Daniel Sogl
22d0260cde chore(package): bump angular and typescript (#1549) 2017-05-13 20:19:45 -04:00
Daniel Sogl
25aeb406ae core(package): update tslint-ionic-rules (#1539) 2017-05-12 05:03:52 -04:00
Daniel Sogl
385da017a0 feat(video-capture-plus): add Video Capture Plus plugin (#1538)
* feat(plugin): Video Capture Plus

fix #709

* Updated interfaces
2017-05-12 05:03:24 -04:00
Raman Rasliuk
efae1be116 fix(file): fix file reader (#1537)
Pass reader object on call function.
Fixes #1530
2017-05-12 04:18:38 -04:00
Eamon Bauman
7f919d5c90 docs(): fix options for prepareInterstitial (#1535)
Using the example in the previous version of this document, calling prepareInterstitial(adId) resulted in an
"-[__NSCFString count]: unrecognized selector sent to instance"
exception. This was alleviated by changing the call to prepareInterstitial({adId: adId}) 
(e.g. passing in an options object vs. just the adid string)
2017-05-12 04:16:48 -04:00
ChristopherTotty
00c156811f docs(geolocation): fix reference (#1533) 2017-05-12 04:16:14 -04:00
Jan Piotrowski
8512dd5d92 docs(header-color): improve description (#1532) 2017-05-12 04:16:01 -04:00
Niccolò Belli
ad514bbf63 fix(fcm): fix method name (#1531) 2017-05-12 04:15:35 -04:00
Dave Alden
45108c4c18 fix(diagnostic): fix Cordova decorator in camera API (#1527) 2017-05-12 03:53:56 -04:00
Diogo Trentini
17e166d04d docs(camera-preview): fix interface name (#1526) 2017-05-12 03:50:27 -04:00
Ibby Hadeed
10d61c21c2 fix(app-minimize): fix pluginRef 2017-05-11 04:48:25 -04:00
Ibby Hadeed
7e322aadb8 docs(firebase): mark plugin as beta 2017-05-09 23:50:23 -04:00
64 changed files with 1335 additions and 483 deletions

28
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,28 @@
**I'm submitting a ...** (check one with "x")
[ ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/
**Current behavior:**
<!-- Describe how the bug manifests. -->
**Expected behavior:**
<!-- Describe what the behavior would be without the bug. -->
**Steps to reproduce:**
<!-- If you are able to illustrate the bug or feature request with an example, please provide steps to reproduce. -->
**Related code:**
```
insert any relevant code here
```
**Other information:**
<!-- List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, etc. -->
**package.json info:**
```json
insert the content here
```

View File

@@ -1,3 +1,22 @@
<a name="3.8.0"></a>
# [3.8.0](https://github.com/driftyco/ionic-native/compare/v3.7.0...v3.8.0) (2017-05-14)
### Bug Fixes
* **app-minimize:** fix pluginRef ([10d61c2](https://github.com/driftyco/ionic-native/commit/10d61c2))
* **diagnostic:** fix Cordova decorator in camera API (#1527) ([45108c4](https://github.com/driftyco/ionic-native/commit/45108c4)), closes [#1527](https://github.com/driftyco/ionic-native/issues/1527)
* **fcm:** fix method name (#1531) ([ad514bb](https://github.com/driftyco/ionic-native/commit/ad514bb)), closes [#1531](https://github.com/driftyco/ionic-native/issues/1531)
* **file:** fix file reader (#1537) ([efae1be](https://github.com/driftyco/ionic-native/commit/efae1be)), closes [#1537](https://github.com/driftyco/ionic-native/issues/1537) [#1530](https://github.com/driftyco/ionic-native/issues/1530)
* **file:** various fixes (#1553) ([f98f90a](https://github.com/driftyco/ionic-native/commit/f98f90a)), closes [#1553](https://github.com/driftyco/ionic-native/issues/1553)
### Features
* **video-capture-plus:** add Video Capture Plus plugin (#1538) ([385da01](https://github.com/driftyco/ionic-native/commit/385da01)), closes [#709](https://github.com/driftyco/ionic-native/issues/709)
<a name="3.7.0"></a>
# [3.7.0](https://github.com/driftyco/ionic-native/compare/v3.6.1...v3.7.0) (2017-05-09)

View File

@@ -3,7 +3,7 @@
# Ionic Native
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic 2](http://ionicframework.com/) mobile app easy.
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile app easy.
Ionic Native wraps plugin callbacks in a Promise or Observable, providing a common interface for all plugins and making it easy to use plugins with Angular change detection.
@@ -14,11 +14,11 @@ Run following command to install Ionic Native in your project.
npm install @ionic-native/core --save
```
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](http://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](https://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
## Documentation
For the full Ionic Native documentation, please visit [http://ionicframework.com/docs/native/](http://ionicframework.com/docs/native/).
For the full Ionic Native documentation, please visit [https://ionicframework.com/docs/native/](https://ionicframework.com/docs/native/).
### Basic Usage
@@ -165,7 +165,7 @@ export class AppModule {}
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
![img](http://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
![img](https://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
## Plugin Missing?
@@ -177,12 +177,12 @@ For Ionic V1/Angular 1 support, please use version 2 of Ionic Native. See the [2
# Credits
Ibby Hadeed - [@ihadeed](http://github.com/ihadeed)
Ibby Hadeed - [@ihadeed](https://github.com/ihadeed)
Tim Lancina - [@timlancina](http://twitter.com/timlancina)
Tim Lancina - [@timlancina](https://twitter.com/timlancina)
Mike Hartington - [@mhartington](https://twitter.com/mhartington)
Max Lynch - [@maxlynch](http://twitter.com/maxlynch)
Max Lynch - [@maxlynch](https://twitter.com/maxlynch)
Rob Wormald - [@robwormald](https://twitter.com/robwormald)

View File

@@ -7,12 +7,15 @@ jobs:
steps:
- checkout
- restore_cache:
key: ionic-site
key: ionic-site-{{ .Branch }}
- run:
name: Prepare ionic-site repo
command: ./scripts/docs/prepare.sh
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./scripts/docs/prepare.sh
fi
- save_cache:
key: ionic-site
key: ionic-site-{{ .Branch }}
paths:
- ~/ionic-site/
- restore_cache:
@@ -27,6 +30,12 @@ jobs:
- run:
name: Run tslint
command: npm run lint
- run:
name: Build changed plugins
command: node scripts/ci-tests.js
- run:
name: Run tests
command: npm test
- add_ssh_keys
- deploy:
name: Update docs

View File

@@ -34,14 +34,16 @@ gulp.task('plugin:create', () => {
const src = flags.m ? './scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl',
pluginName = flags.n,
pluginNameSpaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1');
spaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1'),
kebabCase = _.kebabCase(pluginName);
return gulp.src(src)
.pipe(replace('$PluginName', pluginName))
.pipe(replace('$Plugin_Name', pluginNameSpaced))
.pipe(replace('$pluginName', _.lowerFirst(pluginName)))
.pipe(replace('{{ PluginName }}', pluginName))
.pipe(replace('{{ Plugin_Name }}', spaced))
.pipe(replace('{{ pluginName }}', _.lowerFirst(pluginName)))
.pipe(replace('{{ plugin-name }}', kebabCase))
.pipe(rename('index.ts'))
.pipe(gulp.dest('./src/@ionic-native/plugins/' + _.kebabCase(pluginName)));
.pipe(gulp.dest('./src/@ionic-native/plugins/' + kebabCase));
} else {
console.log("Usage is: gulp plugin:create -n PluginName");

55
karma.conf.js Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
module.exports = config => {
const conf = {
frameworks: [
'jasmine',
'karma-typescript'
],
plugins: [
'karma-typescript',
'karma-jasmine',
'karma-phantomjs-launcher'
],
preprocessors: {
'src/**/*.ts': ['karma-typescript']
},
karmaTypescriptConfig: {
bundlerOptions: {
entrypoints: /\.spec\.ts$/,
transforms: [
require("karma-typescript-es6-transform")()
]
},
compilerOptions: {
lib: ['es2015', 'dom'],
paths: {
"@ionic-native/core": ["./src/@ionic-native/core"]
},
baseUrl: '.'
}
},
files: [
{ pattern: 'src/**/*.ts', included: true, watched: true }
],
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.INFO,
autoWatch: true,
browsers: [
'PhantomJS'
],
singleRun: false
};
config.set(conf);
};

View File

@@ -1,12 +1,15 @@
{
"name": "ionic-native",
"version": "3.7.0",
"version": "3.8.1",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"license": "MIT",
"devDependencies": {
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/compiler": "4.1.2",
"@angular/compiler-cli": "4.1.2",
"@angular/core": "4.1.2",
"@types/cordova": "0.0.34",
"@types/jasmine": "^2.5.47",
"@types/node": "^7.0.18",
"canonical-path": "0.0.2",
"child-process-promise": "2.2.0",
"conventional-changelog-cli": "1.2.0",
@@ -21,6 +24,13 @@
"gulp-rename": "1.2.2",
"gulp-replace": "0.5.4",
"gulp-tslint": "6.1.2",
"jasmine-core": "^2.6.1",
"karma": "^1.7.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.1.0",
"karma-phantomjs-launcher": "^1.0.4",
"karma-typescript": "^3.0.1",
"karma-typescript-es6-transform": "^1.0.0",
"lodash": "4.17.4",
"minimist": "1.1.3",
"node-html-encoder": "0.0.2",
@@ -30,9 +40,9 @@
"rxjs": "5.1.1",
"semver": "5.3.0",
"tslint": "3.15.1",
"tslint-ionic-rules": "0.0.7",
"typescript": "2.2.1",
"zone.js": "^0.8.4"
"tslint-ionic-rules": "0.0.8",
"typescript": "2.3.2",
"zone.js": "^0.8.10"
},
"scripts": {
"start": "npm run test:watch",
@@ -44,7 +54,9 @@
"shipit": "npm run build && gulp readmes && npm run npmpub",
"npmpub": "node scripts/build/publish.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"postchangelog": "git commit -am \"chore(): update changelog\""
"postchangelog": "git commit -am \"chore(): update changelog\"",
"test": "karma start karma.conf.js --single-run",
"test:watch": "karma start karma.conf.js"
},
"config": {
"commitizen": {

View File

@@ -52,6 +52,16 @@ const PLUGINS = fs.readdirSync(PLUGINS_PATH);
// Build specific list of plugins to build from arguments, if any
let pluginsToBuild = process.argv.slice(2);
let ignoreErrors = false;
let errors = [];
const index = pluginsToBuild.indexOf('ignore-errors');
if (index > -1) {
ignoreErrors = true;
pluginsToBuild.splice(index, 1);
console.log('Build will continue even if errors were thrown. Errors will be printed when build finishes.');
}
if (!pluginsToBuild.length) {
pluginsToBuild = PLUGINS;
}
@@ -102,10 +112,16 @@ const addPluginToQueue = pluginName => {
exec(`${ROOT}/node_modules/.bin/ngc -p ${tsConfigPath}`, (err, stdout, stderr) => {
if (err) {
// oops! something went wrong.
callback(`\n\nBuilding ${pluginName} failed.`);
console.log(err);
return;
if (!ignoreErrors) {
// oops! something went wrong.
console.log(err);
callback(`\n\nBuilding ${pluginName} failed.`);
return;
} else {
errors.push(err);
}
}
// we're done with this plugin!
@@ -125,7 +141,17 @@ pluginsToBuild.forEach(addPluginToQueue);
QUEUE.start((err) => {
if (err) {
console.log('Error building plugins. ', err);
console.log('Error building plugins.');
console.log(err);
process.stderr.write(err);
process.exit(1);
} else if (errors.length) {
errors.forEach(e => {
console.log(e.message) && console.log('\n');
process.stderr.write(err);
});
console.log('Build complete with errors');
process.exit(1);
} else {
console.log('Done processing plugins!');
}

View File

@@ -13,7 +13,8 @@
"skipLibCheck": true,
"lib": ["es2015", "dom"],
"sourceMap": true,
"inlineSources": true
"inlineSources": true,
"noImplicitAny": true
},
"files": [
"../../src/@ionic-native/core/index.ts"

View File

@@ -16,7 +16,8 @@
"skipLibCheck": true,
"lib": ["es2015", "dom"],
"sourceMap": true,
"inlineSources": true
"inlineSources": true,
"noImplicitAny": true
},
"files": []
}

65
scripts/ci-tests.js Normal file
View File

@@ -0,0 +1,65 @@
const exec = require('child-process-promise').exec;
let diff;
exec(`git branch | grep \\* | cut -d ' ' -f2`)
.then(output => {
if (output.stderr) {
return Promise.reject(output.stderr);
}
const branch = output.stdout.trim();
if (branch !== 'master') {
console.log('Merging master branch in ...');
// not on master branch
// let's test the changes that were made
return exec(`git merge origin master`);
}
})
.then((output) => {
if (output && output.stderr) {
return Promise.reject(output.stderr);
}
console.log('Checking for differences ...');
return exec(`git diff --name-status origin master`)
})
.then((output) => {
if (output && output.stderr) {
return Promise.reject(output.stderr);
}
diff = output.stdout;
diff = diff.replace(/A\s+/g, '');
diff = diff.match(/src\/@ionic-native\/plugins\/([a-zA-Z0-9\-]+)\/index\.ts/g);
if (!diff) process.exit();
console.log(`${ diff.length } plugins were modified. We will now build them to verify they still work.`);
return exec('npm run build:core --silent');
})
.then((output) => {
if (output && output.stderr) {
return Promise.reject(output.stderr);
}
console.log('Built core library successfully ...');
console.log('Building plugins ...');
diff = diff.map(text => text.replace('src/@ionic-native/plugins/', '').replace('/index.ts', ''));
return exec(`npm run build:modules ${diff.join(' ')} --silent`);
})
.then((output) => {
if (output && output.stderr) {
console.log(output.stderr);
process.exit(1);
}
console.log(output.stdout);
process.exit();
})
.catch(e => {
console.log(e.message || e);
process.exit(1);
});

View File

@@ -16,7 +16,7 @@
<@ for prop in doc.decorators[0].argumentInfo @>
```
$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif @>
$ <@ if prop.install @><$ prop.install $><@ else @>ionic cordova plugin add <$ prop.plugin $><@ endif @>
$ npm install --save @ionic-native/<$ doc.npmId $>
```

View File

@@ -2,15 +2,15 @@ import { Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name $Plugin_Name
* @name {{ Plugin_Name }}
* @description
*
* @usage
* ```
* import { $PluginName } from 'ionic-native';
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
*
*
* constructor(private $pluginName: $PluginName) { }
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
*
* ...
*
@@ -18,13 +18,13 @@ import { Injectable } from '@angular/core';
* ```
*/
@Plugin({
pluginName: '$PluginName',
pluginName: '{{ PluginName }}',
plugin: '',
pluginRef: '',
repo: '',
platforms: []
})
@Injectable()
export class $PluginName extends IonicNativePlugin {
export class {{ PluginName }} extends IonicNativePlugin {
}

View File

@@ -15,28 +15,28 @@ import { Plugin, Cordova, CordovaProperty, CordovaInstance, InstanceProperty, Io
import { Observable } from 'rxjs/Observable';
/**
* @name $Plugin_Name
* @name {{ Plugin_Name }}
* @description
* This plugin does something
*
* @usage
* ```
* import { $PluginName } from '@ionic-native/';
* import { {{ PluginName }} } from '@ionic-native/{{ plugin-name }}';
*
*
* constructor(private $pluginName: $PluginName) { }
* constructor(private {{ pluginName }}: {{ PluginName }}) { }
*
* ...
*
*
* this.$pluginName.functionName('Hello', 123)
* this.{{ pluginName }}.functionName('Hello', 123)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: '$PluginName',
pluginName: '{{ PluginName }}',
plugin: '', // npm package name, example: cordova-plugin-camera
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
repo: '', // the github repository URL for the plugin
@@ -44,7 +44,7 @@ import { Observable } from 'rxjs/Observable';
install: '', // OPTIONAL install command, in case the plugin requires variables
})
@Injectable()
export class $PluginName extends IonicNativePlugin {
export class {{ PluginName }} extends IonicNativePlugin {
/**
* This function does something

View File

@@ -1,5 +1,3 @@
declare var window;
export function checkReady() {
const DEVICE_READY_TIMEOUT = 5000;
@@ -16,7 +14,7 @@ export function checkReady() {
});
setTimeout(() => {
if (!didFireReady && window.cordova) {
if (!didFireReady && !!window.cordova) {
console.warn(`Ionic Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
}
}, DEVICE_READY_TIMEOUT);

View File

@@ -0,0 +1,234 @@
import 'core-js';
import { Plugin, Cordova, CordovaProperty, CordovaCheck, CordovaInstance, InstanceProperty } from './decorators';
import { IonicNativePlugin } from './ionic-native-plugin';
import { ERR_CORDOVA_NOT_AVAILABLE, ERR_PLUGIN_NOT_INSTALLED } from './plugin';
declare const window: any;
class TestObject {
constructor(public _objectInstance: any) {}
@InstanceProperty
name: string;
@CordovaInstance({ sync: true })
pingSync(): string { return; }
@CordovaInstance()
ping(): Promise<any> { return; }
}
@Plugin({
pluginName: 'TestPlugin',
pluginRef: 'testPlugin',
repo: '',
plugin: 'cordova-plugin-my-plugin'
})
class TestPlugin extends IonicNativePlugin {
@CordovaProperty
name: string;
@Cordova({ sync: true })
pingSync(): string { return; }
@Cordova()
ping(): Promise<string> { return; }
@CordovaCheck()
customPing(): Promise<string> {
return Promise.resolve('pong');
}
create(): TestObject {
return new TestObject(TestPlugin.getPlugin().create());
}
}
function definePlugin() {
(window as any).testPlugin = {
name: 'John Smith',
ping: (success: Function, error: Function) => success('pong'),
pingSync: () => 'pong',
create: function TestObject() {
this.pingSync = () => 'pong';
this.ping = (success: Function, error: Function) => success('pong');
this.name = 'John Smith';
return this;
}
};
}
describe('Regular Decorators', () => {
let plugin: TestPlugin;
beforeEach(() => {
plugin = new TestPlugin();
definePlugin();
});
describe('Plugin', () => {
it('should set pluginName', () => {
expect(TestPlugin.getPluginName()).toEqual('TestPlugin');
});
it('should set pluginRef', () => {
expect(TestPlugin.getPluginRef()).toEqual('testPlugin');
});
it('should return original plugin object', () => {
expect(TestPlugin.getPlugin()).toEqual(window.testPlugin);
});
});
describe('Cordova', () => {
it('should do a sync function', () => {
expect(plugin.pingSync()).toEqual('pong');
});
it('should do an async function', (done: Function) => {
plugin.ping()
.then(res => {
expect(res).toEqual('pong');
done();
})
.catch(e => {
expect(e).toBeUndefined();
done('Method should have resolved');
});
});
it('should throw plugin_not_installed error', (done: Function) => {
delete window.testPlugin;
window.cordova = true;
expect(<any>plugin.pingSync()).toEqual(ERR_PLUGIN_NOT_INSTALLED);
plugin.ping()
.catch(e => {
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
delete window.cordova;
done();
});
});
it('should throw cordova_not_available error', (done: Function) => {
delete window.testPlugin;
expect(<any>plugin.pingSync()).toEqual(ERR_CORDOVA_NOT_AVAILABLE);
plugin.ping()
.catch(e => {
expect(e).toEqual(ERR_CORDOVA_NOT_AVAILABLE.error);
done();
});
});
});
describe('CordovaProperty', () => {
it('should return property value', () => {
expect(plugin.name).toEqual('John Smith');
});
it('should set property value', () => {
plugin.name = 'value2';
expect(plugin.name).toEqual('value2');
});
});
describe('CordovaCheck', () => {
it('should run the method when plugin exists', (done) => {
plugin.customPing()
.then(res => {
expect(res).toEqual('pong');
done();
});
});
it('shouldnt run the method when plugin doesnt exist', (done) => {
delete window.testPlugin;
window.cordova = true;
plugin.customPing()
.catch(e => {
expect(e).toEqual(ERR_PLUGIN_NOT_INSTALLED.error);
done();
});
});
});
});
describe('Instance Decorators', () => {
let instance: TestObject,
plugin: TestPlugin;
beforeEach(() => {
definePlugin();
plugin = new TestPlugin();
instance = plugin.create();
});
describe('Instance plugin', () => {
});
describe('CordovaInstance', () => {
it('should call instance async method', (done) => {
instance.ping()
.then(r => {
expect(r).toEqual('pong');
done();
});
});
it('should call instance sync method', () => {
expect(instance.pingSync()).toEqual('pong');
});
it('shouldnt call instance method when _objectInstance is undefined', () => {
delete instance._objectInstance;
instance.ping()
.then(r => {
expect(r).toBeUndefined();
})
.catch(e => {
expect(e).toBeUndefined();
});
});
});
describe('InstanceProperty', () => {
it('should return property value', () => {
expect(instance.name).toEqual('John Smith');
});
it('should set property value', () => {
instance.name = 'John Cena';
expect(instance.name).toEqual('John Cena');
});
});
});

View File

@@ -32,6 +32,8 @@ export interface PluginConfig {
* Supported platforms
*/
platforms?: string[];
[key: string]: any;
}
export interface CordovaOptions {
@@ -182,12 +184,12 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
* }
* ```
*/
export function Plugin(config: PluginConfig) {
return function(cls) {
export function Plugin(config: PluginConfig): ClassDecorator {
return function(cls: any) {
// Add these fields to the class
for (let k in config) {
cls[k] = config[k];
for (let prop in config) {
cls[prop] = config[prop];
}
cls['installed'] = function(printWarning?: boolean) {

View File

@@ -7,8 +7,11 @@ import 'rxjs/add/observable/fromEvent';
checkReady();
declare var window;
declare var Promise;
// declare const window;
// declare var Promise;
export const ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
export const ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
/**
@@ -16,8 +19,8 @@ declare var Promise;
* @return {boolean | { error: string } }
* @private
*/
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string);
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string);
export function checkAvailability(pluginRef: string, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(pluginObj: any, methodName?: string, pluginName?: string): boolean | { error: string };
export function checkAvailability(plugin: any, methodName?: string, pluginName?: string): boolean | { error: string } {
let pluginRef, pluginInstance, pluginPackage;
@@ -35,15 +38,11 @@ export function checkAvailability(plugin: any, methodName?: string, pluginName?:
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
if (!window.cordova) {
cordovaWarn(pluginName, methodName);
return {
error: 'cordova_not_available'
};
return ERR_CORDOVA_NOT_AVAILABLE;
}
pluginWarn(pluginName, pluginPackage, methodName);
return {
error: 'plugin_not_installed'
};
return ERR_PLUGIN_NOT_INSTALLED;
}
return true;
@@ -69,7 +68,7 @@ function setIndex(args: any[], opts: any = {}, resolve?: Function, reject?: Func
args.unshift(reject);
args.unshift(resolve);
} else if (opts.callbackStyle === 'node') {
args.push((err, result) => {
args.push((err: any, result: any) => {
if (err) {
reject(err);
} else {
@@ -135,8 +134,8 @@ function callCordovaPlugin(pluginObj: any, methodName: string, args: any[], opts
}
function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
@@ -145,13 +144,13 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
// to error
if (pluginResult && pluginResult.error) {
p.catch(() => { });
rej(pluginResult.error);
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
}
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
return getPromise((resolve, reject) => {
return getPromise((resolve: Function, reject: Function) => {
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) {
if (pluginResult.error) {
@@ -239,7 +238,7 @@ export function overrideFunction(pluginObj: any, methodName: string, args: any[]
* @private
*/
export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOptions = {}) {
return (...args) => {
return (...args: any[]) => {
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callCordovaPlugin(pluginObj, methodName, args, opts);
@@ -259,7 +258,7 @@ export const wrap = function(pluginObj: any, methodName: string, opts: CordovaOp
* @private
*/
export function wrapInstance(pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => {
return (...args: any[]) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
@@ -289,7 +288,7 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
} else if (opts.otherPromise) {
return getPromise((resolve, reject) => {
return getPromise((resolve: Function, reject: Function) => {
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
if (result && !result.error) {
result.then(resolve, reject);
@@ -298,14 +297,14 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
} else {
let pluginResult, rej;
const p = getPromise((resolve, reject) => {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
if (pluginResult && pluginResult.error) {
p.catch(() => { });
rej(pluginResult.error);
typeof rej === 'function' && rej(pluginResult.error);
}
return p;

View File

@@ -1,27 +1,28 @@
declare var window: any;
declare const window: any;
/**
* @private
*/
export function get(obj, path) {
path = path.split('.');
for (let i = 0; i < path.length; i++) {
export const get = (element: Element | Window, path: string): any => {
const paths: string[] = path.split('.');
let obj: any = element;
for (let i: number = 0; i < paths.length; i++) {
if (!obj) { return null; }
obj = obj[path[i]];
obj = obj[paths[i]];
}
return obj;
}
};
/**
* @private
*/
export function getPromise(cb) {
export const getPromise = (callback: Function): Promise<any> => {
const tryNativePromise = () => {
if (window.Promise) {
return new Promise((resolve, reject) => {
cb(resolve, reject);
callback(resolve, reject);
});
} else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular 2 or on a recent browser.');
@@ -29,21 +30,21 @@ export function getPromise(cb) {
};
return tryNativePromise();
}
};
/**
* @private
* @param pluginRef
* @returns {null|*}
*/
export function getPlugin(pluginRef: string): any {
export const getPlugin = (pluginRef: string): any => {
return get(window, pluginRef);
};
/**
* @private
*/
export const pluginWarn = function(pluginName: string, plugin?: string, method?: string) {
export const pluginWarn = (pluginName: string, plugin?: string, method?: string): void => {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
} else {
@@ -59,7 +60,7 @@ export const pluginWarn = function(pluginName: string, plugin?: string, method?:
* @param pluginName
* @param method
*/
export const cordovaWarn = function(pluginName: string, method?: string) {
export const cordovaWarn = (pluginName: string, method?: string): void => {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
} else {

View File

@@ -107,12 +107,12 @@ export interface AdExtras {
*
* onClick() {
* let adId;
* if(this.platform.is('android') {
* if(this.platform.is('android')) {
* adId = 'YOUR_ADID_ANDROID';
* } else if (this.platform.is('ios')) {
* adId = 'YOUR_ADID_IOS';
* }
* this.admob.prepareInterstitial(adId)
* this.admob.prepareInterstitial({adId: adId})
* .then(() => { this.admob.showInterstitial(); });
* }
*

View File

@@ -1,6 +1,8 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
export interface AlipayOrder {
/**
* appId assigned by Alipay

View File

@@ -25,7 +25,7 @@ import { Injectable } from '@angular/core';
@Plugin({
pluginName: 'AppMinimize',
plugin: 'https://github.com/tomloprod/cordova-plugin-appminimize.git',
pluginRef: 'cordova.plugins.appMinimize',
pluginRef: 'plugins.appMinimize',
repo: 'https://github.com/tomloprod/cordova-plugin-appminimize',
platforms: ['Android']
})

View File

@@ -1,9 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
export interface AppRatePreferences {
/**

View File

@@ -1,9 +1,6 @@
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window;
export interface BackgroundFetchConfig {
/**

View File

@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
export interface BackgroundGeolocationResponse {
/**

View File

@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
export interface BarcodeScannerOptions {
/**

View File

@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Brightness
* @description

View File

@@ -57,7 +57,7 @@ export interface CameraPreviewPictureOptions {
*
* @usage
* ```typescript
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';
* import { CameraPreview, CameraPreviewPictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';
*
* constructor(private cameraPreview: CameraPreview) { }
*
@@ -93,7 +93,7 @@ export interface CameraPreviewPictureOptions {
*
*
* // picture options
* const pictureOpts: PictureOptions = {
* const pictureOpts: CameraPreviewPictureOptions = {
* width: 1280,
* height: 1280,
* quality: 85

View File

@@ -109,8 +109,8 @@ interface LocalPackage_Static {
}
/* tslint:enable */
declare var RemotePackage: RemotePackage_Static;
declare var LocalPackage: LocalPackage_Static;
declare const RemotePackage: RemotePackage_Static;
declare const LocalPackage: LocalPackage_Static;
/**
* Defines the JSON format of the current package information file.

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var window: any,
declare const window: any,
navigator: any;
export type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
@@ -49,6 +49,7 @@ export interface IContactProperties {
/** An array of web pages associated with the contact. */
urls?: IContactField[];
}
/**
@@ -71,6 +72,8 @@ export class Contact implements IContactProperties {
@InstanceProperty categories: IContactField[];
@InstanceProperty urls: IContactField[];
[key: string]: any;
constructor() {
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
this._objectInstance = navigator.contacts.create();
@@ -92,8 +95,8 @@ export class Contact implements IContactProperties {
@InstanceCheck()
save(): Promise<any> {
return getPromise((resolve, reject) => {
this._objectInstance.save((contact) => {
return getPromise((resolve: Function, reject: Function) => {
this._objectInstance.save((contact: any) => {
this._objectInstance = contact;
resolve(this);
}, reject);
@@ -114,7 +117,7 @@ export interface IContactError {
/**
* @hidden
*/
export declare var ContactError: {
export declare const ContactError: {
new (code: number): IContactError;
UNKNOWN_ERROR: number;
INVALID_ARGUMENT_ERROR: number;
@@ -312,8 +315,8 @@ export class Contacts extends IonicNativePlugin {
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.find(fields, (contacts: any[]) => {
resolve(contacts.map(processContact));
}, reject, options);
});
@@ -325,8 +328,8 @@ export class Contacts extends IonicNativePlugin {
*/
@CordovaCheck()
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);
return getPromise((resolve: Function, reject: Function) => {
navigator.contacts.pickContact((contact: any) => resolve(processContact(contact)), reject);
});
}
@@ -335,7 +338,7 @@ export class Contacts extends IonicNativePlugin {
/**
* @hidden
*/
function processContact(contact) {
function processContact(contact: any) {
let newContact = new Contact();
for (let prop in contact) {
if (typeof contact[prop] === 'function') continue;

View File

@@ -98,7 +98,7 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
route(paths): Observable<DeeplinkMatch> { return; }
route(paths: any): Observable<DeeplinkMatch> { return; }
/**
*
@@ -121,6 +121,6 @@ export class Deeplinks extends IonicNativePlugin {
@Cordova({
observable: true
})
routeWithNavController(navController, paths): Observable<DeeplinkMatch> { return; }
routeWithNavController(navController: any, paths: any): Observable<DeeplinkMatch> { return; }
}

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window: any;
declare const window: any;
/**
* @name Device

View File

@@ -148,7 +148,7 @@ export class Diagnostic extends IonicNativePlugin {
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ successIndex: 1, errorIndex: 2 })
@Cordova({ callbackOrder: 'reverse' })
isCameraAvailable( externalStorage?: boolean ): Promise<any> { return; }
/**
@@ -257,7 +257,7 @@ export class Diagnostic extends IonicNativePlugin {
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
isCameraAuthorized( externalStorage?: boolean ): Promise<any> { return; }
/**
@@ -266,7 +266,7 @@ export class Diagnostic extends IonicNativePlugin {
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
getCameraAuthorizationStatus( externalStorage?: boolean ): Promise<any> { return; }
/**
@@ -275,7 +275,7 @@ export class Diagnostic extends IonicNativePlugin {
* cordova-plugin-camera@2.2+ requires both of these permissions. Defaults to true.
* @returns {Promise<any>}
*/
@Cordova({ platforms: ['Android', 'iOS'], successIndex: 1, errorIndex: 2 })
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
requestCameraAuthorization( externalStorage?: boolean ): Promise<any> { return; }
/**

View File

@@ -75,7 +75,7 @@ export class Dialogs extends IonicNativePlugin {
successIndex: 1,
errorIndex: 4
})
confirm(message, title?: string, buttonLabels?: string[]): Promise<number> { return; }
confirm(message: string, title?: string, buttonLabels?: string[]): Promise<number> { return; }
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.

View File

@@ -42,10 +42,11 @@ export interface DocumentViewerOptions {
* constructor(private document: DocumentViewer) { }
*
* ...
* const options = {
* const options: DocumentViewerOptions = {
* title: 'My PDF'
* }
* this.document.view('assets/myFile.pdf', 'application/pdf', options)
*
* this.document.viewDocument('assets/myFile.pdf', 'application/pdf', options)
*
* ```
*
@@ -82,7 +83,7 @@ export class DocumentViewer extends IonicNativePlugin {
* @param [onError] {Function}
*/
@Cordova({ sync: true })
canViewDocument(url: string, contentType: string, options: Array<DocumentViewerOptions>, onPossible?: Function, onMissingApp?: Function, onImpossible?: Function, onError?: Function): void { }
canViewDocument(url: string, contentType: string, options: DocumentViewerOptions, onPossible?: Function, onMissingApp?: Function, onImpossible?: Function, onError?: Function): void { }
/**
* Opens the file

View File

@@ -1,7 +1,11 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var cordova: any;
interface Cordova {
plugins: CordovaPlugins & { email: any };
}
declare const cordova: Cordova;
export interface EmailComposerOptions {
@@ -88,7 +92,7 @@ export class EmailComposer extends IonicNativePlugin {
isAvailable(app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
if (app) {
cordova.plugins.email.isAvailable(app, (isAvailable) => {
cordova.plugins.email.isAvailable(app, (isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {
@@ -96,7 +100,7 @@ export class EmailComposer extends IonicNativePlugin {
}
});
} else {
cordova.plugins.email.isAvailable((isAvailable) => {
cordova.plugins.email.isAvailable((isAvailable: boolean) => {
if (isAvailable) {
resolve();
} else {

View File

@@ -49,7 +49,7 @@ export interface NotificationData {
* backend.registerToken(token);
* })
*
* fcm.unsubscribeToTopic('marketing');
* fcm.unsubscribeFromTopic('marketing');
*
* ```
* @interfaces
@@ -101,7 +101,7 @@ export class FCM extends IonicNativePlugin {
* @returns {Promise<any>} Returns a promise resolving in result of unsubscribing from a topic
*/
@Cordova()
unsubscribeToTopic(topic: string): Promise<any> { return; }
unsubscribeFromTopic(topic: string): Promise<any> { return; }
/**
* Watch for incoming notifications

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
declare var window: any;
declare const window: any;
/**
* @name File Path

View File

@@ -1,158 +1,398 @@
import { Injectable } from '@angular/core';
import { CordovaProperty, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var window: any;
declare var cordova: any;
/** This interface represents a file system. */
export interface FileSystem {
/* The name of the file system, unique across the list of exposed file systems. */
export interface IFile extends Blob {
/**
* Name of the file, without path information
*/
name: string;
/** The root directory of the file system. */
root: DirectoryEntry;
/**
* Last modified date
*/
lastModified: number;
/**
* Last modified date
*/
lastModifiedDate: number;
/**
* Size in bytes
*/
size: number;
/**
* File mime type
*/
type: string;
localURL: string;
start: number;
end: number;
/**
* Returns a "slice" of the file. Since Cordova Files don't contain the actual
* content, this really returns a File with adjusted start and end.
* Slices of slices are supported.
* @param start {Number} The index at which to start the slice (inclusive).
* @param end {Number} The index at which to end the slice (exclusive).
*/
slice(start: number, end: number): Blob;
}
export interface LocalFileSystem {
/**
* Used for storage with no guarantee of persistence.
*/
TEMPORARY: number;
/**
* Used for storage that should not be removed by the user agent without application or user permission.
*/
PERSISTENT: number;
/**
* Requests a filesystem in which to store application data.
* @param type Whether the filesystem requested should be persistent, as defined above. Use one of TEMPORARY or PERSISTENT.
* @param size This is an indicator of how much storage space, in bytes, the application expects to need.
* @param successCallback The callback that is called when the user agent provides a filesystem.
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the filesystem is denied.
*/
requestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void;
/**
* Allows the user to look up the Entry for a file or directory referred to by a local URL.
* @param url A URL referring to a local file in a filesystem accessable via this API.
* @param successCallback A callback that is called to report the Entry to which the supplied URL refers.
* @param errorCallback A callback that is called when errors happen, or when the request to obtain the Entry is denied.
*/
resolveLocalFileSystemURL(url: string, successCallback: EntryCallback, errorCallback?: ErrorCallback): void;
/**
* see requestFileSystem.
*/
webkitRequestFileSystem(type: number, size: number, successCallback: FileSystemCallback, errorCallback?: ErrorCallback): void;
}
export interface Metadata {
/**
* This is the time at which the file or directory was last modified.
* @readonly
*/
modificationTime: Date;
/**
* The size of the file, in bytes. This must return 0 for directories.
* @readonly
*/
size: number;
}
export interface Flags {
/**
* Used to indicate that the user wants to create a file or directory if it was not previously there.
*/
create?: boolean;
/**
* By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists.
*/
exclusive?: boolean;
}
/**
* An abstract interface representing entries in a file system,
* each of which may be a File or DirectoryEntry.
* This export interface represents a file system.
*/
export interface Entry {
/** Entry is a file. */
isFile: boolean;
/** Entry is a directory. */
isDirectory: boolean;
/** The name of the entry, excluding the path leading to it. */
export interface FileSystem {
/**
* This is the name of the file system. The specifics of naming filesystems is unspecified, but a name must be unique across the list of exposed file systems.
* @readonly
*/
name: string;
/** The full absolute path from the root to the entry. */
fullPath: string;
/** The file system on which the entry resides. */
filesystem: FileSystem;
nativeURL: string;
/**
* The root directory of the file system.
* @readonly
*/
root: DirectoryEntry;
toJSON(): string;
encodeURIPath(path: string): string;
}
export interface Entry {
/**
* Entry is a file.
*/
isFile: boolean;
/**
* Entry is a directory.
*/
isDirectory: boolean;
/**
* Look up metadata about this entry.
* @param successCallback A callback that is called with the time of the last modification.
* @param errorCallback A callback that is called when errors happen.
* @param errorCallback ErrorCallback A callback that is called when errors happen.
*/
getMetadata(successCallback: (metadata: Metadata) => void,
errorCallback?: (error: FileError) => void): void;
getMetadata(successCallback: MetadataCallback, errorCallback?: ErrorCallback): void;
/**
* Set the metadata of the entry.
* @param successCallback {Function} is called with a Metadata object
* @param errorCallback {Function} is called with a FileError
* @param metadataObject {Metadata} keys and values to set
*/
setMetadata(successCallback: MetadataCallback, errorCallback: ErrorCallback, metadataObject: Metadata): void;
/**
* The name of the entry, excluding the path leading to it.
*/
name: string;
/**
* The full absolute path from the root to the entry.
*/
fullPath: string;
/**
* The file system on which the entry resides.
*/
filesystem: FileSystem;
/**
* an alternate URL which can be used by native webview controls, for example media players.
*/
nativeURL: string;
/**
* Move an entry to a different location on the file system. It is an error to try to:
* move a directory inside itself or to any child at any depth;move an entry into its parent if a name different from its current one isn't provided;
* move a file to a path occupied by a directory;
* move a directory to a path occupied by a file;
* move any element to a path occupied by a directory which is not empty.
*
* <ui>
* <li>move a directory inside itself or to any child at any depth;</li>
* <li>move an entry into its parent if a name different from its current one isn't provided;</li>
* <li>move a file to a path occupied by a directory;</li>
* <li>move a directory to a path occupied by a file;</li>
* <li>move any element to a path occupied by a directory which is not empty.</li>
* <ul>
*
* A move of a file on top of an existing file must attempt to delete and replace that file.
* A move of a directory on top of an existing empty directory must attempt to delete and replace that directory.
* @param parent The directory to which to move the entry.
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
* @param successCallback A callback that is called with the Entry for the new location.
* @param errorCallback A callback that is called when errors happen.
*/
moveTo(parent: DirectoryEntry,
newName?: string,
successCallback?: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
moveTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void;
/**
* Copy an entry to a different location on the file system. It is an error to try to:
* copy a directory inside itself or to any child at any depth;
* copy an entry into its parent if a name different from its current one isn't provided;
* copy a file to a path occupied by a directory;
* copy a directory to a path occupied by a file;
* copy any element to a path occupied by a directory which is not empty.
* A copy of a file on top of an existing file must attempt to delete and replace that file.
* A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.
*
* <ul>
* <li> copy a directory inside itself or to any child at any depth;</li>
* <li> copy an entry into its parent if a name different from its current one isn't provided;</li>
* <li> copy a file to a path occupied by a directory;</li>
* <li> copy a directory to a path occupied by a file;</li>
* <li> copy any element to a path occupied by a directory which is not empty.</li>
* <li> A copy of a file on top of an existing file must attempt to delete and replace that file.</li>
* <li> A copy of a directory on top of an existing empty directory must attempt to delete and replace that directory.</li>
* </ul>
*
* Directory copies are always recursive--that is, they copy all contents of the directory.
* @param parent The directory to which to move the entry.
* @param newName The new name of the entry. Defaults to the Entry's current name if unspecified.
* @param successCallback A callback that is called with the Entry for the new object.
* @param errorCallback A callback that is called when errors happen.
*/
copyTo(parent: DirectoryEntry,
newName?: string,
successCallback?: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
copyTo(parent: DirectoryEntry, newName?: string, successCallback?: EntryCallback, errorCallback?: ErrorCallback): void;
/**
* Returns a URL that can be used as the src attribute of a <video> or <audio> tag.
* If that is not possible, construct a cdvfile:// URL.
* @return string URL
* Returns a URL that can be used to identify this entry. Unlike the URN defined in [FILE-API-ED], it has no specific expiration; as it describes a location on disk, it should be valid at least as long as that location exists.
*/
toURL(): string;
/**
* Return a URL that can be passed across the bridge to identify this entry.
* @return string URL that can be passed across the bridge to identify this entry
*/
toInternalURL(): string;
/**
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem.
* @param successCallback A callback that is called on success.
* @param errorCallback A callback that is called when errors happen.
* @param errorCallback A callback that is called when errors happen.
*/
remove(successCallback: () => void,
errorCallback?: (error: FileError) => void): void;
remove(successCallback: VoidCallback, errorCallback?: ErrorCallback): void;
/**
* Look up the parent DirectoryEntry containing this Entry. If this Entry is the root of its filesystem, its parent is itself.
* @param successCallback A callback that is called with the time of the last modification.
* @param errorCallback A callback that is called when errors happen.
* @param successCallback A callback that is called to return the parent Entry.
* @param errorCallback A callback that is called when errors happen.
*/
getParent(successCallback: (entry: Entry) => void,
errorCallback?: (error: FileError) => void): void;
getParent(successCallback: DirectoryEntryCallback, errorCallback?: ErrorCallback): void;
}
/** This interface supplies information about the state of a file or directory. */
export interface Metadata {
/** This is the time at which the file or directory was last modified. */
modificationTime: Date;
/** The size of the file, in bytes. This must return 0 for directories. */
size: number;
}
/** This interface represents a directory on a file system. */
/**
* This export interface represents a directory on a file system.
*/
export interface DirectoryEntry extends Entry {
/**
* Creates a new DirectoryReader to read Entries from this Directory.
*/
createReader(): DirectoryReader;
/**
* Creates or looks up a file.
* @param path Either an absolute path or a relative path from this DirectoryEntry
* to the file to be looked up or created.
* It is an error to attempt to create a file whose immediate parent does not yet exist.
* @param options If create and exclusive are both true, and the path already exists, getFile must fail.
* If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.
* If create is not true and the path doesn't exist, getFile must fail.
* If create is not true and the path exists, but is a directory, getFile must fail.
* Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.
* @param path Either an absolute path or a relative path from this DirectoryEntry to the file to be looked up or created. It is an error to attempt to create a file whose immediate parent does not yet exist.
* @param options
* <ul>
* <li>If create and exclusive are both true, and the path already exists, getFile must fail.</li>
* <li>If create is true, the path doesn't exist, and no other error occurs, getFile must create it as a zero-length file and return a corresponding FileEntry.</li>
* <li>If create is not true and the path doesn't exist, getFile must fail.</li>
* <li>If create is not true and the path exists, but is a directory, getFile must fail.</li>
* <li>Otherwise, if no other error occurs, getFile must return a FileEntry corresponding to path.</li>
* </ul>
* @param successCallback A callback that is called to return the File selected or created.
* @param errorCallback A callback that is called when errors happen.
* @param errorCallback A callback that is called when errors happen.
*/
getFile(path: string, options?: Flags,
successCallback?: (entry: FileEntry) => void,
errorCallback?: (error: FileError) => void): void;
getFile(path: string, options?: Flags, successCallback?: FileEntryCallback, errorCallback?: ErrorCallback): void;
/**
* Creates or looks up a directory.
* @param path Either an absolute path or a relative path from this DirectoryEntry
* to the directory to be looked up or created.
* It is an error to attempt to create a directory whose immediate parent does not yet exist.
* @param options If create and exclusive are both true and the path already exists, getDirectory must fail.
* If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.
* If create is not true and the path doesn't exist, getDirectory must fail.
* If create is not true and the path exists, but is a file, getDirectory must fail.
* Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.
* @param successCallback A callback that is called to return the Directory selected or created.
* @param errorCallback A callback that is called when errors happen.
* @param path Either an absolute path or a relative path from this DirectoryEntry to the directory to be looked up or created. It is an error to attempt to create a directory whose immediate parent does not yet exist.
* @param options
* <ul>
* <li>If create and exclusive are both true and the path already exists, getDirectory must fail.</li>
* <li>If create is true, the path doesn't exist, and no other error occurs, getDirectory must create and return a corresponding DirectoryEntry.</li>
* <li>If create is not true and the path doesn't exist, getDirectory must fail.</li>
* <li>If create is not true and the path exists, but is a file, getDirectory must fail.</li>
* <li>Otherwise, if no other error occurs, getDirectory must return a DirectoryEntry corresponding to path.</li>
* </ul>
* @param successCallback A callback that is called to return the DirectoryEntry selected or created.
* @param errorCallback A callback that is called when errors happen.
*
*/
getDirectory(path: string, options?: Flags,
successCallback?: (entry: DirectoryEntry) => void,
errorCallback?: (error: FileError) => void): void;
getDirectory(path: string, options?: Flags, successCallback?: DirectoryEntryCallback, errorCallback?: ErrorCallback): void;
/**
* Deletes a directory and all of its contents, if any. In the event of an error (e.g. trying
* to delete a directory that contains a file that cannot be removed), some of the contents
* of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
* Deletes a directory and all of its contents, if any. In the event of an error [e.g. trying to delete a directory that contains a file that cannot be removed], some of the contents of the directory may be deleted. It is an error to attempt to delete the root directory of a filesystem.
* @param successCallback A callback that is called on success.
* @param errorCallback A callback that is called when errors happen.
* @param errorCallback A callback that is called when errors happen.
*/
removeRecursively(successCallback: () => void,
errorCallback?: (error: FileError) => void): void;
removeRecursively(successCallback: VoidCallback, errorCallback?: ErrorCallback): void;
}
/**
* This export interface lets a user list files and directories in a directory. If there are no additions to or deletions from a directory between the first and last call to readEntries, and no errors occur, then:
* <ul>
* <li> A series of calls to readEntries must return each entry in the directory exactly once.</li>
* <li> Once all entries have been returned, the next call to readEntries must produce an empty array.</li>
* <li> If not all entries have been returned, the array produced by readEntries must not be empty.</li>
* <li> The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].</li>
* </ul>
*/
export interface DirectoryReader {
localURL: string;
hasReadEntries: boolean;
/**
* Read the next block of entries from this directory.
* @param successCallback Called once per successful call to readEntries to deliver the next previously-unreported set of Entries in the associated Directory. If all Entries have already been returned from previous invocations of readEntries, successCallback must be called with a zero-length array as an argument.
* @param errorCallback A callback indicating that there was an error reading from the Directory.
*/
readEntries(successCallback: EntriesCallback, errorCallback?: ErrorCallback): void;
}
/**
* This export interface represents a file on a file system.
*/
export interface FileEntry extends Entry {
/**
* Creates a new FileWriter associated with the file that this FileEntry represents.
* @param successCallback A callback that is called with the new FileWriter.
* @param errorCallback A callback that is called when errors happen.
*/
createWriter(successCallback: FileWriterCallback, errorCallback?: ErrorCallback): void;
/**
* Returns a File that represents the current state of the file that this FileEntry represents.
* @param successCallback A callback that is called with the File.
* @param errorCallback A callback that is called when errors happen.
*/
file(successCallback: FileCallback, errorCallback?: ErrorCallback): void;
}
/**
* When requestFileSystem() succeeds, the following callback is made.
*/
export interface FileSystemCallback {
/**
* @param filesystem The file systems to which the app is granted access.
*/
(filesystem: FileSystem): void;
}
/**
* This export interface is the callback used to look up Entry objects.
*/
export interface EntryCallback {
/**
* @param entry
*/
(entry: Entry): void;
}
/**
* This export interface is the callback used to look up FileEntry objects.
*/
export interface FileEntryCallback {
/**
* @param entry
*/
(entry: FileEntry): void;
}
/**
* This export interface is the callback used to look up DirectoryEntry objects.
*/
export interface DirectoryEntryCallback {
/**
* @param entry
*/
(entry: DirectoryEntry): void;
}
/**
* When readEntries() succeeds, the following callback is made.
*/
export interface EntriesCallback {
(entries: Entry[]): void;
}
/**
* This export interface is the callback used to look up file and directory metadata.
*/
export interface MetadataCallback {
(metadata: Metadata): void;
}
/**
* This export interface is the callback used to create a FileWriter.
*/
export interface FileWriterCallback {
(fileWriter: FileWriter): void;
}
/**
* This export interface is the callback used to obtain a File.
*/
export interface FileCallback {
(file: IFile): void;
}
/**
* This export interface is the generic callback used to indicate success of an asynchronous method.
*/
export interface VoidCallback {
(): void;
}
/**
* When an error occurs, the following callback is made.
*/
export interface ErrorCallback {
(err: FileError): void;
}
export interface RemoveResult {
@@ -160,136 +400,159 @@ export interface RemoveResult {
fileRemoved: Entry;
}
/**
* This dictionary is used to supply arguments to methods
* that look up or create files or directories.
*/
export interface Flags {
/** Used to indicate that the user wants to create a file or directory if it was not previously there. */
create?: boolean;
/** By itself, exclusive must have no effect. Used with create, it must cause getFile and getDirectory to fail if the target path already exists. */
exclusive?: boolean;
}
export interface WriteOptions {
replace?: boolean;
append?: boolean;
truncate?: number; // if present, number of bytes to truncate file to before writing
}
/**
* This interface lets a user list files and directories in a directory. If there are
* no additions to or deletions from a directory between the first and last call to
* readEntries, and no errors occur, then:
* A series of calls to readEntries must return each entry in the directory exactly once.
* Once all entries have been returned, the next call to readEntries must produce an empty array.
* If not all entries have been returned, the array produced by readEntries must not be empty.
* The entries produced by readEntries must not include the directory itself ["."] or its parent [".."].
*/
export interface DirectoryReader {
export declare class FileSaver extends EventTarget {
/**
* Read the next block of entries from this directory.
* @param successCallback Called once per successful call to readEntries to deliver the next
* previously-unreported set of Entries in the associated Directory.
* If all Entries have already been returned from previous invocations
* of readEntries, successCallback must be called with a zero-length array as an argument.
* @param errorCallback A callback indicating that there was an error reading from the Directory.
* When the FileSaver constructor is called, the user agent must return a new FileSaver object with readyState set to INIT.
* This constructor must be visible when the script's global object is either a Window object or an object implementing the WorkerUtils interface.
*/
readEntries(successCallback: (entries: Entry[]) => void,
errorCallback?: (error: FileError) => void): void;
}
constructor(data: Blob);
/** This interface represents a file on a file system. */
export interface FileEntry extends Entry {
/**
* Creates a new FileWriter associated with the file that this FileEntry represents.
* @param successCallback A callback that is called with the new FileWriter.
* @param errorCallback A callback that is called when errors happen.
* When the abort method is called, user agents must run the steps below:
* <ol>
* <li> If readyState == DONE or readyState == INIT, terminate this overall series of steps without doing anything else. </li>
* <li> Set readyState to DONE. </li>
* <li> If there are any tasks from the object's FileSaver task source in one of the task queues, then remove those tasks. </li>
* <li> Terminate the write algorithm being processed. </li>
* <li> Set the error attribute to a DOMError object of type "AbortError". </li>
* <li> Fire a progress event called abort </li>
* <li> Fire a progress event called writeend </li>
* <li> Terminate this algorithm. </li>
* </ol>
*/
createWriter(successCallback: (writer: FileWriter) => void,
errorCallback?: (error: FileError) => void): void;
/**
* Returns a File that represents the current state of the file that this FileEntry represents.
* @param successCallback A callback that is called with the File.
* @param errorCallback A callback that is called when errors happen.
*/
file(successCallback: (file: File) => void,
errorCallback?: (error: FileError) => void): void;
}
/**
* This interface provides methods to monitor the asynchronous writing of blobs
* to disk using progress events and event handler attributes.
*/
export interface FileSaver extends EventTarget {
/** Terminate file operation */
abort(): void;
/**
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting,
* must return the current state, which must be one of the following values:
* INIT
* WRITING
* DONE
* The blob is being written.
* @readonly
*/
INIT: number;
/**
* The object has been constructed, but there is no pending write.
* @readonly
*/
WRITING: number;
/**
* The entire Blob has been written to the file, an error occurred during the write, or the write was aborted using abort(). The FileSaver is no longer writing the blob.
* @readonly
*/
DONE: number;
/**
* The FileSaver object can be in one of 3 states. The readyState attribute, on getting, must return the current state, which must be one of the following values:
* <ul>
* <li>INIT</li>
* <li>WRITING</li>
* <li>DONE</li>
* <ul>
* @readonly
*/
readyState: number;
/** Handler for writestart events. */
onwritestart: (event: ProgressEvent) => void;
/** Handler for progress events. */
onprogress: (event: ProgressEvent) => void;
/** Handler for write events. */
onwrite: (event: ProgressEvent) => void;
/** Handler for abort events. */
onabort: (event: ProgressEvent) => void;
/** Handler for error events. */
onerror: (event: ProgressEvent) => void;
/** Handler for writeend events. */
onwriteend: (event: ProgressEvent) => void;
/** The last error that occurred on the FileSaver. */
/**
* The last error that occurred on the FileSaver.
* @readonly
*/
error: Error;
/**
* Handler for writestart events
*/
onwritestart: (event: ProgressEvent) => void;
/**
* Handler for progress events.
*/
onprogress: (event: ProgressEvent) => void;
/**
* Handler for write events.
*/
onwrite: (event: ProgressEvent) => void;
/**
* Handler for abort events.
*/
onabort: (event: ProgressEvent) => void;
/**
* Handler for error events.
*/
onerror: (event: ProgressEvent) => void;
/**
* Handler for writeend events.
*/
onwriteend: (event: ProgressEvent) => void;
}
/**
* This interface expands on the FileSaver interface to allow for multiple write
* actions, rather than just saving a single Blob.
* This interface expands on the FileSaver interface to allow for multiple write actions, rather than just saving a single Blob.
*/
export interface FileWriter extends FileSaver {
export declare class FileWriter extends FileSaver {
/**
* The byte offset at which the next write to the file will occur. This always less or equal than length.
* A newly-created FileWriter will have position set to 0.
* The byte offset at which the next write to the file will occur. This must be no greater than length.
* A newly-created FileWriter must have position set to 0.
*/
position: number;
/**
* The length of the file. If the user does not have read access to the file,
* this will be the highest byte offset at which the user has written.
* The length of the file. If the user does not have read access to the file, this must be the highest byte offset at which the user has written.
*/
length: number;
/**
* Write the supplied data to the file at position.
* @param {Blob} data The blob to write.
* @param data The blob to write.
*/
write(data: ArrayBuffer | Blob | string): void;
/**
* The file position at which the next write will occur.
* @param offset If nonnegative, an absolute byte offset into the file.
* If negative, an offset back from the end of the file.
* Seek sets the file position at which the next write will occur.
* @param offset If nonnegative, an absolute byte offset into the file. If negative, an offset back from the end of the file.
*/
seek(offset: number): void;
/**
* Changes the length of the file to that specified. If shortening the file, data beyond the new length
* will be discarded. If extending the file, the existing data will be zero-padded up to the new length.
* Changes the length of the file to that specified. If shortening the file, data beyond the new length must be discarded. If extending the file, the existing data must be zero-padded up to the new length.
* @param size The size to which the length of the file is to be adjusted, measured in bytes.
*/
truncate(size: number): void;
}
/* FileWriter states */
export declare var FileWriter: {
INIT: number;
WRITING: number;
DONE: number
};
export interface IWriteOptions {
replace?: boolean;
append?: boolean;
truncate?: number; // if present, number of bytes to truncate file to before writing
}
export declare class FileError {
constructor(code: number);
static NOT_FOUND_ERR: number;
static SECURITY_ERR: number;
static ABORT_ERR: number;
static NOT_READABLE_ERR: number;
static ENCODING_ERR: number;
static NO_MODIFICATION_ALLOWED_ERR: number;
static INVALID_STATE_ERR: number;
static SYNTAX_ERR: number;
static INVALID_MODIFICATION_ERR: number;
static QUOTA_EXCEEDED_ERR: number;
static TYPE_MISMATCH_ERR: number;
static PATH_EXISTS_ERR: number;
/** Error code */
code: number;
message: string;
}
export declare class FileReader {
static EMPTY: number;
static LOADING: number;
static DONE: number;
static READ_CHUNK_SIZE: number;
export interface FileReader {
readyState: number; // see constants in var declaration below
error: Error;
result: string | ArrayBuffer; // type depends on readAsXXX() call type
@@ -302,42 +565,21 @@ export interface FileReader {
onabort: (evt: ProgressEvent) => void;
abort(): void;
readAsText(fe: File | Blob, encoding?: string): void;
readAsDataURL(fe: File | Blob): void;
readAsBinaryString(fe: File | Blob): void;
readAsArrayBuffer(fe: File | Blob): void;
readAsText(fe: IFile, encoding?: string): void;
readAsDataURL(fe: IFile): void;
readAsBinaryString(fe: IFile): void;
readAsArrayBuffer(fe: IFile): void;
/**
* @hidden
*/
[key: string]: any;
}
export declare var FileReader: {
EMPTY: number;
LOADING: number;
DONE: number;
new (): FileReader;
};
export interface FileError {
/** Error code */
code: number;
message: string;
}
export declare var FileError: {
new (code: number): FileError;
NOT_FOUND_ERR: number;
SECURITY_ERR: number;
ABORT_ERR: number;
NOT_READABLE_ERR: number;
ENCODING_ERR: number;
NO_MODIFICATION_ALLOWED_ERR: number;
INVALID_STATE_ERR: number;
SYNTAX_ERR: number;
INVALID_MODIFICATION_ERR: number;
QUOTA_EXCEEDED_ERR: number;
TYPE_MISMATCH_ERR: number;
PATH_EXISTS_ERR: number;
};
interface Window extends LocalFileSystem {}
declare const window: Window;
/**
* @name File
@@ -358,10 +600,16 @@ export declare var FileError: {
*
* ```
*
* This plugin is based on several specs, including : The HTML5 File API http://www.w3.org/TR/FileAPI/
* The (now-defunct) Directories and System extensions Latest: http://www.w3.org/TR/2012/WD-file-system-api-20120417/
* Although most of the plugin code was written when an earlier spec was current: http://www.w3.org/TR/2011/WD-file-system-api-20110419/
* It also implements the FileWriter spec : http://dev.w3.org/2009/dap/file-system/file-writer.html
* This plugin is based on several specs, including : The HTML5 File API http: //www.w3.org/TR/FileAPI/
* The (now-defunct) Directories and System extensions Latest: http: //www.w3.org/TR/2012/WD-file-system-api-20120417/
* Although most of the plugin code was written when an earlier spec was current: http: //www.w3.org/TR/2011/WD-file-system-api-20110419/
* It also implements the FileWriter spec : http: //dev.w3.org/2009/dap/file-system/file-writer.html
* @interfaces
* IFile
* Entry
* DirectoryEntry
* DirectoryReader
* FileSystem
*/
@Plugin({
pluginName: 'File',
@@ -446,7 +694,7 @@ export class File extends IonicNativePlugin {
@CordovaProperty
sharedDirectory: string;
cordovaFileError: {} = {
cordovaFileError: any = {
1: 'NOT_FOUND_ERR',
2: 'SECURITY_ERR',
3: 'ABORT_ERR',
@@ -749,12 +997,12 @@ export class File extends IonicNativePlugin {
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName path relative to base path
* @param {string | Blob} text content or blob to write
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
* @returns {Promise<any>} Returns a Promise that resolves to updated file entry or rejects with an error.
*/
@CordovaCheck()
writeFile(path: string, fileName: string,
text: string | Blob | ArrayBuffer, options: WriteOptions = {}): Promise<any> {
text: string | Blob | ArrayBuffer, options: IWriteOptions = {}): Promise<any> {
if ((/^\//.test(fileName))) {
const err = new FileError(5);
err.message = 'file-name cannot start with \/';
@@ -780,10 +1028,10 @@ export class File extends IonicNativePlugin {
* @hidden
* @param {FileEntry} fe file entry object
* @param {string | Blob} text content or blob to write
* @param {WriteOptions} options replace file if set to true. See WriteOptions for more information.
* @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information.
* @returns {Promise<FileEntry>} Returns a Promise that resolves to updated file entry or rejects with an error.
*/
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: WriteOptions) {
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions) {
return this.createWriter(fe)
.then((writer) => {
if (options.append) {
@@ -827,7 +1075,7 @@ export class File extends IonicNativePlugin {
/**
* Read file and return data as a base64 encoded data url.
* A data url is of the form:
* data:[<mediatype>][;base64],<data>
* data: [<mediatype>][;base64],<data>
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} file Name of file, relative to path.
@@ -872,7 +1120,7 @@ export class File extends IonicNativePlugin {
return this.getFile(directoryEntry, file, { create: false });
})
.then((fileEntry: FileEntry) => {
let reader = new FileReader();
const reader = new FileReader();
return new Promise<T>((resolve, reject) => {
reader.onloadend = () => {
if (reader.result !== undefined || reader.result !== null) {
@@ -885,7 +1133,7 @@ export class File extends IonicNativePlugin {
};
fileEntry.file(file => {
reader[`readAs${readAs}`].call(null, file);
reader[`readAs${readAs}`].call(reader, file);
}, error => {
reject(error);
});
@@ -974,7 +1222,7 @@ export class File extends IonicNativePlugin {
resolveLocalFilesystemUrl(fileUrl: string): Promise<Entry> {
return new Promise<Entry>((resolve, reject) => {
try {
window.resolveLocalFileSystemURL(fileUrl, (entry) => {
window.resolveLocalFileSystemURL(fileUrl, (entry: Entry) => {
resolve(entry);
}, (err) => {
this.fillErrorMessage(err);
@@ -999,7 +1247,7 @@ export class File extends IonicNativePlugin {
if (de.isDirectory) {
return <DirectoryEntry>de;
} else {
let err = new FileError(13);
const err = new FileError(13);
err.message = 'input is not a directory';
return Promise.reject<DirectoryEntry>(err);
}

View File

@@ -3,6 +3,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
/**
* @beta
* @name Firebase
* @description
* This plugin brings push notifications, analytics, event tracking, crash reporting and more from Google Firebase to your Cordova project! Android and iOS supported (including iOS 10).

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaFunctionOverride, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window: any;
declare const window: any;
/**
* @name Geofence

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
declare const navigator: any;
export interface Coordinates {
@@ -174,7 +174,7 @@ export class Geolocation extends IonicNativePlugin {
* Observable changes.
*
* ```typescript
* var subscription = Geolocation.watchPosition()
* const subscription = this.geolocation.watchPosition()
* .filter((p) => p.coords !== undefined) //Filter Out Errors
* .subscribe(position => {
* console.log(position.coords.longitude + ' ' + position.coords.latitude);

View File

@@ -1,8 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/**
* @name Google Analytics
* @description

View File

@@ -3,7 +3,7 @@ import { Cordova, CordovaInstance, CordovaCheck, Plugin, InstanceProperty, Insta
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var plugin: any;
declare const plugin: any;
/**
* @hidden
@@ -455,7 +455,7 @@ export class GoogleMap {
pluginRef: 'plugin.google.maps.Map',
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
install: 'ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'],
platforms: ['Android', 'iOS']
})
@@ -1473,7 +1473,7 @@ export class GroundOverlay {
return Promise.reject({ error: 'plugin_not_installed' });
}
return new Promise<any>(
resolve => this._objectInstance.addListenerOnce(eventName, resolve)
(resolve: Function) => this._objectInstance.addListenerOnce(eventName, resolve)
);
}
@@ -1766,7 +1766,7 @@ export class Geocoder {
*/
@CordovaCheck()
geocode(request: GeocoderRequest): Promise<GeocoderResult[] | any> {
return new Promise<GeocoderResult[]>(resolve => {
return new Promise<GeocoderResult[]>((resolve: Function) => {
plugin.google.maps.Geocoder.geocode(request, resolve);
});
}

View File

@@ -2,7 +2,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import { Injectable } from '@angular/core';
declare var navigator: any;
declare const navigator: any;
/**
* @hidden

View File

@@ -4,7 +4,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name Header Color
* @description
* Cordova plugin to change color of header in multitask view
* Cordova plugin to change color of header in Android Multitask View
*
* @usage
* ```typescript

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
declare const cordova: any;
export interface Beacon {
/**

View File

@@ -4,7 +4,7 @@ import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
export interface ImagePickerOptions {
/**
* max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it.
* max images to be selected, defaults to 15. If this is set to 1, upon selection of a single image, the plugin will return it. (Android only)
*/
maximumImagesCount?: number;

View File

@@ -3,7 +3,7 @@ import { Plugin, CordovaInstance, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
declare var cordova: any;
declare const cordova: Cordova & { InAppBrowser: any; };
export interface InAppBrowserOptions {
/** Set to yes or no to turn the InAppBrowser's location bar on or off. */
@@ -48,6 +48,11 @@ export interface InAppBrowserOptions {
/** (Windows only) Set to yes to create the browser control without a border around it.
* Please note that if location=no is also specified, there will be no control presented to user to close IAB window. */
fullscreen?: 'yes';
/**
* @hidden
*/
[key: string]: any;
}
export interface InAppBrowserEvent extends Event {
/** the eventname, either loadstart, loadstop, loaderror, or exit. */
@@ -80,12 +85,18 @@ export class InAppBrowserObject {
*/
constructor(url: string, target?: string, options?: string | InAppBrowserOptions) {
try {
if (options && typeof options !== 'string')
options = Object.keys(options).map(key => `${key}=${options[key]}`).join(',');
if (options && typeof options !== 'string') {
options = Object.keys(options).map((key: string) => `${key}=${(<InAppBrowserOptions>options)[key]}`).join(',');
}
this._objectInstance = cordova.InAppBrowser.open(url, target, options);
} catch (e) {
window.open(url);
window.open(url, target);
console.warn('Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.');
}
}

View File

@@ -1,7 +1,7 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
declare var window: any;
declare const window: any;
export interface IntelSecurityDataOptions {
/** Non-empty string. **/

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Plugin, Cordova, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var cordova: any;
declare const cordova: any;
/**
* @name Jins Meme

View File

@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var navigator: any;
declare const navigator: any;
export interface MediaFile {
/**
@@ -33,7 +33,7 @@ export interface MediaFile {
* @param {Function} successCallback
* @param {Function} errorCallback
*/
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any);
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): void;
}
export interface MediaFileData {

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core';
declare var Media: any;
declare const Media: any;
/**
@@ -169,7 +169,7 @@ export type MediaErrorCallback = (error: MediaError) => void;
* window.setTimeout(() => file.stopRecord(), 10000);
* });
* ```
*
*
* You can find the reasons here: https://github.com/driftyco/ionic-native/issues/1452#issuecomment-299605906
*
* @usage

View File

@@ -86,6 +86,14 @@ export class Mixpanel extends IonicNativePlugin {
@Cordova()
reset(): Promise<any> { return; }
/**
*
* @param eventName {string}
* @returns {Promise<any>}
*/
@Cordova()
timeEvent(eventName: string): Promise<any> { return; }
/**
*
* @param eventName {string}

View File

@@ -1,5 +1,6 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name PayPal
* @description
@@ -383,6 +384,11 @@ export interface PayPalConfigurationOptions {
* PIN to use for sandbox if 'forceDefaultsInSandbox' is set.
*/
sandboxUserPin?: string;
/**
* @hidden
*/
[key: string]: any;
}
/**
* @hidden
@@ -413,7 +419,7 @@ export class PayPalConfiguration implements PayPalConfigurationOptions {
};
if (options && typeof options === 'object') {
for (var i in options) {
for (let i in options) {
if (defaults.hasOwnProperty(i)) {
defaults[i] = options[i];
}

View File

@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
/**
* @name Screen Orientation
* @description

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
import { Plugin, IonicNativePlugin } from '@ionic-native/core';
declare const navigator: any;
declare var navigator: any;
/**
* @name Screenshot
* @description Captures a screen shot
@@ -44,7 +44,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.save(
(error, result) => {
(error: any, result: any) => {
if (error) {
reject(error);
} else {
@@ -70,7 +70,7 @@ export class Screenshot extends IonicNativePlugin {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.URI(
(error, result) => {
(error: any, result: any) => {
if (error) {
reject(error);
} else {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaInstance, Plugin, CordovaCheck, InstanceProperty, IonicNativePlugin } from '@ionic-native/core';
declare var sqlitePlugin;
declare const sqlitePlugin: any;
export interface SQLiteDatabaseConfig {
/**
@@ -19,6 +18,21 @@ export interface SQLiteDatabaseConfig {
iosDatabaseLocation?: string;
}
/**
* @hidden
*/
export interface SQLiteTransaction {
start: () => void;
executeSql: (sql: any, values: any, success: Function, error: Function) => void;
addStatement: (sql: any, values: any, success: Function, error: Function) => void;
handleStatementSuccess: (handler: Function, response: any) => void;
handleStatementFailure: (handler: Function, response: any) => void;
run: () => void;
abort: (txFailure: any) => void;
finish: () => void;
abortFromQ: (sqlerror: any) => void;
}
/**
* @hidden
*/
@@ -26,12 +40,14 @@ export class SQLiteObject {
constructor(public _objectInstance: any) { }
@InstanceProperty databaseFeatures: any;
@InstanceProperty databaseFeatures: { isSQLitePluginDatabase: boolean };
@InstanceProperty openDBs: any;
@CordovaInstance({
sync: true
})
addTransaction(transaction: any): void { }
addTransaction(transaction: (tx: SQLiteTransaction) => void): void { }
/**
* @param fn {any}
@@ -44,11 +60,11 @@ export class SQLiteObject {
transaction(fn: any): Promise<any> { return; }
/**
* @param fn {any}
* @param fn {Function}
* @returns {Promise<any>}
*/
@CordovaInstance()
readTransaction(fn: any): Promise<any> { return; }
readTransaction(fn: (tx: SQLiteTransaction) => void): Promise<any> { return; }
@CordovaInstance({
sync: true
@@ -59,12 +75,13 @@ export class SQLiteObject {
* @returns {Promise<any>}
*/
@CordovaInstance()
close(): Promise<any> { return; }
open(): Promise<any> { return; }
@CordovaInstance({
sync: true
})
start(): void { }
/**
* @returns {Promise<any>}
*/
@CordovaInstance()
close(): Promise<any> { return; }
/**
* Execute SQL on the opened database. Note, you must call `create` first, and
@@ -74,71 +91,17 @@ export class SQLiteObject {
executeSql(statement: string, params: any): Promise<any> { return; }
/**
* @param sql
* @param values
* @param sqlStatements {Array<string | string[]>}
* @returns {Promise<any>}
*/
@CordovaInstance()
addStatement(sql, values): Promise<any> { return; }
/**
* @param sqlStatements {any}
* @returns {Promise<any>}
*/
@CordovaInstance()
sqlBatch(sqlStatements: any): Promise<any> { return; }
sqlBatch(sqlStatements: Array<string | string[]>): Promise<any> { return; }
@CordovaInstance({
sync: true
})
abortallPendingTransactions(): void { }
/**
@param handler
@param response
*/
@CordovaInstance({
sync: true
})
handleStatementSuccess(handler, response): void { }
/**
* @param handler
* @param response
*/
@CordovaInstance({
sync: true
})
handleStatementFailure(handler, response): void { }
@CordovaInstance({
sync: true
})
run(): void { }
/**
* @param txFailure
*/
@CordovaInstance({
sync: true
})
abort(txFailure): void { }
@CordovaInstance({
sync: true
})
finish(): void { }
/**
* @param sqlerror
*/
@CordovaInstance({
sync: true
})
abortFromQ(sqlerror): void { }
}
/**
@@ -177,6 +140,7 @@ export class SQLiteObject {
* SQLiteObject
* @interfaces
* SQLiteDatabaseConfig
* SQLiteTransaction
*/
@Plugin({
pluginName: 'SQLite',
@@ -198,7 +162,7 @@ export class SQLite extends IonicNativePlugin {
@CordovaCheck()
create(config: SQLiteDatabaseConfig): Promise<SQLiteObject> {
return new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, db => resolve(new SQLiteObject(db)), reject);
sqlitePlugin.openDatabase(config, (db: any) => resolve(new SQLiteObject(db)), reject);
});
}

View File

@@ -1,9 +1,6 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
declare var window;
/**
* @name Status Bar
* @description

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, InstanceCheck, checkAvailability, IonicNativePlugin } from '@ionic-native/core';
declare var FileTransfer;
declare const FileTransfer: any;
export interface FileUploadOptions {

View File

@@ -0,0 +1,152 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
export interface MediaFile {
/**
* The name of the file, without path information.
*/
name: string;
/**
* The full path of the file, including the name.
*/
fullPath: string;
/**
* The file's mime type
*/
type: string;
/**
* The date and time when the file was last modified.
*/
lastModifiedDate: Date;
/**
* The size of the file, in bytes.
*/
size: number;
/**
* Retrieves the format information of the media file.
* @param {Function} successCallback
* @param {Function} [errorCallback]
*/
getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): any;
}
export interface MediaFileData {
/**
* The actual format of the audio and video content.
*/
codecs: string;
/**
* The average bitrate of the content. The value is zero for images.
*/
bitrate: number;
/**
* The height of the image or video in pixels. The value is zero for audio clips.
*/
height: number;
/**
* The width of the image or video in pixels. The value is zero for audio clips.
*/
width: number;
/**
* The length of the video or sound clip in seconds. The value is zero for images.
*/
duration: number;
}
export interface VideoCapturePlusOptions {
/**
* The number of videos to record, default 1 (on iOS always 1)
*/
limit?: number;
/**
* Max duration in seconds, default 0, which is 'forever'
*/
duration?: number;
/**
* Set to true to override the default low quality setting
*/
highquality?: boolean;
/**
* Set to true to override the default backfacing camera setting.
* You'll want to sniff the useragent/device and pass the best overlay based on that.. assuming iphone here
*/
frontcamera?: boolean;
/**
* put the png overlay in your assets folder
*/
portraitOverlay?: string;
/**
* not passing an overlay means no image is shown for the landscape orientation
*/
landscapeOverlay?: string;
/**
* iOS only
*/
overlayText?: string;
}
/**
* @beta
* @name Video Capture Plus
* @description
* This plugin offers some useful extras on top of the default Media Capture Plugin capabilities:
* - HD recording.
* - Starting with the front camera.
* - A custom overlay (currently iOS only).
*
* @usage
* ```typescript
* import { VideoCapturePlus, VideoCapturePlusOptions, MediaFile } from '@ionic-native/video-capture-plus';
*
*
* constructor(private videoCapturePlus: VideoCapturePlus) { }
*
* ...
*
* const options: VideoCapturePlusOptions = {
* limit: 1,
* highquality: true,
* portraitOverlay: 'assets/img/camera/overlay/portrait.png',
* landscapeOverlay: 'assets/img/camera/overlay/landscape.png'
* }
*
* this.videoCapturePlus.captureVideo(options).then(mediafile: MediaFile[] => console.log(mediafile), error => console.log('Something went wrong'));
*
* ```
* @interfaces
* MediaFile
* MediaFileData
* VideoCapturePlusOptions
*/
@Plugin({
pluginName: 'VideoCapturePlus',
plugin: 'https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin.git',
pluginRef: 'window.plugins.videocaptureplus',
repo: 'https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class VideoCapturePlus extends IonicNativePlugin {
/**
* Starts recordings
* @param [options] {VideoCapturePlusOptions} Configure options
* @return {Promise<MediaFile[]>}
*/
@Cordova({
callbackOrder: 'reverse'
})
captureVideo(options?: VideoCapturePlusOptions): Promise<MediaFile[]> { return; }
}

View File

@@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, Plugin, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
declare var window;
/**
* @beta
* @name Web Intent

View File

@@ -14,12 +14,12 @@ export interface WheelSelectorOptions {
/**
* The items to display (array of items).
*/
items: WheelSelectorItem[];
items: Array<Array<WheelSelectorItem>>;
/**
* Which items to display by default, example ["2","Apple"] (if items.length is 2 for instance)
*/
defaultItems?: WheelSelectorItem[];
defaultItems?: Array<WheelSelectorItem>;
/**
* The 'ok' button text
@@ -44,13 +44,6 @@ export interface WheelSelectorOptions {
* Default: false
*/
wrapWheelText?: boolean;
/**
* The json key to display, by default it is description, this allows for setting any
* key/value to be displayed
* Default: description
*/
displayKey?: string;
}
export interface WheelSelectorData {
@@ -84,12 +77,13 @@ export interface WheelSelectorData {
* ],
* };
*
* //use most of the default values
* this.selector.show({
* title: "Select some Fruit",
* items: [
* [jsonData.numbers],
* [jsonData.fruits]
* ],
* jsonData.numbers,
* jsonData.fruits
* ]
* }).then(
* result => {
* console.log('Selected: ' + result[0].description + ' at index: ' + result[0].index
@@ -98,6 +92,28 @@ export interface WheelSelectorData {
* err => console.log('Error occurred while getting result: ', err)
* );
*
* ...
*
* //set some initial default values to display: "2", "Tangerine"
* this.selector.show({
* title: "Select some Fruit",
* items: [
* jsonData.numbers,
* jsonData.fruits
* ],
* defaultItems: [
* jsonData.numbers[1],
* jsonData.fruits[2]
* ]
* }).then(
* result => {
* console.log('Selected: ' + result[0].description + ' at index: ' + result[0].index
* + ' and ' + result[1].description + ' at index: ' + result[1].index);
* },
* err => console.log('Error occurred while getting result: ', err)
* );
*
*
* ```
*
* @interfaces

View File

@@ -5,6 +5,7 @@
"stripInternal": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": true,
"module": "es2015",
"moduleResolution": "node",
"paths": {