Added electron support as external page.

This commit is contained in:
Martin Edenhofer 2016-03-30 16:06:16 +02:00
parent fd58ac0a29
commit 64296b645d
5 changed files with 21 additions and 3 deletions

View file

@ -0,0 +1,10 @@
class Widget
constructor: ->
return if !window.require
ipcRenderer = window.require('electron').ipcRenderer
return if !ipcRenderer
App.Event.bind('online_notification_counter', (e) ->
ipcRenderer.send('set-badge', e)
)
App.Config.set('aaa_electron_events', Widget, 'Navigations')

View file

@ -114,6 +114,8 @@ class App.OnlineNotificationWidget extends App.Controller
count = '' if count is 0
$('.js-notificationsCounter').text(count)
App.Event.trigger('online_notification_counter', count.toString())
@count = count
# show mark all as read if needed

View file

@ -43,7 +43,9 @@ class App.Run extends App.Controller
App.Event.trigger(event + ':init')
widgets = App.Config.get(config)
if widgets
for key, widget of widgets
sortedKeys = Object.keys(widgets).sort()
for key in sortedKeys
widget = widgets[key]
new widget(
el: el
key: key

View file

@ -945,7 +945,9 @@ function handleOpts(opts, defs) {
parse5322.parseOneAddress = parseOneAddressSimple;
parse5322.parseAddressList = parseAddressListSimple;
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
// if electron is used, go back to non CommonJS
//if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined' && !(process && process.version && process.versions.electron)) {
module.exports = parse5322;
} else {
global.emailAddresses = parse5322;

View file

@ -14,7 +14,9 @@
(function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) {
// if electron is used, go back to non CommonJS
//if ( typeof module === "object" && typeof module.exports === "object" ) {
if ( typeof module === "object" && typeof module.exports === "object" && !(process && process.version && process.versions.electron)) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`