You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
michaelsmitha edited this page Oct 9, 2012
·
2 revisions
Clipboard API requires node-webkit >= v0.3.0
Clipboard is an abstraction of clipboard(Windows and GTK) and pasteboard(Mac), currently it only supports reading and writing plain text in the system clipboard.
Synopsis
// Load native UI libraryvargui=require('nw.gui');// We can not create a clipboard, we have to receive the system clipboardvarclipboard=gui.Clipboard.get();// Read from clipboardvartext=clipboard.get('text');console.log(text);// Or write somethingclipboard.set('I love node-webkit :)','text');// And clear it!clipboard.clear();
Reference
get()
Returns the system clipboard.
It's not possible to create a new clipboard, you can only get it from OS. And also note that the Selection Clipboard in X11 is not supported.
Clipboard.set(data, [type])
Write data to the clipboard. type specifies the mime type of the data, only text (plain text data) is supported now.
Clipboard.get([type])
Returns the data of type from clipboard. Only text (plain text data) is supported now.