Merge pull request #326 from jcanaway/patch-1
Updated example of implementing a protocol.
This commit is contained in:
commit
a0e1174304
1 changed files with 9 additions and 4 deletions
|
@ -7,10 +7,15 @@ An example of implementing a protocol that has the same effect with the
|
||||||
`file://` protocol:
|
`file://` protocol:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var protocol = require('protocol');
|
var app = require('app'),
|
||||||
protocol.registerProtocol('atom', function(request) {
|
path = require('path');
|
||||||
var path = request.url.substr(7)
|
|
||||||
return new protocol.RequestFileJob(path);
|
app.on('will-finish-launching', function() {
|
||||||
|
var protocol = require('protocol');
|
||||||
|
protocol.registerProtocol('atom', function(request) {
|
||||||
|
var url = request.url.substr(7)
|
||||||
|
return new protocol.RequestFileJob(path.normalize(__dirname + '/' + url));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue