当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript clipboard.on函数代码示例

本文整理汇总了TypeScript中clipboard.on函数的典型用法代码示例。如果您正苦于以下问题:TypeScript on函数的具体用法?TypeScript on怎么用?TypeScript on使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了on函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: attachDomNode

export function attachDomNode(domNode: HTMLElement, callback: () => string): void {
    const clipboard = new Clipboard(domNode, {
        text: trigger => callback()
    });

    clipboard.on("success", e => {
        Tooltip.show(nlsHPCC.Copied, domNode);
        on.once(domNode, mouse.leave, () => {
            Tooltip.hide(domNode);
        });
    });

    clipboard.on("error", e => {
    });
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:15,代码来源:Clippy.ts

示例2: attach

export function attach(domID: string): void {
    const clipboard: Clipboard = new Clipboard(`#${domID}`);
    clipboard.on("success", e => {
        e.clearSelection();
        const node: HTMLElement = dom.byId(domID);
        Tooltip.show("Copied!", node);
        on.once(node, mouse.leave, () => {
            Tooltip.hide(node);
        });
    });

    clipboard.on("error", e => {
        const node: HTMLElement = dom.byId(domID);
        Tooltip.show("Press ctrl+c to copy.", node);
        on.once(node, mouse.leave, () => {
            Tooltip.hide(node);
        });
    });
}
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:19,代码来源:Clippy.ts

示例3: buildUi

    private buildUi() {
        this.registerHandlebarHelpers();
        let dataContainer = document.getElementById("data-container");
        let template = Handlebars.compile(dataContainer.innerHTML);

        let data = template(vm);
        dataContainer.innerHTML = data;

        let clipboard = new ClipboardJS(".copy-action");
        clipboard.on("error", e => {
            pbia.admin("Copy to clipboard", "Error");
            log.error("Unable to copy view configuration to the clipboard.");
        });
        clipboard.on("success", e => {
            pbia.admin("Copy to clipboard", "Success");
            log.debug("View configuration successfully copied to the clipboard.");
            e.clearSelection();
        });

        dataContainer.style.visibility = "visible";
    }
开发者ID:taarskog,项目名称:crm-powerbi-viewer,代码行数:21,代码来源:admin.ts

示例4: Clipboard

import * as Clipboard from 'clipboard';

var cb1 = new Clipboard('.btn');
var cb2 = new Clipboard(document.getElementById('id'), {
    action: elem => 'copy'
});
var cb3 = new Clipboard(document.querySelectorAll('query'), {
    text: elem => null
});
var cb4 = new Clipboard('.btn', {
    target: elem => null
});
var cb5 = new Clipboard('.btn', {
    action: elem => 'copy',
    target: elem => null
});

cb1.destroy();

cb2.on('success', function(e) {
    console.info('Action:', e.action);
    console.info('Text:', e.text);
    console.info('Trigger:', e.trigger);

    e.clearSelection();
});
cb2.on('error', function(e) { });

开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:27,代码来源:clipboard-tests.ts

示例5: ClipboardJS

import * as ClipboardJS from "clipboard";

const cb1 = new ClipboardJS(".btn");
const cb2 = new ClipboardJS(document.getElementById("id"), {
    action: elem => "copy"
});
const cb3 = new ClipboardJS(document.querySelectorAll("query"), {
    text: elem => null
});
const cb4 = new ClipboardJS(".btn", {
    target: elem => null
});
const cb5 = new ClipboardJS(".btn", {
    action: elem => "copy",
    target: elem => null
});

cb1.destroy();
ClipboardJS.isSupported();

cb2.on("success", e => {
    console.info("Action:", e.action);
    console.info("Text:", e.text);
    console.info("Trigger:", e.trigger);

    e.clearSelection();
});
cb2.on("error", e => {});
开发者ID:BernieSumption,项目名称:DefinitelyTyped,代码行数:28,代码来源:clipboard-tests.ts

示例6: _copyToClipboard

 private _copyToClipboard() {
   const clipboard = new Clipboard(this._element.nativeElement, { text: () => this.text });
   clipboard.on('success', (e) => { clipboard.destroy(); });
 }
开发者ID:daniru,项目名称:blog,代码行数:4,代码来源:clipboard.directive.ts


注:本文中的clipboard.on函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。