Skip to content

Commit

Permalink
⬆️ helloworld-sharedobj.
Browse files Browse the repository at this point in the history
  • Loading branch information
hokein committed May 21, 2016
1 parent 9b1254c commit 768fb0c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion helloworld-sharedobj/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>This demos how to get a myvar from main.js to index.html</h1>

<script>
var remote = require('electron').remote;
const {remote} = require('electron');
document.write('<p>myvar: ' + remote.getGlobal('sharedObj').myvar + '</p>');
</script>
17 changes: 7 additions & 10 deletions helloworld-sharedobj/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
'use strict';
const {app, BrowserWindow} = require('electron');

var app = require('app');
var BrowserWindow = require('browser-window');

var mainWindow = null;
let mainWindow;

global.sharedObj = {myvar: "hellofrommainjs"};

app.on('ready', function() {
mainWindow = new BrowserWindow({
height: 600,
width: 800
});
mainWindow = new BrowserWindow({
height: 600,
width: 800
});

mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.loadURL('file://' + __dirname + '/index.html');
});
2 changes: 1 addition & 1 deletion helloworld-sharedobj/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "helloworld-sharedobj",
"version": "0.0.1",
"version": "1.0.1",
"main": "main.js"
}

0 comments on commit 768fb0c

Please sign in to comment.