本文整理汇总了TypeScript中dnd-core.DragDropManager.getRegistry方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DragDropManager.getRegistry方法的具体用法?TypeScript DragDropManager.getRegistry怎么用?TypeScript DragDropManager.getRegistry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dnd-core.DragDropManager
的用法示例。
在下文中一共展示了DragDropManager.getRegistry方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
export default function registerTarget<Context>(
type: TargetType,
target: DropTarget,
manager: DragDropManager<Context>,
): [Identifier, Unsubscribe] {
const registry = manager.getRegistry()
const targetId = registry.addTarget(type, target)
return [targetId, () => registry.removeTarget(targetId)]
}
示例2:
export default function registerSource<Context>(
type: SourceType,
source: DragSource,
manager: DragDropManager<Context>,
): [Identifier, Unsubscribe] {
const registry = manager.getRegistry()
const sourceId = registry.addSource(type, source)
return [sourceId, () => registry.removeSource(sourceId)]
}
示例3: registerSource
export default function registerSource(type: any, source: DragSource, manager: DragDropManager<any>) {
const registry = manager.getRegistry();
const sourceId = registry.addSource(type, source);
function unregisterSource() {
registry.removeSource(sourceId);
}
return {
handlerId: sourceId,
unregister: unregisterSource,
};
}
示例4: registerTarget
export default function registerTarget(type: any, target: DropTarget, manager: DragDropManager<any>) {
const registry = manager.getRegistry();
const targetId = registry.addTarget(type, target);
function unregisterTarget() {
registry.removeTarget(targetId);
}
return {
handlerId: targetId,
unregister: unregisterTarget,
};
}
示例5: unregisterTarget
export default function registerTarget<Context>(
type: string,
target: DropTarget,
manager: DragDropManager<Context>,
): { handlerId: string; unregister: Unsubscribe } {
const registry = manager.getRegistry()
const targetId = registry.addTarget(type, target)
function unregisterTarget() {
registry.removeTarget(targetId)
}
return {
handlerId: targetId,
unregister: unregisterTarget,
}
}
示例6: unregisterSource
export default function registerSource<Context>(
type: string,
source: DragSource,
manager: DragDropManager<Context>,
): {
handlerId: string
unregister: Unsubscribe
} {
const registry = manager.getRegistry()
const sourceId = registry.addSource(type, source)
function unregisterSource() {
registry.removeSource(sourceId)
}
return {
handlerId: sourceId,
unregister: unregisterSource,
}
}