UNPKG

11.7 kBJSONView Raw
1{
2 "classes": {
3 "CompositeDisposable": {
4 "name": "CompositeDisposable",
5 "filename": "src/composite-disposable.coffee",
6 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/composite-disposable.coffee#L4",
7 "sections": [
8 {
9 "name": "Construction and Destruction",
10 "description": ""
11 },
12 {
13 "name": "Managing Disposables",
14 "description": ""
15 }
16 ],
17 "classMethods": [],
18 "instanceMethods": [
19 {
20 "name": "constructor",
21 "sectionName": "Construction and Destruction",
22 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/composite-disposable.coffee#L12",
23 "visibility": "Public",
24 "summary": "Construct an instance, optionally with one or more disposables ",
25 "description": "Construct an instance, optionally with one or more disposables "
26 },
27 {
28 "name": "dispose",
29 "sectionName": "Construction and Destruction",
30 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/composite-disposable.coffee#L19",
31 "visibility": "Public",
32 "summary": "Dispose all disposables added to this composite disposable.",
33 "description": "Dispose all disposables added to this composite disposable.\n\nIf this object has already been disposed, this method has no effect. "
34 },
35 {
36 "name": "add",
37 "sectionName": "Managing Disposables",
38 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/composite-disposable.coffee#L35",
39 "visibility": "Public",
40 "summary": "Add a disposable to be disposed when the composite is disposed.",
41 "description": "Add a disposable to be disposed when the composite is disposed.\n\nIf this object has already been disposed, this method has no effect.",
42 "arguments": [
43 {
44 "name": "disposable",
45 "description": "{Disposable} instance or any object with a `.dispose()` method. ",
46 "type": "Disposable",
47 "isOptional": false
48 }
49 ]
50 },
51 {
52 "name": "remove",
53 "sectionName": "Managing Disposables",
54 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/composite-disposable.coffee#L43",
55 "visibility": "Public",
56 "summary": "Remove a previously added disposable.",
57 "description": "Remove a previously added disposable.",
58 "arguments": [
59 {
60 "name": "disposable",
61 "description": "{Disposable} instance or any object with a `.dispose()` method. ",
62 "type": "Disposable",
63 "isOptional": false
64 }
65 ]
66 },
67 {
68 "name": "clear",
69 "sectionName": "Managing Disposables",
70 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/composite-disposable.coffee#L49",
71 "visibility": "Public",
72 "summary": "Clear all disposables. They will not be disposed by the next call\nto dispose. ",
73 "description": "Clear all disposables. They will not be disposed by the next call\nto dispose. "
74 }
75 ],
76 "classProperties": [],
77 "instanceProperties": [],
78 "visibility": "Essential",
79 "summary": "An object that aggregates multiple {Disposable} instances together\ninto a single disposable, so they can all be disposed as a group. ",
80 "description": "An object that aggregates multiple {Disposable} instances together\ninto a single disposable, so they can all be disposed as a group. "
81 },
82 "Disposable": {
83 "name": "Disposable",
84 "filename": "src/disposable.coffee",
85 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/disposable.coffee#L6",
86 "sections": [
87 {
88 "name": "Construction and Destruction",
89 "description": ""
90 }
91 ],
92 "classMethods": [],
93 "instanceMethods": [
94 {
95 "name": "constructor",
96 "sectionName": "Construction and Destruction",
97 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/disposable.coffee#L17",
98 "visibility": "Public",
99 "summary": "Construct a Disposable",
100 "description": "Construct a Disposable",
101 "arguments": [
102 {
103 "name": "disposalAction",
104 "description": "An action to perform when {::dispose} is called for the first time. ",
105 "type": null,
106 "isOptional": false
107 }
108 ]
109 },
110 {
111 "name": "dispose",
112 "sectionName": "Construction and Destruction",
113 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/disposable.coffee#L24",
114 "visibility": "Public",
115 "summary": "Perform the disposal action, indicating that the resource associated\nwith this disposable is no longer needed.",
116 "description": "Perform the disposal action, indicating that the resource associated\nwith this disposable is no longer needed.\n\nYou can call this method more than once, but the disposal action will only\nbe performed the first time. "
117 }
118 ],
119 "classProperties": [],
120 "instanceProperties": [],
121 "visibility": "Essential",
122 "summary": "A handle to a resource that can be disposed. For example,\n{Emitter::on} returns disposables representing subscriptions. ",
123 "description": "A handle to a resource that can be disposed. For example,\n{Emitter::on} returns disposables representing subscriptions. "
124 },
125 "Emitter": {
126 "name": "Emitter",
127 "filename": "src/emitter.coffee",
128 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/emitter.coffee#L25",
129 "sections": [
130 {
131 "name": "Construction and Destruction",
132 "description": ""
133 },
134 {
135 "name": "Event Subscription",
136 "description": ""
137 },
138 {
139 "name": "Event Emission",
140 "description": ""
141 }
142 ],
143 "classMethods": [],
144 "instanceMethods": [
145 {
146 "name": "constructor",
147 "sectionName": "Construction and Destruction",
148 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/emitter.coffee#L37",
149 "visibility": "Public",
150 "summary": "Construct an emitter.",
151 "description": "Construct an emitter.\n\n```coffee\n@emitter = new Emitter()\n```"
152 },
153 {
154 "name": "dispose",
155 "sectionName": "Construction and Destruction",
156 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/emitter.coffee#L41",
157 "visibility": "Public",
158 "summary": "Unsubscribe all handlers. ",
159 "description": "Unsubscribe all handlers. "
160 },
161 {
162 "name": "on",
163 "sectionName": "Event Subscription",
164 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/emitter.coffee#L58",
165 "visibility": "Public",
166 "summary": "Register the given handler function to be invoked whenever events by\nthe given name are emitted via {::emit}.",
167 "description": "Register the given handler function to be invoked whenever events by\nthe given name are emitted via {::emit}.",
168 "arguments": [
169 {
170 "name": "eventName",
171 "description": "{String} naming the event that you want to invoke the handler when emitted.",
172 "type": "String",
173 "isOptional": false
174 },
175 {
176 "name": "handler",
177 "description": "{Function} to invoke when {::emit} is called with the given event name.",
178 "type": "Function",
179 "isOptional": false
180 }
181 ],
182 "returnValues": [
183 {
184 "type": "Disposable",
185 "description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
186 }
187 ]
188 },
189 {
190 "name": "preempt",
191 "sectionName": "Event Subscription",
192 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/emitter.coffee#L92",
193 "visibility": "Public",
194 "summary": "Register the given handler function to be invoked *before* all\nother handlers existing at the time of subscription whenever events by the\ngiven name are emitted via {::emit}.",
195 "description": "Register the given handler function to be invoked *before* all\nother handlers existing at the time of subscription whenever events by the\ngiven name are emitted via {::emit}.\n\nUse this method when you need to be the first to handle a given event. This\ncould be required when a data structure in a parent object needs to be\nupdated before third-party event handlers registered on a child object via a\npublic API are invoked. Your handler could itself be preempted via\nsubsequent calls to this method, but this can be controlled by keeping\nmethods based on `::preempt` private.",
196 "arguments": [
197 {
198 "name": "eventName",
199 "description": "{String} naming the event that you want to invoke the handler when emitted.",
200 "type": "String",
201 "isOptional": false
202 },
203 {
204 "name": "handler",
205 "description": "{Function} to invoke when {::emit} is called with the given event name.",
206 "type": "Function",
207 "isOptional": false
208 }
209 ],
210 "returnValues": [
211 {
212 "type": "Disposable",
213 "description": "Returns a {Disposable} on which `.dispose()` can be called to unsubscribe."
214 }
215 ]
216 },
217 {
218 "name": "emit",
219 "sectionName": "Event Emission",
220 "srcUrl": "https://github.com/atom/event-kit/blob/v0.8.1/src/emitter.coffee#L114",
221 "visibility": "Public",
222 "summary": "Invoke handlers registered via {::on} for the given event name.",
223 "description": "Invoke handlers registered via {::on} for the given event name.",
224 "arguments": [
225 {
226 "name": "eventName",
227 "description": "The name of the event to emit. Handlers registered with {::on} for the same name will be invoked.",
228 "type": null,
229 "isOptional": false
230 },
231 {
232 "name": "value",
233 "description": "Callbacks will be invoked with this value as an argument. ",
234 "type": null,
235 "isOptional": false
236 }
237 ]
238 }
239 ],
240 "classProperties": [],
241 "instanceProperties": [],
242 "visibility": "Essential",
243 "summary": "Utility class to be used when implementing event-based APIs that\nallows for handlers registered via `::on` to be invoked with calls to\n`::emit`. Instances of this class are intended to be used internally by\nclasses that expose an event-based API.",
244 "description": "Utility class to be used when implementing event-based APIs that\nallows for handlers registered via `::on` to be invoked with calls to\n`::emit`. Instances of this class are intended to be used internally by\nclasses that expose an event-based API.\n\nFor example:\n\n```coffee\nclass User\n constructor: ->\n @emitter = new Emitter\n\n onDidChangeName: (callback) ->\n @emitter.on 'did-change-name', callback\n\n setName: (name) ->\n if name isnt @name\n @name = name\n @emitter.emit 'did-change-name', name\n @name\n```"
245 }
246 }
247}
\No newline at end of file