本文整理汇总了TypeScript中entcore._类的典型用法代码示例。如果您正苦于以下问题:TypeScript _类的具体用法?TypeScript _怎么用?TypeScript _使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了_类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
this.open = async function(){
var that = this;
var data = (await http.get('/userbook/api/person?id=' + this.id + '&type=' + this.type)).data;
if(!data.result[0]){
this.id = undefined;
return;
}
data.result[0].hobbies = _.filter(data.result[0].hobbies, function(hobby){
return hobby.values
})
data.result[0].relatives = _.map(data.result, function(item){
return new directory.User({ displayName: item.relatedName, id: item.relatedId, type: item.relatedType });
})
.filter(function(relative){
return relative.id;
});
data.result[0].relatives = _.filter(data.result[0].relatives, function(user){
return user.id !== '';
});
data.result[0].attachedStructures = data.result[0].schools;
if(!data.result[0]){
this.id = undefined;
return;
}
this.updateData(data.result[0]);
this.trigger('sync');
};
示例2: init
function init(subjectScheduled){
SubjectCopyService.resolveBySubjectScheduled_force(subjectScheduled).then(
function () {
scope.subjectCopyList = SubjectCopyService.getListBySubjectScheduled(subjectScheduled);
scope.subjectCopyList.forEach(copy => {
if(copy.is_corrected){
scope.score.sum += copy.final_score;
scope.score.nb++;
}
});
CorrectionService.automaticCorrection(scope.subjectCopyList, scope.selectedSubjectScheduled);
}
);
let r = _.map(_.union(scope.selectedSubjectScheduled.scheduled_at.userList, scope.selectedSubjectScheduled.scheduled_at.groupList), _.clone);
let total = r.length;
let current = 1;
_.forEach(r, function (obj) {
if (total !== current) obj.name = obj.name + ' - ';
current++;
});
scope.lUserGroup = r;
scope.selectedSubjectScheduled.lUserGroup = scope.lUserGroup;
}
示例3: function
lang.addBundle('/directory/i18n', function(){
Birthday.emptyList = lang.translate('nobirthday');
Birthday.birthdays = _.filter(birthdays, function(birthday){
return moment(birthday.birthDate).month() === moment().month();
});
Birthday.birthdays = Birthday.birthdays.sort(function(a, b){
return moment(a.birthDate).date() - moment(b.birthDate).date()
});
var classes = [];
classes = _.pluck(Birthday.birthdays, 'classes');
classes.forEach(function(classList){
classList.forEach(function(myClass){
if(!_.findWhere(Birthday.classes, {id :myClass[0] })){
Birthday.classes.push({
name: myClass[1],
id: myClass[0]
});
}
});
});
Birthday.currentClass = _.findWhere(Birthday.classes, { id: Birthday.currentClass.id })
if(!Birthday.currentClass){
Birthday.currentClass = Birthday.classes[0];
}
model.widgets.apply();
});
示例4: function
init: function(){
var source = this.source;
this.me = model.me;
this.lang = lang;
if(source.customLinks){
this.links = source.customLinks;
this.custom = true;
this.snipletDisplay = {};
return;
}
this.source.landingPage = this.snipletResource.landingPage;
this.source._id = this.snipletResource._id;
this.links = _.map(this.snipletResource.pages.all, (page) => {
let href = '#/website/' + this.source._id + '/' + page.titleLink;
if (window.location.hash.startsWith('#/preview/')) {
href = '#/preview/' + this.source._id + '/' + page.titleLink;
}
return {
title: page.title,
href: href,
published: page.published,
index: page.index
}
});
console.log(this.links);
this.links = _.reject(this.links, (l) => l.published === false);
model.one('refresh-nav', () => this.init());
this.$apply('links')
},
示例5: function
}, function () {
scope.grainCopy.grain_copy_data.custom_copy_data = new CustomData(scope.grainCopy.grain_copy_data.custom_copy_data);
scope.customData = scope.grainCopy.grain_copy_data.custom_copy_data;
//shuffle
if (scope.customData.answersType === 'list') {
_.forEach(scope.customData.zones, function (zone) {
var tmp = _.clone(zone.options);
var secureLoop = 0;
if (tmp && tmp.length > 1) {
while (zone.options[0] === tmp[0]) {
zone.options = _.shuffle(zone.options);
if (secureLoop === 5) return false;
secureLoop++;
}
}
});
} else if (scope.customData.answersType === 'drag') {
var tmp = _.clone(scope.customData.options);
var secureLoop = 0;
if (tmp && tmp.length > 1) {
while (scope.customData.options[0] === tmp[0] && !(secureLoop === 5)) {
scope.customData.options = _.shuffle(scope.customData.options);
secureLoop++;
}
}
scope.dragOptions = [];
var i=0;
_.forEach(scope.customData.options, function (option) {
scope.dragOptions.push({id:i,option:option});
i++;
});
//case of several fillZone in the same subject
scope.usedAnswers = [];
// init usedAnswers
if (scope.customData.zones) {
_.forEach(scope.customData.zones, function (zone) {
if (zone.answer) {
for (let option of scope.dragOptions) {
if (option.option === zone.answer && option.zoneId === undefined) {
option.zoneId = zone.id;
scope.usedAnswers.push(option);
break;
}
}
}
});
}
}
});
示例6:
scope.grainCopy.grain_copy_data.custom_copy_data.options.forEach((option) => {
let totalMatch = _.filter(scope.grainCopy.grain_copy_data.custom_copy_data.options,
(o, i) => o === option
).length;
let foundMatch = _.filter(returnArray, (o) => o === option).length;
let foundUsed = _.filter(scope.usedAnswers, (o) => o === option).length;
if(foundUsed + foundMatch < totalMatch){
returnArray.push(option);
}
});
示例7: function
ArchivesService.getListArchivedSubjectScheduledCopy(subjectScheduled.id , (array => {
scope.subjectCopyList = array;
let r = _.map(_.union(scope.selectedSubjectScheduled.scheduled_at.userList, scope.selectedSubjectScheduled.scheduled_at.groupList), _.clone);
let total = r.length;
let current = 1;
_.forEach(r, function (obj) {
if (total !== current) obj.name = obj.name + ' - ';
current++;
});
scope.lUserGroup = r;
}))
示例8: async
$scope.replyAll = async () => {
template.open('main', 'mail-actions/write-mail');
const mail = $scope.state.newItem as Mail;
mail.parentConversation = $scope.mail;
await mail.setMailContent($scope.mail, 'reply', $compile, $sanitize, $scope, $scope.getSignature(), true);
if ($scope.mail.sender().id !== model.me.userId)
mail.to = _.filter($scope.state.newItem.to, function (user) { return user.id !== model.me.userId })
if (!_.findWhere($scope.state.newItem.to, { id: $scope.mail.sender().id })) {
$scope.addUser($scope.mail.sender());
}
$scope.ccCciShow = (mail.cc.length || mail.cci.length);
$scope.$apply();
};