Skip to content

Commit 000a8e4

Browse files
committed
Detect electron runtime via process.versions.electron
1 parent 7c86033 commit 000a8e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tcp-socket",
3-
"version": "0.5.6",
3+
"version": "0.5.7",
44
"main": "src/tcp-socket",
55
"description": "This shim brings the W3C Raw Socket API to node.js and Chromium. Its purpose is to enable apps to use the same api in Firefox OS, Chrome OS, and on the server.",
66
"repository": {

src/tcp-socket.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
(function(root, factory) {
2222
'use strict';
2323

24-
if (typeof define === 'function' && define.amd && typeof nodeRequire === 'undefined') {
24+
if (typeof define === 'function' && define.amd) {
2525
// amd
2626
define(['tcp-socket-tls'], factory.bind(null, navigator));
2727
} else if (typeof exports === 'object' && typeof navigator !== 'undefined') {
28-
if (typeof process !== 'undefined') {
28+
if (process.versions.electron) {
2929
// common.js for electron
30-
module.exports = factory(null, null, require('net'), require('tls'));
30+
module.exports = factory(navigator, null, require('net'), require('tls'));
3131
} else {
3232
// common.js for browserify apps with native socket support
3333
module.exports = factory(navigator, require('./tcp-socket-tls'));

0 commit comments

Comments
 (0)