mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings - Only use ambient mobules for global API's - Move single-file modules to a subdir with the same name so that we can provide a hand-written typing next to it (via package.json) - Delete all mentions of tns-core-modules.d.ts - Delete reference d.ts assembly build steps. Not needed anymore. - HACK! Use a <reference> for global typings in application.d.ts to avoid publishing a separate @types/tns-core-modules package. - Rename declarations.d.ts to tns-core-modules.d.ts to preserve JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
committed by
Hristo Deshev
parent
1af8c6ca8e
commit
b45cbe929b
58
tns-core-modules/ui/core/bindable/bindable.d.ts
vendored
Normal file
58
tns-core-modules/ui/core/bindable/bindable.d.ts
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { ViewBase } from "ui/core/view-base";
|
||||
import { Observable, WrappedValue, PropertyChangeData, EventData } from "data/observable";
|
||||
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, messageType as traceMessageType, isCategorySet } from "trace";
|
||||
|
||||
export {
|
||||
Observable, WrappedValue, PropertyChangeData, EventData,
|
||||
traceEnabled, traceWrite, traceCategories, traceNotifyEvent, traceMessageType, isCategorySet
|
||||
};
|
||||
|
||||
/**
|
||||
* The options object used in the Bindable.bind method.
|
||||
*/
|
||||
export interface BindingOptions {
|
||||
/**
|
||||
* The property name of the source object (typically the ViewModel) to bind to.
|
||||
*/
|
||||
sourceProperty: string;
|
||||
/**
|
||||
* The property name of the target object (that is the Bindable instance) to bind the source property to.
|
||||
*/
|
||||
targetProperty: string;
|
||||
/**
|
||||
* True to establish a two-way binding, false otherwise. A two-way binding will synchronize both the source and the target property values regardless of which one initiated the change.
|
||||
*/
|
||||
twoWay?: boolean;
|
||||
/**
|
||||
* An expression used for calculations (convertions) based on the value of the property.
|
||||
*/
|
||||
expression?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface which defines methods need to create binding value converter.
|
||||
*/
|
||||
export interface ValueConverter {
|
||||
/**
|
||||
* A method that will be executed when a value (of the binding property) should be converted to the observable model.
|
||||
* For example: user types in a text field, but our business logic requires to store data in a different manner (e.g. in lower case).
|
||||
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
||||
*/
|
||||
toModel: (...params: any[]) => any;
|
||||
/**
|
||||
* A method that will be executed when a value should be converted to the UI view. For example we have a date object which should be displayed to the end user in a specific date format.
|
||||
* @param params - An array of parameters where first element is the value of the property and next elements are parameters send to converter.
|
||||
*/
|
||||
toView: (...params: any[]) => any;
|
||||
}
|
||||
|
||||
export class Binding {
|
||||
constructor(target: ViewBase, options: BindingOptions);
|
||||
public bind(source: Object): void;
|
||||
public unbind();
|
||||
public sourceIsBindingContext: boolean;
|
||||
public updateTwoWay(value: any);
|
||||
}
|
||||
|
||||
export function getEventOrGestureName(name: string): string;
|
||||
export function isEventOrGesture(name: string, view: ViewBase): boolean;
|
||||
Reference in New Issue
Block a user