本文整理匯總了TypeScript中meteor/meteor.Meteor.userId方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Meteor.userId方法的具體用法?TypeScript Meteor.userId怎麽用?TypeScript Meteor.userId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類meteor/meteor.Meteor
的用法示例。
在下文中一共展示了Meteor.userId方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
{ provide: 'CanActivateForLoggedIn', useValue: () => !! Meteor.userId() }
示例2: ngOnInit
ngOnInit(){
this.userid = this.route.snapshot.params['userid'];
this.cur_user = typeof this.userid === "undefined" || this.userid === null || this.userid === Meteor.userId();
}
示例3:
this.zone.run(() => {
this.currentUser = Meteor.user();
this.currentUserId = Meteor.userId();
this.isLoggingIn = Meteor.loggingIn();
this.isLoggedIn = !!Meteor.user();
})
示例4:
useValue: () => !!Meteor.userId()
示例5: routerOnActivate
routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
if (Meteor.userId() === null) {
this.router.navigate(['Login']);
}
}
示例6: unsubscribeConversation
// Unsubscribe user from conversation
function unsubscribeConversation(reference:string){
ConversationStreams.update({'_id':reference, 'subscribers':{$elemMatch: {'user':Meteor.userId()}}}, {
$set : {'subscribers.$.subscribed':0}
});
}
示例7: userMutedNotifications
private userMutedNotifications(): boolean {
const userConfiguration = UserConfigurations.findOne({userId: Meteor.userId()});
return userConfiguration && userConfiguration.muteNotifications;
}
示例8: constructor
constructor (private params: RouteParams) {
let deckId = params.get('deckId');
this.words = Words.find( { $and: [ { creator: Meteor.userId() }, { deckid: deckId } ] } );
}
示例9: sendMessage
sendMessage(conversationID, message){
this.call('sendMessage', conversationID, Meteor.userId(), message);
this.reply = '';
}
示例10: seedPosts
This paragraph has some \`code\` in it.
This paragraph has some \`code\` in it.
![Alt Text](http://placehold.it/200x50 "Image Title")
![Alt Text](http://placehold.it/200x50 "Image Title")
`
};
Meteor.methods({
seedPosts() {
let userId = Meteor.userId();
if (!userId) {
return;
}
if (Posts.find({ author: userId, removed: false }).count() === 0) {
posts.forEach((post) => {
Meteor.call('createPost', post);
});
}
},
removeAllPosts() {
let userId = Meteor.userId();
if (!userId) {