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

Side by Side Diff: frog/lib/node/cluster.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('cluster');
6 #import('node.dart');
7
8 // module cluster
9
10 /**
11 * Note: cluster.fork will fail when run from frogsh. It will succeed
12 * when dart code is compiled to JavaScript, and the resulting
13 * JavaScript is run from node.js.
Jennifer Messerly 2012/01/21 01:00:31 nice comment. I think this is an issue with our pa
14 */
15
16 typedef void ClusterDeathListener(ChildProcess cp);
17
18 class cluster native "require('cluster')" {
19 static void fork() native;
20 static bool isMaster;
21 static bool isWorker;
22
23 // EventEmitter
24 static void removeAllListeners(String event) native;
25 static void setMaxListeners(num n) native;
26 var _listeners(String key)
27 native "return this.listeners(key);";
28
29 // Death event
30 static void emitDeath(ChildProcess cp)
31 native "this.emit('death', cp);";
32 static void addListenerDeath(ClusterDeathListener listener)
33 native "this.addListener('death', listener);";
34 static void onDeath(ClusterDeathListener listener)
35 native "this.on('death', listener);";
36 static void onceDeath(ClusterDeathListener listener)
37 native "this.once('death', listener);";
38 static void removeListenerDeath(ClusterDeathListener listener)
39 native "this.removeListener('death', listener);";
40 static List<ClusterDeathListener> listenersDeath()
41 => new _NativeListPrimitiveElement<ClusterDeathListener>(_listeners(
42 'death'));
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698