本文整理汇总了TypeScript中jQuery.each函数的典型用法代码示例。如果您正苦于以下问题:TypeScript each函数的具体用法?TypeScript each怎么用?TypeScript each使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了each函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setupEvents
/**
* create internal objects for the given events
*/
setupEvents(events) {
const parts = _.partition(events, 'isRegion');
const regions = parts[0];
events = parts[1];
$.each(events, (index, event) => {
const ve = new VisualEvent(event, this._buildDiv(event));
this._events.push(ve);
});
$.each(regions, (index, event) => {
const vre = new VisualEvent(event, this._buildRegDiv(event));
this._events.push(vre);
});
this._events.sort((a, b) => {
const ao = a.getOptions(),
bo = b.getOptions();
if (ao.min > bo.min) {
return 1;
}
if (ao.min < bo.min) {
return -1;
}
return 0;
});
}
示例2: populateInstanceComputableOptions
export function populateInstanceComputableOptions(options) {
$.each(instanceComputableOptions, function(name, func) {
if (options[name] == null) {
options[name] = func(options)
}
})
}
示例3: locale
export function locale(localeCode, newFcOptions) {
let fcOptions
let momOptions
// get the FullCalendar internal option hash for this locale. create if necessary
fcOptions = localeOptionHash[localeCode] || (localeOptionHash[localeCode] = {})
// provided new options for this locales? merge them in
if (newFcOptions) {
fcOptions = localeOptionHash[localeCode] = mergeOptions([ fcOptions, newFcOptions ])
}
// compute locale options that weren't defined.
// always do this. newFcOptions can be undefined when initializing from i18n file,
// so no way to tell if this is an initialization or a default-setting.
momOptions = getMomentLocaleData(localeCode) // will fall back to en
$.each(momComputableOptions, function(name, func) {
if (fcOptions[name] == null) {
fcOptions[name] = (func)(momOptions, fcOptions)
}
})
// set it as the default locale for FullCalendar
globalDefaults.locale = localeCode
}
示例4: generateNavigationButtons
public generateNavigationButtons() {
const div = $('#controls-navigation');
div.empty();
const jumps = [ 100, 500, 1000 ];
$.each(jumps, (i, jump) => {
const button = $(`<button>+${jump}</button>`);
button.addClass('control-btn wide-btn nav-btn')
.addClass('wide-btn')
.click(() => {
this.controller.incrementRNG(jump);
this.selectRow(this.controller.getEncounterIndex());
});
div.append(button);
});
const undo = $('<button>Undo</button>')
.addClass('control-btn wide-btn nav-btn')
.click(() => {
this.controller.undo();
this.selectRow(this.controller.getEncounterIndex());
});
div.append(undo);
const next = $('<button>Next</button>')
.addClass('control-btn wide-btn nav-btn')
.click(() => {
this.controller.incrementFight();
this.selectRow(this.controller.getEncounterIndex());
});
div.append(next);
// this.controlContainer.append(div);
}
示例5: setTrInnerHeight
/*
Find each TRs "inner div" and sets all of their heights to the same value.
*/
setTrInnerHeight(height) {
// exclude multi-rowspans (probably done for row grouping)
$.each(this.trHash, (type, tr) => {
getOwnCells(tr).find('> div:not(.fc-cell-content):first')
.height(height)
})
}
示例6: require
require(addons, (): void => {
const cm = CodeMirror.fromTextArea($textarea.get(0), {
extraKeys: {
'Ctrl-Alt-F': (codemirror: any): void => {
codemirror.setOption('fullScreen', !codemirror.getOption('fullScreen'));
},
'Ctrl-Space': 'autocomplete',
'Esc': (codemirror: any): void => {
if (codemirror.getOption('fullScreen')) {
codemirror.setOption('fullScreen', false);
}
},
},
fullScreen: false,
lineNumbers: true,
lineWrapping: true,
mode: modeParts[modeParts.length - 1],
});
// set options
$.each(options, (key: string, value: any): void => {
cm.setOption(key, value);
});
cm.addPanel(
T3editor.createPanelNode('bottom', $textarea.attr('alt')),
{
position: 'bottom',
stable: true,
},
);
});
示例7: datepickerLocale
export function datepickerLocale(localeCode, dpLocaleCode, dpOptions) {
// get the FullCalendar internal option hash for this locale. create if necessary
let fcOptions = localeOptionHash[localeCode] || (localeOptionHash[localeCode] = {})
// transfer some simple options from datepicker to fc
fcOptions.isRTL = dpOptions.isRTL
fcOptions.weekNumberTitle = dpOptions.weekHeader
// compute some more complex options from datepicker
$.each(dpComputableOptions, function(name, func) {
fcOptions[name] = func(dpOptions)
})
let jqDatePicker = ($ as any).datepicker
// is jQuery UI Datepicker is on the page?
if (jqDatePicker) {
// Register the locale data.
// FullCalendar and MomentJS use locale codes like "pt-br" but Datepicker
// does it like "pt-BR" or if it doesn't have the locale, maybe just "pt".
// Make an alias so the locale can be referenced either way.
jqDatePicker.regional[dpLocaleCode] =
jqDatePicker.regional[localeCode] = // alias
dpOptions
// Alias 'en' to the default locale data. Do this every time.
jqDatePicker.regional.en = jqDatePicker.regional['']
// Set as Datepicker's global defaults.
jqDatePicker.setDefaults(dpOptions)
}
}
示例8:
plot.hideEvents = () => {
$.each(eventMarkers._events, (index, event) => {
event
.visual()
.getObject()
.hide();
});
};
示例9: loadStyles
static loadStyles(tag, src) {
if (Array.isArray(src)) {
$.each(src, function(k, s) {
$(tag).append($('<link/>').attr('href', s).attr('rel', 'stylesheet').attr('type', 'text/css'));
});
} else {
$(tag).append($('<link/>').attr('href', src).attr('rel', 'stylesheet').attr('type', 'text/css'));
}
}