本文整理汇总了TypeScript中@ephox/katamari.Fun.constant方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Fun.constant方法的具体用法?TypeScript Fun.constant怎么用?TypeScript Fun.constant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Fun
的用法示例。
在下文中一共展示了Fun.constant方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: load
return Future.nu(function (resolve) {
load(
url,
Fun.compose(resolve, Fun.constant(Result.value(url))),
Fun.compose(resolve, Fun.constant(Result.error(url)))
);
});
示例2: function
const actionName = function (action) {
return action.fold(
Fun.constant('remove'),
Fun.constant('moveToElement'),
Fun.constant('moveToPosition')
);
};
示例3: function
const wrapEvent = function (event) {
// IE9 minimum
const target = Element.fromDom(event.target);
const stop = function () {
event.stopPropagation();
};
const prevent = function () {
event.preventDefault();
};
const kill = Fun.compose(prevent, stop); // more of a sequence than a compose, but same effect
// FIX: Don't just expose the raw event. Need to identify what needs standardisation.
return {
target: Fun.constant(target),
x: Fun.constant(event.x),
y: Fun.constant(event.y),
stop,
prevent,
kill,
raw: Fun.constant(event)
};
};
示例4: function
const selection = function (cell, selections) {
return SelectionTypes.cata(selections.get(),
Fun.constant([]),
Fun.identity,
Fun.constant([ cell ])
);
};
示例5: function
const locationName = function (location) {
return location.fold(
Fun.constant('before'),
Fun.constant('start'),
Fun.constant('end'),
Fun.constant('after')
);
};
示例6: function
const getName = function (location) {
return location.fold(
Fun.constant('before'), // Before
Fun.constant('start'), // Start
Fun.constant('end'), // End
Fun.constant('after') // After
);
};
示例7: function
const isInsideAnchor = function (location) {
return location.fold(
Fun.constant(false),
isAnchorLink,
isAnchorLink,
Fun.constant(false)
);
};
示例8: function
const isAtStartOrEnd = function (location) {
return location.fold(
Fun.constant(false), // Before
Fun.constant(true), // Start
Fun.constant(true), // End
Fun.constant(false) // After
);
};
示例9:
return Option.from(rects[0]).bind(function (rect) {
const viewTop = rect.top() - socket.dom().scrollTop;
const outside = viewTop > outerWindow.innerHeight + VIEW_MARGIN || viewTop < -VIEW_MARGIN;
return outside ? Option.some({
top: Fun.constant(viewTop),
bottom: Fun.constant(viewTop + rect.height())
}) : Option.none();
});
示例10: function
const forMenu = function (selections, table, cell) {
return {
element: Fun.constant(cell),
mergable: Fun.constant(CellOperations.mergable(table, selections)),
unmergable: Fun.constant(CellOperations.unmergable(cell, selections)),
selection: Fun.constant(CellOperations.selection(cell, selections))
};
};