Make protocol module an EventEmitter.
This commit is contained in:
parent
6915f020d9
commit
bc4201f911
1 changed files with 9 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
module.exports = process.atomBinding 'protocol'
|
bindings = process.atomBinding 'protocol'
|
||||||
|
EventEmitter = require('events').EventEmitter
|
||||||
|
|
||||||
module.exports.RequestStringJob =
|
protocol = new EventEmitter
|
||||||
|
protocol[key] = value for key, value of bindings
|
||||||
|
|
||||||
|
protocol.RequestStringJob =
|
||||||
class RequestStringJob
|
class RequestStringJob
|
||||||
constructor: ({mimeType, charset, data}) ->
|
constructor: ({mimeType, charset, data}) ->
|
||||||
if typeof data isnt 'string' and not data instanceof Buffer
|
if typeof data isnt 'string' and not data instanceof Buffer
|
||||||
|
@ -10,6 +14,8 @@ class RequestStringJob
|
||||||
@charset = charset ? 'UTF-8'
|
@charset = charset ? 'UTF-8'
|
||||||
@data = String data
|
@data = String data
|
||||||
|
|
||||||
module.exports.RequestFileJob =
|
protocol.RequestFileJob =
|
||||||
class RequestFileJob
|
class RequestFileJob
|
||||||
constructor: (@path) ->
|
constructor: (@path) ->
|
||||||
|
|
||||||
|
module.exports = protocol
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue