@creately/clipboard
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    @creately/clipboard

    Clipboard service which uses system clipboard as primary and local storage as fallback.

    Support: All browsers and Embedded( iframe ).

    Install

    $ npm install @creately/clipboard
    

    Usage

    import { Clipboard } from '@creately/clipboard';
     
    new Clipboard().copy('your data');
     
    console.log(await new Clipboard().paste());
    //=> 'your data'

    Usage with Angular

    // Import it in module
    import { Clipboard } from '@creately/clipboard';
     
    // Add this in your module.
    { provide: Clipboard, useFactory: () => new Clipboard() },
     
    // Add clipboard in constructor.
    class MyClass {
      constructor( private clipboard: Clipboard ) {}
      // ...
     
      public doCopy( data ) {
        this.clipboard.copy( data );  
      }
     
      public async doPaste() {
        return await this.clipboard.paste();
      }
    }

    API

    .copy(text)

    Copy given text clipboard asynchronously. Returns a Promise.

    text

    Type: string

    The text to write to the clipboard.

    .paste()

    Paste from the clipboard asynchronously. Returns a Promise.

    Keywords

    none

    Install

    npm i @creately/clipboard

    DownloadsWeekly Downloads

    6

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    11.4 kB

    Total Files

    9

    Last publish

    Collaborators

    • damithcgx
    • linatrefai
    • sajeeva
    • rumaizcinergix
    • thisunravisara
    • nuwacgx
    • jziegelaar
    • chandika
    • vinochs
    • shashik_thiwanka
    • sasindu