docs: Update codes in docs to use require('electron')

This commit is contained in:
Cheng Zhao 2015-11-12 21:20:09 +08:00
parent 8b2942c279
commit eac2e7cc61
32 changed files with 134 additions and 157 deletions

View file

@ -4,7 +4,7 @@ The `clipboard` module provides methods to perform copy and paste operations.
The following example shows how to write a string to the clipboard:
```javascript
var clipboard = require('clipboard');
const clipboard = require('electron').clipboard;
clipboard.writeText('Example String');
```
@ -12,7 +12,6 @@ On X Window systems, there is also a selection clipboard. To manipulate it
you need to pass `selection` to each method:
```javascript
var clipboard = require('clipboard');
clipboard.writeText('Example String', 'selection');
console.log(clipboard.readText('selection'));
```
@ -82,7 +81,6 @@ Returns an array of supported formats for the clipboard `type`.
Returns whether the clipboard supports the format of specified `data`.
```javascript
var clipboard = require('clipboard');
console.log(clipboard.has('<p>selection</p>'));
```
@ -102,7 +100,6 @@ Reads `data` from the clipboard.
* `type` String (optional)
```javascript
var clipboard = require('clipboard');
clipboard.write({text: 'test', html: "<b>test</b>"});
```
Writes `data` to the clipboard.