本文整理汇总了TypeScript中@ephox/katamari.Future.pure方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Future.pure方法的具体用法?TypeScript Future.pure怎么用?TypeScript Future.pure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Future
的用法示例。
在下文中一共展示了Future.pure方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
validate: (input) => {
const inputValue = Representing.getValue(input);
// Consider empty strings valid colours
if (inputValue.length === 0) {
return Future.pure(Result.value(true));
} else {
const span = Element.fromTag('span');
Css.set(span, 'background-color', inputValue);
const res = Css.getRaw(span, 'background-color').fold(
// TODO: Work out what we want to do here.
() => Result.error('blah'),
(_) => Result.value(inputValue)
);
return Future.pure(res);
}
}
示例2: getRoot
const validatingBehaviours = spec.validation.map((vl) => {
return Invalidating.config({
getRoot(input) {
return Traverse.parent(input.element());
},
invalidClass: 'tox-invalid',
validator: {
validate(input) {
const v = Representing.getValue(input);
const result = vl.validator(v);
return Future.pure(result === true ? Result.value(v) : Result.error(result));
},
validateOnLoad: vl.validateOnLoad
}
});
}).toArray();
示例3: function
const updateFixed = function (element, property, winY, offsetY) {
const destination = winY + offsetY;
Css.set(element, property, destination + 'px');
return Future.pure(offsetY);
};
示例4:
fetch: (input) => {
const value = Representing.getValue(input);
const items = spec.getItems(value);
const tdata = NestedMenus.build(items, ItemResponse.BUBBLE_TO_SANDBOX, backstage);
return Future.pure(tdata);
},
示例5:
getUrlPicker: (filetype) => Option.some((entry: UrlData) => {
return Future.pure(entry);
})
示例6:
getUrlPicker: (filetype) => Option.some((entry: UrlData) => {
store.adder('urlpicker')();
return Future.pure({ value: 'http://tiny.cloud', meta: { before: entry.value } });
})
示例8: getItems
fetch: (input: AlloyComponent) => {
const items = getItems(spec.filetype, input, urlBackstage);
const tdata = NestedMenus.build(items, ItemResponse.BUBBLE_TO_SANDBOX, backstage);
return Future.pure(tdata);
},