
Image Support for the Async Clipboard API - feross
https://developers.google.com/web/updates/2019/07/image-support-for-async-clipboard
======
opusonline
I like it!

Here's something convenient :D

    
    
        class ClipboardItemList extends Array {
            add(content, type) {
                let entry = {};
                if (typeof content === 'string' && type.startsWith('text/')) {
                    content = new Blob([content], {'type': type});
                }
                if (!(content instanceof Blob)) {
                    throw new TypeError('Data must be a Blob');
                }
                if (!type) {
                    type = content.type || 'application/octet-stream';
                }
                entry[type] = content;
                this.push(new ClipboardItem(entry));
                return this;
            }
        }
    
        let items = new ClipboardItemList();
        items.add(blob);
        items.add('test-image.png', 'text/plain');
        navigator.clipboard.write(items).then(() => log('yeah!'), (err) => log(err));

