~james-page/ubuntu/precise/nodejs/0.6.x-merge

« back to all changes in this revision

Viewing changes to doc/api/api/events.json

  • Committer: James Page
  • Date: 2012-03-30 12:09:16 UTC
  • mfrom: (7.1.23 sid)
  • Revision ID: james.page@canonical.com-20120330120916-40hfu9o00qr5t87b
* Merge from Debian unstable:
  - New upstream release (LP: #892034).
  - This package is x86/arm only. Update control to match
  - d/patches/2009_increase_test_timeout.patch: Increased default test
    timeout from 60 to 120 seconds to support reliable execution of all
    tests on armhf/armel architectures.
  - d/patches/2005_expected_failing_tests.patch: 
    - Allow racey tests to fail: test-cluster-kill-workers,
      test-child-process-fork2 
    - Allow test-fs-watch to fail as LP buildd's don't support
      inotify.
    - Revert all other Ubuntu changes as no longer required.
* Update Standards-Version to 3.9.3.
* Patch wscript to enable build on mipsel arch, libv8 being available.
  Upstream does not support that arch, failure expected.
* test-cluster-kill-workers is expected to fail on armhf,
  Bug#660802 will be closed when test pass.
* test-buffer is expected to fail on armel,
  Bug#660800 will be closed when test pass.
* Add epoch to dependency on libev >= 1:4.11. Closes: bug#658441.
* Remove tools/doc because node-doc-generator has no license for now.
* Add copyright for doc/sh* files (shjs).
* source.lintian-overrides : source-contains-waf-binary tools/node-waf
  it is simply not the case here.
* test-stream-pipe-multi expected to timeout sometimes on busy builds. 
* New upstream release.
* Remove upstream patches.
* test-dgram-pingpong expected to timeout, the test itself is buggy.
* test-buffer expected to fail on armel, allow building package to make
  it easier to find the cause of the failure.
  Closes: bug#639636.
* Expect tests dgram-multicast and broadcast to fail.
  debian/patches/2005_expected_failing_tests.patch
* Drop dpkg-source local-options: Defaults since dpkg-source 1.16.1.
* New upstream release.
* Depend on libev-dev 4.11, see bug#657080.
* Bump dependency on openssl to 1.0.0g.
* Remove useless uv_loop_refcount from libuv,
  refreshed 2009_fix_shared_ev.patch.
* Apply to upstream patches landed after 0.6.10 release,
  to fix debugger repl and http client.
* New upstream release. Closes:bug#650661
* Repackage to remove non-dfsg font files ./deps/npm/html/*/*.ttf
* Remove unneeded bundled dependencies: lighter tarball,
  debian/copyright is easier to maintain.
* Drop unneeded build-dependency on scons.
* Depend on zlib1g, libc-ares, libev.
  Patches done to support building with those shared libs.
* Fix DEB_UPSTREAM_URL in debian/rules, and debian/watch.
* nodejs.pc file for pkgconfig is no more available.
* Build-depend on procps package, a test is using /bin/ps.
* Refreshed debian/patches/2005_expected_failing_tests.patch,
  only for tests that need networking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
  "source": "doc/api/events.markdown",
 
3
  "modules": [
 
4
    {
 
5
      "textRaw": "Events",
 
6
      "name": "Events",
 
7
      "type": "module",
 
8
      "desc": "<p>Many objects in Node emit events: a <code>net.Server</code> emits an event each time\na peer connects to it, a <code>fs.readStream</code> emits an event when the file is\nopened. All objects which emit events are instances of <code>events.EventEmitter</code>.\nYou can access this module by doing: <code>require(&quot;events&quot;);</code>\n\n</p>\n<p>Typically, event names are represented by a camel-cased string, however,\nthere aren&apos;t any strict restrictions on that, as any string will be accepted.\n\n</p>\n<p>Functions can then be attached to objects, to be executed when an event\nis emitted. These functions are called <em>listeners</em>.\n\n\n</p>\n",
 
9
      "classes": [
 
10
        {
 
11
          "textRaw": "Class: events.EventEmitter",
 
12
          "type": "class",
 
13
          "name": "events.EventEmitter",
 
14
          "desc": "<p>To access the EventEmitter class, <code>require(&apos;events&apos;).EventEmitter</code>.\n\n</p>\n<p>When an <code>EventEmitter</code> instance experiences an error, the typical action is\nto emit an <code>&apos;error&apos;</code> event.  Error events are treated as a special case in node.\nIf there is no listener for it, then the default action is to print a stack\ntrace and exit the program.\n\n</p>\n<p>All EventEmitters emit the event <code>&apos;newListener&apos;</code> when new listeners are\nadded.\n\n</p>\n",
 
15
          "methods": [
 
16
            {
 
17
              "textRaw": "emitter.addListener(event, listener)",
 
18
              "type": "method",
 
19
              "name": "addListener",
 
20
              "desc": "<p>Adds a listener to the end of the listeners array for the specified event.\n\n</p>\n<pre><code>server.on(&apos;connection&apos;, function (stream) {\n  console.log(&apos;someone connected!&apos;);\n});</code></pre>\n",
 
21
              "signatures": [
 
22
                {
 
23
                  "params": [
 
24
                    {
 
25
                      "name": "event"
 
26
                    },
 
27
                    {
 
28
                      "name": "listener"
 
29
                    }
 
30
                  ]
 
31
                },
 
32
                {
 
33
                  "params": [
 
34
                    {
 
35
                      "name": "event"
 
36
                    },
 
37
                    {
 
38
                      "name": "listener"
 
39
                    }
 
40
                  ]
 
41
                }
 
42
              ]
 
43
            },
 
44
            {
 
45
              "textRaw": "emitter.on(event, listener)",
 
46
              "type": "method",
 
47
              "name": "on",
 
48
              "desc": "<p>Adds a listener to the end of the listeners array for the specified event.\n\n</p>\n<pre><code>server.on(&apos;connection&apos;, function (stream) {\n  console.log(&apos;someone connected!&apos;);\n});</code></pre>\n",
 
49
              "signatures": [
 
50
                {
 
51
                  "params": [
 
52
                    {
 
53
                      "name": "event"
 
54
                    },
 
55
                    {
 
56
                      "name": "listener"
 
57
                    }
 
58
                  ]
 
59
                }
 
60
              ]
 
61
            },
 
62
            {
 
63
              "textRaw": "emitter.once(event, listener)",
 
64
              "type": "method",
 
65
              "name": "once",
 
66
              "desc": "<p>Adds a <strong>one time</strong> listener for the event. This listener is\ninvoked only the next time the event is fired, after which\nit is removed.\n\n</p>\n<pre><code>server.once(&apos;connection&apos;, function (stream) {\n  console.log(&apos;Ah, we have our first user!&apos;);\n});</code></pre>\n",
 
67
              "signatures": [
 
68
                {
 
69
                  "params": [
 
70
                    {
 
71
                      "name": "event"
 
72
                    },
 
73
                    {
 
74
                      "name": "listener"
 
75
                    }
 
76
                  ]
 
77
                }
 
78
              ]
 
79
            },
 
80
            {
 
81
              "textRaw": "emitter.removeListener(event, listener)",
 
82
              "type": "method",
 
83
              "name": "removeListener",
 
84
              "desc": "<p>Remove a listener from the listener array for the specified event.\n<strong>Caution</strong>: changes array indices in the listener array behind the listener.\n\n</p>\n<pre><code>var callback = function(stream) {\n  console.log(&apos;someone connected!&apos;);\n};\nserver.on(&apos;connection&apos;, callback);\n// ...\nserver.removeListener(&apos;connection&apos;, callback);</code></pre>\n",
 
85
              "signatures": [
 
86
                {
 
87
                  "params": [
 
88
                    {
 
89
                      "name": "event"
 
90
                    },
 
91
                    {
 
92
                      "name": "listener"
 
93
                    }
 
94
                  ]
 
95
                }
 
96
              ]
 
97
            },
 
98
            {
 
99
              "textRaw": "emitter.removeAllListeners([event])",
 
100
              "type": "method",
 
101
              "name": "removeAllListeners",
 
102
              "desc": "<p>Removes all listeners, or those of the specified event.\n\n\n</p>\n",
 
103
              "signatures": [
 
104
                {
 
105
                  "params": [
 
106
                    {
 
107
                      "name": "event",
 
108
                      "optional": true
 
109
                    }
 
110
                  ]
 
111
                }
 
112
              ]
 
113
            },
 
114
            {
 
115
              "textRaw": "emitter.setMaxListeners(n)",
 
116
              "type": "method",
 
117
              "name": "setMaxListeners",
 
118
              "desc": "<p>By default EventEmitters will print a warning if more than 10 listeners are\nadded for a particular event. This is a useful default which helps finding memory leaks.\nObviously not all Emitters should be limited to 10. This function allows\nthat to be increased. Set to zero for unlimited.\n\n\n</p>\n",
 
119
              "signatures": [
 
120
                {
 
121
                  "params": [
 
122
                    {
 
123
                      "name": "n"
 
124
                    }
 
125
                  ]
 
126
                }
 
127
              ]
 
128
            },
 
129
            {
 
130
              "textRaw": "emitter.listeners(event)",
 
131
              "type": "method",
 
132
              "name": "listeners",
 
133
              "desc": "<p>Returns an array of listeners for the specified event. This array can be\nmanipulated, e.g. to remove listeners.\n\n</p>\n<pre><code>server.on(&apos;connection&apos;, function (stream) {\n  console.log(&apos;someone connected!&apos;);\n});\nconsole.log(util.inspect(server.listeners(&apos;connection&apos;))); // [ [Function] ]</code></pre>\n",
 
134
              "signatures": [
 
135
                {
 
136
                  "params": [
 
137
                    {
 
138
                      "name": "event"
 
139
                    }
 
140
                  ]
 
141
                }
 
142
              ]
 
143
            },
 
144
            {
 
145
              "textRaw": "emitter.emit(event, [arg1], [arg2], [...])",
 
146
              "type": "method",
 
147
              "name": "emit",
 
148
              "desc": "<p>Execute each of the listeners in order with the supplied arguments.\n\n</p>\n",
 
149
              "signatures": [
 
150
                {
 
151
                  "params": [
 
152
                    {
 
153
                      "name": "event"
 
154
                    },
 
155
                    {
 
156
                      "name": "arg1",
 
157
                      "optional": true
 
158
                    },
 
159
                    {
 
160
                      "name": "arg2",
 
161
                      "optional": true
 
162
                    },
 
163
                    {
 
164
                      "name": "...",
 
165
                      "optional": true
 
166
                    }
 
167
                  ]
 
168
                }
 
169
              ]
 
170
            }
 
171
          ],
 
172
          "events": [
 
173
            {
 
174
              "textRaw": "Event: 'newListener'",
 
175
              "type": "event",
 
176
              "name": "newListener",
 
177
              "params": [],
 
178
              "desc": "<p>This event is emitted any time someone adds a new listener.\n</p>\n"
 
179
            }
 
180
          ]
 
181
        }
 
182
      ]
 
183
    }
 
184
  ]
 
185
}