electron/browser/api/lib/protocol.coffee
Cheng Zhao 261f50701a Add 'registered' and 'unregistered' events for protocol module.
This is only used for writing specs.
2013-08-29 20:56:25 +08:00

20 lines
574 B
CoffeeScript

protocol = process.atomBinding 'protocol'
EventEmitter = require('events').EventEmitter
protocol[key] = value for key, value of EventEmitter.prototype
protocol.RequestStringJob =
class RequestStringJob
constructor: ({mimeType, charset, data}) ->
if typeof data isnt 'string' and not data instanceof Buffer
throw new TypeError('Data should be string or Buffer')
@mimeType = mimeType ? 'text/plain'
@charset = charset ? 'UTF-8'
@data = String data
protocol.RequestFileJob =
class RequestFileJob
constructor: (@path) ->
module.exports = protocol