mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
26 lines
783 B
TypeScript
26 lines
783 B
TypeScript
export class NativePluginDecorator {
|
|
constructor(cls, config) {
|
|
this.cls = cls;
|
|
this.config = config;
|
|
|
|
cls.pluginWarn = () => {
|
|
let platformString = [];
|
|
for(var k in this.config.platforms) {
|
|
platformString.push('\t' + k + ': '+ this.config.platforms[k]);
|
|
}
|
|
console.warn('Plugin for ' + this.config.name +
|
|
' not installed. For native functionality, please instead the correct plugin for your platform:\n' +
|
|
platformString.join('\n'));
|
|
}
|
|
}
|
|
}
|
|
|
|
export function NativePlugin(config) {
|
|
return function(cls) {
|
|
var annotations = Reflect.getMetadata('annotations', cls) || [];
|
|
annotations.push(new NativePluginDecorator(cls, config));
|
|
Reflect.defineMetadata('annotations', annotations, cls);
|
|
return cls;
|
|
}
|
|
}
|