diff --git a/declarations.d.ts b/declarations.d.ts index 06dfb9e0e..ed61cfc82 100644 --- a/declarations.d.ts +++ b/declarations.d.ts @@ -103,6 +103,7 @@ declare var require: NativeScriptRequire; // Global functions declare function Deprecated(target: Object, key?: string | symbol, value?: any): void; +declare function Experimental(target: Object, key?: string | symbol, value?: any): void; declare function Log(data: any): void; declare function log(data: any): void; diff --git a/globals/globals.ts b/globals/globals.ts index 329588b3c..2257f8b16 100644 --- a/globals/globals.ts +++ b/globals/globals.ts @@ -137,3 +137,22 @@ export function Deprecated(target: Object, key?: string | symbol, descriptor?: a } global.Deprecated = Deprecated; + +export function Experimental(target: Object, key?: string | symbol, descriptor?: any) { + if (descriptor) { + var originalMethod = descriptor.value; + + descriptor.value = function (...args: any[]) { + console.log(`${key} is experimental`); + + return originalMethod.apply(this, args); + } + + return descriptor; + } else { + console.log(`${(target && (target).name || target)} is experimental`); + return target; + } +} + +global.Experimental = Experimental; \ No newline at end of file