Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: frog/lib/node/readline.dart

Issue 9034014: Add support for the node net module. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #library('readline');
6 #import('node.dart');
7
8 // module readline
9
10 // Actual shape of result is [List<String>, String]
11 typedef List ReadlineCompleter(String linePartial);
12
13 // Actual shape of results is [List<String>, String]
14 typedef void ReadlineCompleterCallback(var unused_pass_null, List results);
15
16 typedef void ReadlineCompleterAsync(String linePartial,
17 ReadlineCompleterCallback callback);
18
19 class Readline native "require('readline')" {
20 static ReadlineInterface createInterface(ReadStream input, WriteStream output,
21 [ReadlineCompleter completer]) native;
22 static ReadlineInterface createInterfaceAsyncCompleter(ReadStream input,
23 WriteStream output, ReadlineCompleterAsync completer)
24 native "this.createInterface(input, output, completer);";
25 static int columns;
26 }
27
28 typedef void ReadlineInterfaceLineListener(String line);
29 typedef void ReadlineInterfaceCloseListener();
30 typedef void ReadlineInterfaceQuestionCallback(String answer);
31
32 class ReadlineInterface implements EventEmitter native "Readline.Interface" {
33 // EventEmitter
34 void removeAllListeners(String event)
Jennifer Messerly 2012/01/21 01:00:31 does this work as: void removeAllListeners(Strin
35 native "this.removeAllListeners(event);";
36 void setMaxListeners(num n)
37 native "this.setMaxListeners(n);";
38 var _listeners(String key)
39 native "return this.listeners(key);";
40
41 // event 'line'
42 void emitLine(String line)
43 native "this.emit('line');";
44 void addListenerLine(ReadlineInterfaceLineListener listener)
45 native "this.addListener('line', listener);";
46 void onLine(ReadlineInterfaceLineListener listener)
47 native "this.on('line', listener);";
48 void onceLine(ReadlineInterfaceLineListener listener)
49 native "this.once('line', listener);";
50 void removeListenerLine(ReadlineInterfaceLineListener listener)
51 native "this.removeListener('line', listener);";
52 List<ReadlineInterfaceLineListener> listenersLine()
53 => new _NativeListPrimitiveElement<ReadlineInterfaceLineListener>(
54 _listeners('line'));
55
56 // event 'close'
57 void emitClose()
58 native "this.emit('close');";
59 void addListenerClose(ReadlineInterfaceCloseListener listener)
60 native "this.addListener('close', listener);";
61 void onClose(ReadlineInterfaceCloseListener listener)
62 native "this.on('close', listener);";
63 void onceClose(ReadlineInterfaceCloseListener listener)
64 native "this.once('close', listener);";
65 void removeListenerClose(ReadlineInterfaceCloseListener listener)
66 native "this.removeListener('close', listener);";
67 List<ReadlineInterfaceCloseListener> listenersClose()
68 => new _NativeListPrimitiveElement<ReadlineInterfaceCloseListener>(
69 _listeners('close'));
70
71 void setPrompt(String prompt, [int length]) native;
72 void prompt() native;
73 void question(String question, ReadlineInterfaceQuestionCallback callback)
74 native;
75 void close() native;
76 void pause() native;
77 void resume() native;
78 void write(String s) native;
79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698