• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript jQuery.map函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript jQuery.plot函数代码示例发布时间:2022-05-25
下一篇:
TypeScript jQuery.isFunction函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap