mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #384 from NativeScript/decorators
Deprecated decorator implemented
This commit is contained in:
@@ -145,13 +145,44 @@ class AndroidApplication extends observable.Observable implements dts.AndroidApp
|
|||||||
public packageName: string;
|
public packageName: string;
|
||||||
public hasActionBar: boolean;
|
public hasActionBar: boolean;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityCreated: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
|
public onActivityCreated: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityDestroyed: (activity: android.app.Activity) => void;
|
public onActivityDestroyed: (activity: android.app.Activity) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityStarted: (activity: android.app.Activity) => void;
|
public onActivityStarted: (activity: android.app.Activity) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityPaused: (activity: android.app.Activity) => void;
|
public onActivityPaused: (activity: android.app.Activity) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityResumed: (activity: android.app.Activity) => void;
|
public onActivityResumed: (activity: android.app.Activity) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityStopped: (activity: android.app.Activity) => void;
|
public onActivityStopped: (activity: android.app.Activity) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onSaveActivityState: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
|
public onSaveActivityState: (activity: android.app.Activity, bundle: android.os.Bundle) => void;
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
@Deprecated
|
||||||
|
/* tslint:enable */
|
||||||
public onActivityResult: (requestCode: number, resultCode: number, data: android.content.Intent) => void;
|
public onActivityResult: (requestCode: number, resultCode: number, data: android.content.Intent) => void;
|
||||||
|
|
||||||
private _eventsToken: any;
|
private _eventsToken: any;
|
||||||
@@ -218,4 +249,4 @@ exports.start = function () {
|
|||||||
dts.loadCss();
|
dts.loadCss();
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.android = new AndroidApplication();
|
exports.android = new AndroidApplication();
|
||||||
|
|||||||
16
declarations.d.ts
vendored
16
declarations.d.ts
vendored
@@ -16,7 +16,23 @@ declare var console: Console;
|
|||||||
declare var global;
|
declare var global;
|
||||||
declare var require;
|
declare var require;
|
||||||
|
|
||||||
|
interface TypedPropertyDescriptor<T> {
|
||||||
|
enumerable?: boolean;
|
||||||
|
configurable?: boolean;
|
||||||
|
writable?: boolean;
|
||||||
|
value?: T;
|
||||||
|
get?: () => T;
|
||||||
|
set?: (value: T) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||||
|
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||||
|
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||||
|
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||||
|
|
||||||
// Global functions
|
// Global functions
|
||||||
|
declare function Deprecated(target: Object, key?: string | symbol, value?: any): void;
|
||||||
|
|
||||||
declare function Log(data: any): void;
|
declare function Log(data: any): void;
|
||||||
declare function log(data: any): void;
|
declare function log(data: any): void;
|
||||||
declare function float(num: number): any;
|
declare function float(num: number): any;
|
||||||
|
|||||||
@@ -15,4 +15,24 @@ if (types.isUndefined(global.NSObject)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
global.XMLHttpRequest = (<any>http).XMLHttpRequest;
|
global.XMLHttpRequest = (<any>http).XMLHttpRequest;
|
||||||
global.alert = dialogs.alert;
|
global.alert = dialogs.alert;
|
||||||
|
|
||||||
|
export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) {
|
||||||
|
if (descriptor) {
|
||||||
|
var originalMethod = descriptor.value;
|
||||||
|
|
||||||
|
descriptor.value = function (...args: any[]) {
|
||||||
|
console.log(`${key} is deprecated`);
|
||||||
|
|
||||||
|
return originalMethod.apply(this, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return descriptor;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
console.log(`${(target && (<any>target).name || target)} is deprecated`);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
global.Deprecated = Deprecated;
|
||||||
@@ -25,6 +25,7 @@ var borderColorProperty = new dependencyObservable.Property(
|
|||||||
new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.AffectsStyle)
|
new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.AffectsStyle)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
export class Border extends contentView.ContentView implements definition.Border {
|
export class Border extends contentView.ContentView implements definition.Border {
|
||||||
|
|
||||||
public static cornerRadiusProperty = cornerRadiusProperty;
|
public static cornerRadiusProperty = cornerRadiusProperty;
|
||||||
|
|||||||
Reference in New Issue
Block a user