You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/repl/README.md
+37-28Lines changed: 37 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
@license Apache-2.0
4
4
5
-
Copyright (c) 2018 The Stdlib Authors.
5
+
Copyright (c) 2019 The Stdlib Authors.
6
6
7
7
Licensed under the Apache License, Version 2.0 (the "License");
8
8
you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ limitations under the License.
20
20
21
21
# REPL
22
22
23
-
> REPL environment.
23
+
> [REPL][@stdlib/repl/ctor] environment.
24
24
25
25
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26
26
@@ -37,23 +37,21 @@ limitations under the License.
37
37
## Usage
38
38
39
39
```javascript
40
-
varrepl=require( '@stdlib/repl' );
40
+
varREPL=require( '@stdlib/repl' );
41
41
```
42
42
43
-
#### repl( \[options], clbk )
43
+
#### REPL( \[options] )
44
44
45
-
Starts a REPL environment.
46
-
47
-
<!-- run-disable -->
45
+
Returns a [`REPL`][@stdlib/repl/ctor] instance.
48
46
49
47
```javascript
50
-
repl( onStart );
48
+
// Create a new REPL:
49
+
var repl =newREPL();
51
50
52
-
functiononStart( error, r ) {
53
-
if ( error ) {
54
-
throw error;
55
-
}
56
-
}
51
+
// ...
52
+
53
+
// Close the REPL:
54
+
repl.close();
57
55
```
58
56
59
57
</section>
@@ -77,21 +75,22 @@ function onStart( error, r ) {
77
75
<!-- eslint no-undef: "error" -->
78
76
79
77
```javascript
80
-
varrepl=require( '@stdlib/repl' );
78
+
varREPL=require( '@stdlib/repl' );
81
79
82
-
// Start the REPL:
83
-
repl( onStart );
80
+
functiononExit() {
81
+
console.log( '' );
82
+
console.log( 'REPL closed.' );
83
+
}
84
+
85
+
// Create a new REPL:
86
+
var repl =newREPL();
87
+
repl.on( 'exit', onExit );
84
88
85
-
functiononStart( error, r ) {
86
-
if ( error ) {
87
-
throw error;
88
-
}
89
-
// After the REPL has started, exit the process...
0 commit comments