本文整理汇总了TypeScript中jQuery.map函数的典型用法代码示例。如果您正苦于以下问题:TypeScript map函数的具体用法?TypeScript map怎么用?TypeScript map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了map函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
$form.submit(function () {
var paths = $.map($('input', $form), U.attrgetter('value'));
// filter out empty paths
paths = $.grep(paths, U.identity);
ctrl.send('setpath', JSON.stringify(paths));
return false;
})
开发者ID:hraban,项目名称:lush,代码行数:7,代码来源:path.ts
示例2:
(data:any) => {
$results
.empty()
.append ($.map(data[1], (v) => {
return $('<li>').text(v);
}));
}
开发者ID:bsorrentino,项目名称:rxjs-samples,代码行数:7,代码来源:autocomplete.ts
示例3: groupby
export function groupby(objs, keyfun) {
var groups = {};
$.map(objs, function (obj) {
var key = keyfun(obj);
// [] if no such group yet
groups[key] = (groups[key] || []).concat(obj);
});
return groups;
}
开发者ID:hraban,项目名称:lush,代码行数:9,代码来源:utils.ts
示例4: _switchNeighbor
private _switchNeighbor(
fromIndex: number,
direction: SwitchDirection,
switchOptions?: JQueryTab.SwitchOptions
): JQueryTab.SwitchResult {
const {getter} = this;
const opts = switchOptions || {};
const {includeDisabled, includeHidden, loop, exclude} = opts;
const excludeIndecies = exclude && exclude.length ? $.map(exclude, function (position) {
return getter.positionToIndex(position);
}) : [];
const {$panelContainer} = this.containers;
const $panelItems = $panelContainer.children();
const {itemCount} = this.context;
const {disabledPanelItemClass, hiddenPanelItemClass} = this.options;
let maxIterationCount = -1;
if (loop) {
if (fromIndex >= 0 && fromIndex < itemCount) {
maxIterationCount = itemCount - 1;
} else {
maxIterationCount = itemCount;
}
} else if (direction === SwitchDirection.Backward) {
maxIterationCount = fromIndex;
} else if (direction === SwitchDirection.Forward) {
maxIterationCount = itemCount - fromIndex - 1;
}
const iterationStep = direction === SwitchDirection.Backward ? -1 : 1;
for (let i = 1; i <= maxIterationCount; i++) {
const panelIndex = (fromIndex + i * iterationStep + itemCount) % itemCount;
if ($.inArray(panelIndex, excludeIndecies) >= 0) {
continue;
}
const $panel = $panelItems.eq(panelIndex);
const panelIsDisabled = $panel.hasClass(disabledPanelItemClass);
const panelIsHidden = $panel.hasClass(hiddenPanelItemClass);
if (
(!panelIsDisabled && !panelIsHidden) ||
(includeDisabled && !panelIsHidden) ||
(!panelIsDisabled && includeHidden) ||
(includeDisabled && includeHidden)
) {
return this.switchTo(panelIndex);
}
}
}
开发者ID:mjpclab,项目名称:jquery-tab,代码行数:51,代码来源:switcher.ts
示例5: triggerModal
/**
* @param {JQuery} $currentTarget
*/
private triggerModal($currentTarget: JQuery): void {
const btnSubmit = $currentTarget.data('data-btn-submit') || 'Add';
const placeholder = $currentTarget.data('placeholder') || 'Paste media url here...';
const allowedExtMarkup = $.map($currentTarget.data('online-media-allowed').split(','), (ext: string): string => {
return '<span class="label label-success">' + ext.toUpperCase() + '</span>';
});
const allowedHelpText = $currentTarget.data('online-media-allowed-help-text') || 'Allow to embed from sources:';
const $modal = Modal.show(
$currentTarget.attr('title'),
'<div class="form-control-wrap">' +
'<input type="text" class="form-control online-media-url" placeholder="' + placeholder + '" />' +
'</div><div class="help-block">' + allowedHelpText + '<br>' + allowedExtMarkup.join(' ') + '</div>',
Severity.notice,
[{
text: btnSubmit,
btnClass: 'btn btn-primary',
name: 'ok',
trigger: (): void => {
const url = $modal.find('input.online-media-url').val();
if (url) {
$modal.modal('hide');
this.addOnlineMedia($currentTarget, url);
}
}
}]
);
$modal.on('shown.bs.modal', (e: JQueryEventObject): void => {
// focus the input field
$(e.currentTarget).find('input.online-media-url').first().focus().on('keydown', (kdEvt: JQueryEventObject): void => {
if (kdEvt.keyCode === KeyTypesEnum.ENTER) {
$modal.find('button[name="ok"]').trigger('click');
}
});
});
}
开发者ID:mblag,项目名称:TYPO3.CMS,代码行数:39,代码来源:OnlineMedia.ts
示例6:
socket.on("users", (users: string []) => {
$("#users")
.empty()
.append($.map(users, user => { return $("<li>").text(user); }));
});
开发者ID:jaxx,项目名称:battleship,代码行数:5,代码来源:index.ts
示例7: function
$(ctrl).on("path", function (_, pathjson) {
var dirs = JSON.parse(pathjson);
$('ol', $form)
.empty()
.append($.map(dirs, createPathInput));
});
开发者ID:hraban,项目名称:lush,代码行数:6,代码来源:path.ts
示例8: convertFormToObject
export function convertFormToObject(formEl: Element) {
let inputs = $(formEl.querySelectorAll("input"));
let values = $.map(inputs, function(d) { return [[d.name, d.value]]; });
return _.object(values);
}
开发者ID:drdim,项目名称:farmbot-web-frontend,代码行数:5,代码来源:util.ts
注:本文中的jQuery.map函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论