本文整理汇总了TypeScript中tns-core-modules/data/observable.Observable.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Observable.set方法的具体用法?TypeScript Observable.set怎么用?TypeScript Observable.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tns-core-modules/data/observable.Observable
的用法示例。
在下文中一共展示了Observable.set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: activityBackPressedCallback
function activityBackPressedCallback(args: AndroidActivityBackPressedEventData) {
if (context && context.get("shouldCancel")) {
context.set("shouldCancel", false);
context.set("message", "Back-pressed canceled!");
args.cancel = true;
}
}
示例2: onPageLoaded
export function onPageLoaded(args) {
var page = args.object;
vm.set("firstTitle", "fiiiirst");
vm.set("secondTitle", "secondTitle");
vm.set("secondIcon", "res://icon");
page.bindingContext = vm;
}
示例3: onTap
export function onTap() {
i++;
vm.set("firstTitle", "changed " + i);
if (i === 3) {
vm.set("firstIcon", "res://ic_action");
}
if (i === 4) {
vm.set("firstIcon", "");
}
}
示例4: pageLoaded
export function pageLoaded(args) {
var page = args.object;
var textFieldSecured = page.getViewById("textFieldSecured");
textFieldSecured.secure = true;
var obj = new observable.Observable();
obj.set("textProperty", "text");
page.bindingContext = obj;
}
示例5: pageLoaded
export function pageLoaded(args) {
// Get the event sender
page = args.object;
page.bindingContext = data;
data.set('src', '~/gifs/hammer.gif');
setTimeout(() => {
return data.set('src', '~/gifs/darthRide.gif');
}, 3000);
if (isAndroid && device.sdkVersion >= '21') {
const window = app.android.startActivity.getWindow();
window.setStatusBarColor(new Color('#00695C').android);
}
}
示例6: getDuration
export function getDuration(gifView) {
const x = gifView.getDuration() as Gif;
data.set('duration', x);
}
示例7: getFrames
export function getFrames(args) {
const gif = page.getViewById('myGif') as Gif;
const frames = gif.getFrameCount();
data.set('frames', frames);
}
示例8: gifLoaded
export function gifLoaded(args) {
const gif = args.object as Gif;
data.set('gifSrc', gif.src);
}
示例9: setTimeout
setTimeout(() => {
return data.set('src', '~/gifs/darthRide.gif');
}, 3000);
示例10: createPage
export function createPage() {
var page = new pageModule.Page();
var stack = new stackLayoutModule.StackLayout();
var sourceOneWay = new observableModule.Observable();
var sourceTwoWay = new observableModule.Observable();
var targetOneWay = new textFieldModule.TextField();
var targetTwoWay = new textFieldModule.TextField();
var buttonOneWay = new buttonModule.Button();
var buttonTwoWay = new buttonModule.Button();
var buttonSetText = new buttonModule.Button();
targetOneWay.id = "textFieldOneWay";
targetTwoWay.id = "textFieldTwoWay";
buttonOneWay.id = "buttonOneWay";
buttonTwoWay.id = "buttonTwoWay";
buttonSetText.id = "buttonSetText";
targetOneWay.automationText = "textFieldOneWay";
targetTwoWay.automationText = "textFieldTwoWay";
buttonSetText.automationText = "buttonSetText";
//buttonOneWay.automationText = "buttonOneWay";
//buttonTwoWay.automationText = "buttonTwoWay";
buttonSetText.text = "SetText";
buttonSetText.on(buttonModule.Button.tapEvent, function () {
targetOneWay.text = "Test";
targetTwoWay.text = "Test";
});
stack.addChild(buttonSetText);
// OneWay Binding
var bindingOptionOneWay = {
sourceProperty: "textSource",
targetProperty: "text",
twoWay: false
};
targetOneWay.bind(bindingOptionOneWay, sourceOneWay);
sourceOneWay.set("textSource", "OneWay");
buttonOneWay.on(buttonModule.Button.loadedEvent, function () {
buttonOneWay.text = sourceOneWay.get("textSource");
});
buttonOneWay.on(buttonModule.Button.tapEvent, function () {
buttonOneWay.text = sourceOneWay.get("textSource");
});
stack.addChild(targetOneWay);
stack.addChild(buttonOneWay);
// TwoWay Binding
var bindingOptionTwoWay = {
sourceProperty: "textSource",
targetProperty: "text",
twoWay: true
};
targetTwoWay.bind(bindingOptionTwoWay, sourceTwoWay);
sourceTwoWay.set("textSource", "TwoWay");
buttonTwoWay.on(buttonModule.Button.loadedEvent, function () {
buttonTwoWay.text = sourceTwoWay.get("textSource");
});
buttonTwoWay.on(buttonModule.Button.tapEvent, function () {
buttonTwoWay.text = sourceTwoWay.get("textSource");
});
stack.addChild(targetTwoWay);
stack.addChild(buttonTwoWay);
page.content = stack;
return page;
}