docs: Use <a> as example

This commit is contained in:
Cheng Zhao 2016-07-03 15:27:26 +09:00
parent b7459d50f9
commit ba1fe322e9

View file

@ -329,11 +329,14 @@ app, you need to call `webContents.startDrag(item)` API on `ondragstart` event.
In web page: In web page:
```javascript ```html
document.getElementById('targetItem').ondragstart = (event) => { <a href="#" id="drag">item</a>
event.preventDefault() <script type="text/javascript" charset="utf-8">
ipcRenderer.send('ondragstart', '/path/to/item') document.getElementById('drag').ondragstart = (event) => {
} event.preventDefault()
ipcRenderer.send('ondragstart', '/path/to/item')
}
</script>
``` ```
In the main process: In the main process: