Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
NW.js Essentials

You're reading from   NW.js Essentials Build native desktop applications for Windows, Mac OS, or Linux using the latest web technologies

Arrow left icon
Product type Paperback
Published in May 2015
Publisher
ISBN-13 9781785280863
Length 192 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Benoit Benoit
Author Profile Icon Benoit
Benoit
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

NW.js Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Meet NW.js FREE CHAPTER 2. NW.js Native UI APIs 3. Leveraging the Power of Node.js 4. Data Persistence Solutions and Other Browser Web APIs 5. Let's Put It All Together 6. Packaging Your Application for Distribution 7. Automated Packaging Tools 8. Let's Debug Your Application 9. Taking Your Application to the Next Level Index

The Clipboard API – accessing the system clipboard


NW.js' Clipboard API lets you read and write plain text from the system clipboard. There are three main methods to access the content of the clipboard. Clipboard.set(data) enables you to copy some text data into the clipboard, the Clipboard.get() method allows you to retrieve that data, and Clipboard.clear() allows you to clear it up. The following is a simple example:

var gui = require('nw.gui'),
  clipboard = gui.Clipboard.get();
// Copy
clipboard.set('I love NW.js :)');
// Paste
var data = clipboard.get('text');
// Clear
clipboard.clear();

Note

The NW.js Clipboard API is still pretty young. At the moment, you can only access plain text and only from the system clipboard. The selection clipboard in X11 is not supported.

Tip

In order to do cut, copy, and paste, you can rely on document.execCommand('cut'), document.execCommand('copy') and document.execCommand('paste').

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images