docs: Update codes in docs to use require('electron')
This commit is contained in:
parent
8b2942c279
commit
eac2e7cc61
32 changed files with 134 additions and 157 deletions
|
@ -7,11 +7,12 @@ An example of implementing a protocol that has the same effect as the
|
|||
`file://` protocol:
|
||||
|
||||
```javascript
|
||||
var app = require('app');
|
||||
var path = require('path');
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const path = require('path');
|
||||
|
||||
app.on('ready', function() {
|
||||
var protocol = require('protocol');
|
||||
var protocol = electron.protocol;
|
||||
protocol.registerFileProtocol('atom', function(request, callback) {
|
||||
var url = request.url.substr(7);
|
||||
callback({path: path.normalize(__dirname + '/' + url)});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue