Skip to content

Commit e0f28d3

Browse files
committed
Export constructor
1 parent 7d92a2c commit e0f28d3

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

readme.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ This is a part of [node-inspector](http://github.com/node-inspector/node-inspect
1111
```
1212
npm install v8-debug
1313
```
14+
15+
## Usage
16+
```js
17+
var debug = require('v8-debug')();
18+
```
19+
1420
## API
1521

1622
### registerCommand(name, callback)
@@ -109,7 +115,7 @@ Experimental method for registering WebKit protocol handlers
109115

110116
Simple console.log checking
111117
```js
112-
var debug = require('v8-debug');
118+
var debug = require('v8-debug')();
113119

114120
debug.registerEvent('console.log');
115121

test/injected-script-source.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var expect = require('chai').expect;
2-
var debug = require('../');
2+
var debug = require('../')();
33
var NODE_NEXT = require('../tools/NODE_NEXT.js');
44

55
if (!NODE_NEXT) return;

test/v8-debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var expect = require('chai').expect,
2-
v8debug = require('../');
2+
v8debug = require('../')();
33

44
var NODE_NEXT = require('../tools/NODE_NEXT');
55

v8-debug.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ var overrides = {
103103

104104
inherits(V8Debug, EventEmitter);
105105
function V8Debug() {
106+
if (!(this instanceof V8Debug)) return new V8Debug();
107+
106108
this._webkitProtocolEnabled = false;
107109

108110
// NOTE: Call `_setDebugEventListener` before all other changes in Debug Context.
@@ -351,4 +353,4 @@ V8Debug.prototype.registerAgentCommand = function(command, parameters, callback)
351353
throw new Error('Use "enableWebkitProtocol" before using this method');
352354
};
353355

354-
module.exports = new V8Debug();
356+
module.exports = V8Debug;

0 commit comments

Comments
 (0)