@ionic-native/core
Advanced tools
Comparing version 3.0.0 to 3.1.0-alpha.1
export declare function checkReady(): void; |
@@ -19,2 +19,1 @@ export function checkReady() { | ||
} | ||
//# sourceMappingURL=bootstrap.js.map |
export * from './plugin'; |
export * from './plugin'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ionic-native/core", | ||
"version": "3.0.0", | ||
"version": "3.1.0-alpha.1", | ||
"description": "Ionic Native - Native plugins for ionic apps", | ||
@@ -15,3 +15,6 @@ "module": "index.js", | ||
"url": "https://github.com/driftyco/ionic-native.git" | ||
}, | ||
"dependencies": { | ||
"@ionic-native/utils": "3.1.0-alpha.1" | ||
} | ||
} |
@@ -28,2 +28,6 @@ import { Observable } from 'rxjs/Observable'; | ||
/** | ||
* Available installation variables | ||
*/ | ||
installVariables?: string[]; | ||
/** | ||
* Supported platforms | ||
@@ -30,0 +34,0 @@ */ |
@@ -20,3 +20,3 @@ import { get } from './util'; | ||
export var pluginWarn = function (pluginObj, method) { | ||
var pluginName = pluginObj.pluginName, plugin = pluginObj.plugin; | ||
var pluginName = pluginObj.constructor.getPluginName(), plugin = pluginObj.constructor.getPlugin(); | ||
if (method) { | ||
@@ -112,7 +112,7 @@ console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.'); | ||
args = setIndex(args, opts, resolve, reject); | ||
var pluginInstance = getPlugin(pluginObj.pluginRef); | ||
var pluginInstance = getPlugin(pluginObj.constructor.getPluginRef()); | ||
if (!pluginInstance || pluginInstance[methodName] === 'undefined') { | ||
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation). | ||
if (!window.cordova) { | ||
cordovaWarn(pluginObj.pluginName, methodName); | ||
cordovaWarn(pluginObj.constructor.getPluginName(), methodName); | ||
return { | ||
@@ -140,21 +140,6 @@ error: 'cordova_not_available' | ||
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 1/2 or on a recent browser.'); | ||
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.'); | ||
} | ||
}; | ||
if (window.angular) { | ||
var injector = window.angular.element(document.querySelector('[ng-app]') || document.body).injector(); | ||
if (injector) { | ||
var $q = injector.get('$q'); | ||
return $q(function (resolve, reject) { | ||
cb(resolve, reject); | ||
}); | ||
} | ||
else { | ||
console.warn('Angular 1 was detected but $q couldn\'t be retrieved. This is usually when the app is not bootstrapped on the html or body tag. Falling back to native promises which won\'t trigger an automatic digest when promises resolve.'); | ||
return tryNativePromise(); | ||
} | ||
} | ||
else { | ||
return tryNativePromise(); | ||
} | ||
return tryNativePromise(); | ||
} | ||
@@ -200,7 +185,7 @@ function wrapPromise(pluginObj, methodName, args, opts) { | ||
} | ||
return get(window, pluginObj.pluginRef)[opts.clearFunction].call(pluginObj, pluginResult); | ||
return get(window, pluginObj.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult); | ||
} | ||
} | ||
catch (e) { | ||
console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName); | ||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName); | ||
console.error(e); | ||
@@ -238,3 +223,3 @@ } | ||
catch (e) { | ||
console.warn('Unable to clear the previous observable watch for', pluginObj.pluginName, methodName); | ||
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName); | ||
console.error(e); | ||
@@ -278,7 +263,7 @@ } | ||
return new Observable(function (observer) { | ||
var pluginInstance = getPlugin(pluginObj.pluginRef); | ||
var pluginInstance = getPlugin(pluginObj.constructor.getPluginRef()); | ||
if (!pluginInstance) { | ||
// Do this check in here in the case that the Web API for this plugin is available (for example, Geolocation). | ||
if (!window.cordova) { | ||
cordovaWarn(pluginObj.pluginName, methodName); | ||
cordovaWarn(pluginObj.constructor.getPluginName(), methodName); | ||
observer.error({ | ||
@@ -376,2 +361,17 @@ error: 'cordova_not_available' | ||
}; | ||
cls['getPluginName'] = function () { | ||
return config.pluginName; | ||
}; | ||
cls['getPluginRef'] = function () { | ||
return config.pluginRef; | ||
}; | ||
cls['getPluginInstallName'] = function () { | ||
return config.plugin; | ||
}; | ||
cls['getPluginRepo'] = function () { | ||
return config.repo; | ||
}; | ||
cls['getSupportedPlatforms'] = function () { | ||
return config.platforms; | ||
}; | ||
return cls; | ||
@@ -389,2 +389,3 @@ }; | ||
return function (target, methodName, descriptor) { | ||
console.log('@Cordova()', target, methodName, descriptor); | ||
return { | ||
@@ -396,2 +397,3 @@ value: function () { | ||
} | ||
console.log('@Cordova() wrap()', this, methodName, opts); | ||
return wrap(this, methodName, opts).apply(this, args); | ||
@@ -488,2 +490,1 @@ } | ||
} | ||
//# sourceMappingURL=plugin.js.map |
export declare function get(obj: any, path: any): any; |
@@ -11,2 +11,1 @@ export function get(obj, path) { | ||
; | ||
//# sourceMappingURL=util.js.map |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
702
27012
2
2
1