本文整理汇总了TypeScript中poker/authmanager.authManager.registerAuthenticationChangedHandler方法的典型用法代码示例。如果您正苦于以下问题:TypeScript authManager.registerAuthenticationChangedHandler方法的具体用法?TypeScript authManager.registerAuthenticationChangedHandler怎么用?TypeScript authManager.registerAuthenticationChangedHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poker/authmanager.authManager
的用法示例。
在下文中一共展示了authManager.registerAuthenticationChangedHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor() {
super();
const self = this;
this.withdrawalAmount = ko.observable(null);
this.withdrawalMethod = ko.observable(null);
this.withdrawalMethods = ko.observableArray([
{ id: 1, text: "Unitbag" },
{ id: 2, text: "Visa" },
{ id: 3, text: "MasterCard" },
]);
this.accountNumber = ko.observable(null);
authManager.registerAuthenticationChangedHandler(async (newValue) => {
if (newValue) {
const api = new AccountManager();
const data = await api.getAccount();
const personalAccountData = data.Data;
self.player({
login: authManager.login(),
amount: personalAccountData.RealMoney,
});
} else {
self.player({
login: "",
amount: null,
});
}
});
this.player = ko.observable({
login: "",
amount: null,
});
}
示例2: constructor
constructor(messageId: number, date: Date, sender: string, message: string) {
this.messageId = messageId;
this.isAdmin = false;
if (sender.toLowerCase() === "admin") {
this.isAdmin = true;
}
this.isMy = ko.observable(authManager.login() === sender);
authManager.registerAuthenticationChangedHandler(() => {
this.isMy(authManager.login() === sender);
});
this.sender = sender;
this.message = ko.observable(message);
this.date = date.getHours() + ":" + date.getMinutes();
this.fullMessage = ko.computed(() => {
return "[" + this.date + "]" + this.sender + " - " + this.message();
});
}
示例3: constructor
constructor() {
super();
const self = this;
this.showScreenOverlay = ko.computed(() => {
if (!appConfig.ui.enableScreenOverlay) {
return false;
}
if ((/iphone|ipod|ipad/gi).test(navigator.platform)) {
if (!navigator.standalone) {
return true;
}
return false;
}
return false;
});
this.currentTime = ko.computed(function () {
return timeService.currentTime();
}, this);
this.online = metadataManager.online;
this.registered = metadataManager.registered;
this.captionLabel = ko.computed(() => {
return _("header.onlinePlayersShort")
.replace("#registered", this.registered())
.replace("#online", this.online());
});
this.tournamentsCaption = ko.computed(function () {
return _("tournamentsList.headerCaption")
.replace("#count", "0".toString());
}, this);
this.cashOptions = new CashOptions();
this.tournamentOptions = new TournamentOptions();
this.sngOptions = new TournamentOptions();
this.tournaments = ko.observableArray<LobbyTournamentItemEx>([]);
this.sngs = ko.observableArray<LobbyTournamentItemEx>([]);
this.tables = ko.observableArray([]);
this.showFilterSlider = ko.observable(false);
this.showItemsListSlider = ko.observable(true);
this.filterLocked = ko.observable(false);
this.slider = new Slider();
this.slider.addOption(_("lobby.cashGames"), "cash", null);
this.slider.addOption(_("lobby.tournaments"), "tournaments", null);
this.slider.addOption(_("lobby.sitAndGo"), "sng", null);
this.cashTablesEnabled = ko.observable(appConfig.lobby.cashTablesEnabled);
this.tournamentTablesEnabled = ko.observable(appConfig.lobby.tournamentTablesEnabled);
this.sngTablesEnabled = ko.observable(appConfig.lobby.sngTablesEnabled);
if (!appConfig.tournament.enabled) {
this.slider.enabled(false);
this.tournamentTablesEnabled(false);
this.sngTablesEnabled(false);
}
if (appConfig.tournament.enableTournamentOnly) {
this.slider.enabled(false);
this.slider.currentIndex(1);
}
this.loading = ko.observable(false);
this.selectionCaption = ko.computed(function () {
if (self.slider.currentIndex() === 0) {
return _("tablesList.headerCaption")
.replace("#count", self.tables().length.toString());
}
if (self.slider.currentIndex() === 1) {
return _("tournamentsList.headerCaption")
.replace("#count", self.tournaments().length.toString());
}
return _("tournamentsList.sngCaption")
.replace("#count", self.sngs().length.toString());
}, this);
tableManager.tables.subscribe(function () {
self.updateOpenedTables();
});
this.authenticated = ko.computed(function () {
return authManager.authenticated();
}, this);
this.login = ko.computed(function () {
return authManager.login();
}, this);
authManager.registerAuthenticationChangedHandler(function (newValue) {
if (authManager.login() === null) {
self.amount(0);
} else {
self.updateAccount();
}
});
this.amount = ko.observable(0);
}