本文整理汇总了TypeScript中@ephox/alloy.NativeEvents.touchstart方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NativeEvents.touchstart方法的具体用法?TypeScript NativeEvents.touchstart怎么用?TypeScript NativeEvents.touchstart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/alloy.NativeEvents
的用法示例。
在下文中一共展示了NativeEvents.touchstart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
//.........这里部分代码省略.........
onTab (dialog/*, specialInfo */) {
navigate(dialog, +1);
return Option.some(true);
},
onShiftTab (dialog/*, specialInfo */) {
navigate(dialog, -1);
return Option.some(true);
}
}),
AddEventsBehaviour.config(formAdhocEvents, [
AlloyEvents.runOnAttached(function (dialog, simulatedEvent) {
// Reset state to first screen.
resetState();
const dotitems = memDots.get(dialog);
Highlighting.highlightFirst(dotitems);
spec.getInitialValue(dialog).each(function (v) {
Representing.setValue(dialog, v);
});
}),
AlloyEvents.runOnExecute(spec.onExecute),
AlloyEvents.run(NativeEvents.transitionend(), function (dialog, simulatedEvent) {
const event = simulatedEvent.event() as any;
if (event.raw().propertyName === 'left') {
focusInput(dialog);
}
}),
AlloyEvents.run(navigateEvent, function (dialog, simulatedEvent) {
const event = simulatedEvent.event() as any;
const direction = event.direction();
navigate(dialog, direction);
})
])
])
};
})
);
const memDots = Memento.record({
dom: UiDomFactory.dom('<div class="${prefix}-dot-container"></div>'),
behaviours: Behaviour.derive([
Highlighting.config({
highlightClass: Styles.resolve('dot-active'),
itemClass: Styles.resolve('dot-item')
})
]),
components: Arr.bind(spec.fields, function (_f, i) {
return i <= spec.maxFieldIndex ? [
UiDomFactory.spec('<div class="${prefix}-dot-item ${prefix}-icon-full-dot ${prefix}-icon"></div>')
] : [];
})
});
return {
dom: UiDomFactory.dom('<div class="${prefix}-serializer-wrapper"></div>'),
components: [
memForm.asSpec(),
memDots.asSpec()
],
behaviours: Behaviour.derive([
Keying.config({
mode: 'special',
focusIn (wrapper) {
const form = memForm.get(wrapper);
Keying.focusIn(form);
}
}),
AddEventsBehaviour.config(wrapperAdhocEvents, [
AlloyEvents.run(NativeEvents.touchstart(), function (wrapper, simulatedEvent) {
const event = simulatedEvent.event() as any;
spec.state.dialogSwipeState.set(
SwipingModel.init(event.raw().touches[0].clientX)
);
}),
AlloyEvents.run(NativeEvents.touchmove(), function (wrapper, simulatedEvent) {
const event = simulatedEvent.event() as any;
spec.state.dialogSwipeState.on(function (state) {
simulatedEvent.event().prevent();
spec.state.dialogSwipeState.set(
SwipingModel.move(state, event.raw().touches[0].clientX)
);
});
}),
AlloyEvents.run(NativeEvents.touchend(), function (wrapper/*, simulatedEvent */) {
spec.state.dialogSwipeState.on(function (state) {
const dialog = memForm.get(wrapper);
// Confusing
const direction = -1 * SwipingModel.complete(state);
navigate(dialog, direction);
});
})
])
])
};
};