Emit Date object in C++ directly

This commit is contained in:
Cheng Zhao 2015-10-23 14:58:19 +08:00
parent a3f62da615
commit 85c84a0eb0
2 changed files with 27 additions and 14 deletions

View file

@ -1,15 +1,12 @@
switch process.platform
when 'win32'
autoUpdater = require './auto-updater/auto-updater-win'
else
# take the default binding for the current platform
autoUpdater = process.atomBinding('auto_updater').autoUpdater
EventEmitter = require('events').EventEmitter
autoUpdater.__proto__ = EventEmitter.prototype
if process.platform is 'win32'
module.exports = require './auto-updater/auto-updater-win'
return
autoUpdater.on 'update-downloaded-raw', (args...) ->
args[3] = new Date(args[3]) # releaseDate
@emit 'update-downloaded', args..., => @quitAndInstall()
# Implementation on OS X.
autoUpdater = process.atomBinding('auto_updater').autoUpdater
EventEmitter = require('events').EventEmitter
autoUpdater.__proto__ = EventEmitter.prototype
autoUpdater.quitAndInstall = ->
# If we don't have any window then quitAndInstall immediately.