Created
September 1, 2015 21:13
-
-
Save etyp/2d9b2f64e845105c4835 to your computer and use it in GitHub Desktop.
An example of checking is meteor is running with electron or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.isElectron = false; | |
if (Meteor.isClient) { | |
Meteor.isElectron = (typeof window.require !== 'undefined'); | |
} | |
if (Meteor.isElectron) { | |
console.log("Running on desktop"); | |
var ipc = window.require('ipc'); | |
Template.hello.events({ | |
'click button': function (event) { | |
// Prevent default browser form submit | |
//event.preventDefault(); | |
console.log("clicking on button"); | |
// Send ipc event | |
ipc.send('new-file', { fileName: "name", text: "text" }); | |
} | |
}); | |
} | |
if (Meteor.isServer) { | |
Meteor.startup(function () { | |
console.log('Meteors app started.'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment