本文整理汇总了TypeScript中data/observable.Observable类的典型用法代码示例。如果您正苦于以下问题:TypeScript Observable类的具体用法?TypeScript Observable怎么用?TypeScript Observable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Observable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: mainContentLoaded
mainContentLoaded(args: EventData) {
var obj = new Observable();
obj.set("selected", "rb-3");
obj.set("tap", function(args){
setTimeout(function() {
obj.set("selected", args.object.id);
}, 100);
});
args.object.bindingContext = obj;
}
示例2: require
"use strict";
var observable_1 = require("data/observable");
var countriesItems = [
{ Country: "Germany", Amount: -5, SecondVal: 14 },
{ Country: "France", Amount: 13, SecondVal: -3 },
{ Country: "Bulgaria", Amount: -10, SecondVal: 17 },
{ Country: "Spain", Amount: 11, SecondVal: -9 },
{ Country: "USA", Amount: 18, SecondVal: 8 }
];
var yearItems = [
{ Year: 200, Amount: 15 },
{ Year: 456, Amount: -8 },
{ Year: 366, Amount: 25 },
{ Year: 100, Amount: -5 },
{ Year: 340, Amount: 17 },
{ Year: 135, Amount: 20 },
];
var viewModel = new observable_1.Observable();
viewModel.set("countriesSource", countriesItems);
viewModel.set("yearSource", countriesItems);
function navigatingTo(args) {
var page = args.object;
page.bindingContext = viewModel;
}
exports.navigatingTo = navigatingTo;
示例3: constructor
constructor(){
this.imageLibrary =Images;
this.content= new Observable();
this.content.set("isLoading", true);
this.imglistSer = new ImageListServices();
}
示例4: onPageLoaded
function onPageLoaded(args) {
var page = args.object;
vm.set("firstTitle", "fiiiirst");
vm.set("secondTitle", "secondTitle");
vm.set("secondIcon", "res://icon");
page.bindingContext = vm;
}
示例5: onTap
function onTap() {
i++;
vm.set("firstTitle", "changed " + i);
if (i === 3) {
vm.set("firstIcon", "res://ic_action");
}
if (i === 4) {
vm.set("firstIcon", "");
}
}
示例6:
const interval = timer.setInterval(() => {
let playing, duration, position;
if (myPlayer) {
playing = myPlayer.isPlaying();
duration = myPlayer.getDuration();
position = myPlayer.getCurrentPosition();
}
data.set('playing', playing);
data.set('duration', duration);
data.set('position', position);
}, 250);
示例7: join
export function join(args) {
socketIO = new SocketIO('http://192.168.56.1:3000', {});
socketIO.emit('add user', { username: pageData.get("username") });
socketIO.on('login', function(data) {
frameModule.topmost().navigate({ moduleName: 'main-page', context: { username: pageData.get("username"),socket:socketIO.getInstance() } })
})
}
示例8: join
export function join(args) {
socketIO.emit('add user', { username: pageData.get("username") });
}
示例9: function
socketIO.on('login', function (data) {
frameModule.topmost().navigate({ moduleName: 'main-page', context: { username: pageData.get("username"), socket: socketIO.instance } })
})
示例10: setTimeout
setTimeout(function() {
obj.set("selected", args.object.id);
}, 100);