sync
[roojs1] / docs / symbols / Roo.util.Observable.json
1 {
2   "name" : "Roo.util.Observable",
3   "augments" : [],
4   "desc" : "Base class that provides a common interface for publishing events. Subclasses are expected to\nto have a property \"events\" with all the events defined.<br>\nFor example:\n<pre><code>\n Employee = function(name){\n    this.name = name;\n    this.addEvents({\n        \"fired\" : true,\n        \"quit\" : true\n    });\n }\n Roo.extend(Employee, Roo.util.Observable);\n</code></pre>",
5   "isSingleton" : false,
6   "isStatic" : false,
7   "isBuiltin" : false,
8   "memberOf" : "Observable",
9   "example" : "",
10   "deprecated" : "",
11   "since" : "",
12   "see" : "",
13   "params" : [
14     {
15       "name" : "config",
16       "type" : "Object",
17       "desc" : "properties to use (incuding events / listeners)",
18       "isOptional" : false
19     }
20   ],
21   "returns" : [],
22   "throws" : "",
23   "requires" : "",
24   "config" : [
25     {
26       "name" : "listeners",
27       "type" : "Object",
28       "desc" : "list of events and functions to call for this object, \nFor example :\n<pre><code>\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  </code></pre>",
29       "memberOf" : ""
30     }
31   ],
32   "methods" : [
33     {
34       "name" : "purgeListeners",
35       "type" : "function",
36       "desc" : "Removes all listeners for this object",
37       "sig" : "()\n{\n\n}",
38       "static" : false,
39       "memberOf" : "",
40       "isStatic" : false,
41       "isConstructor" : false,
42       "isPrivate" : false,
43       "example" : "",
44       "deprecated" : "",
45       "since" : "",
46       "see" : "",
47       "exceptions" : "",
48       "requires" : "",
49       "params" : [],
50       "returns" : []
51     },
52     {
53       "name" : "on",
54       "type" : "function",
55       "desc" : "Appends an event handler to this element (shorthand for addListener)",
56       "sig" : "(eventName, handler, scope, options)",
57       "static" : false,
58       "memberOf" : "",
59       "isStatic" : false,
60       "isConstructor" : false,
61       "isPrivate" : false,
62       "example" : "",
63       "deprecated" : "",
64       "since" : "",
65       "see" : "",
66       "exceptions" : "",
67       "requires" : "",
68       "params" : [
69         {
70           "name" : "eventName",
71           "type" : "String",
72           "desc" : "The type of event to listen for",
73           "isOptional" : false
74         },
75         {
76           "name" : "handler",
77           "type" : "Function",
78           "desc" : "The method the event invokes",
79           "isOptional" : false
80         },
81         {
82           "name" : "scope",
83           "type" : "Object",
84           "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
85           "isOptional" : false
86         },
87         {
88           "name" : "options",
89           "type" : "Object",
90           "desc" : "(optional)",
91           "isOptional" : false
92         }
93       ],
94       "returns" : []
95     },
96     {
97       "name" : "un",
98       "type" : "function",
99       "desc" : "Removes a listener (shorthand for removeListener)",
100       "sig" : "(eventName, handler, scope)",
101       "static" : false,
102       "memberOf" : "",
103       "isStatic" : false,
104       "isConstructor" : false,
105       "isPrivate" : false,
106       "example" : "",
107       "deprecated" : "",
108       "since" : "",
109       "see" : "",
110       "exceptions" : "",
111       "requires" : "",
112       "params" : [
113         {
114           "name" : "eventName",
115           "type" : "String",
116           "desc" : "The type of event to listen for",
117           "isOptional" : false
118         },
119         {
120           "name" : "handler",
121           "type" : "Function",
122           "desc" : "The handler to remove",
123           "isOptional" : false
124         },
125         {
126           "name" : "scope",
127           "type" : "Object",
128           "desc" : "(optional) The scope (this object) for the handler",
129           "isOptional" : false
130         }
131       ],
132       "returns" : []
133     },
134     {
135       "name" : "addEvents",
136       "type" : "function",
137       "desc" : "Used to define events on this Observable",
138       "sig" : "(object)",
139       "static" : false,
140       "memberOf" : "",
141       "isStatic" : false,
142       "isConstructor" : false,
143       "isPrivate" : false,
144       "example" : "",
145       "deprecated" : "",
146       "since" : "",
147       "see" : "",
148       "exceptions" : "",
149       "requires" : "",
150       "params" : [
151         {
152           "name" : "object",
153           "type" : "Object",
154           "desc" : "The object with the events defined",
155           "isOptional" : false
156         }
157       ],
158       "returns" : []
159     },
160     {
161       "name" : "releaseCapture",
162       "type" : "function",
163       "desc" : "Removes <b>all</b> added captures from the Observable.",
164       "sig" : "(o)",
165       "static" : true,
166       "memberOf" : "",
167       "isStatic" : true,
168       "isConstructor" : false,
169       "isPrivate" : false,
170       "example" : "",
171       "deprecated" : "",
172       "since" : "",
173       "see" : "",
174       "exceptions" : "",
175       "requires" : "",
176       "params" : [
177         {
178           "name" : "o",
179           "type" : "Observable",
180           "desc" : "The Observable to release",
181           "isOptional" : false
182         }
183       ],
184       "returns" : []
185     },
186     {
187       "name" : "removeListener",
188       "type" : "function",
189       "desc" : "Removes a listener",
190       "sig" : "(eventName, handler, scope)",
191       "static" : false,
192       "memberOf" : "",
193       "isStatic" : false,
194       "isConstructor" : false,
195       "isPrivate" : false,
196       "example" : "",
197       "deprecated" : "",
198       "since" : "",
199       "see" : "",
200       "exceptions" : "",
201       "requires" : "",
202       "params" : [
203         {
204           "name" : "eventName",
205           "type" : "String",
206           "desc" : "The type of event to listen for",
207           "isOptional" : false
208         },
209         {
210           "name" : "handler",
211           "type" : "Function",
212           "desc" : "The handler to remove",
213           "isOptional" : false
214         },
215         {
216           "name" : "scope",
217           "type" : "Object",
218           "desc" : "(optional) The scope (this object) for the handler",
219           "isOptional" : false
220         }
221       ],
222       "returns" : []
223     },
224     {
225       "name" : "fireEvent",
226       "type" : "function",
227       "desc" : "Fires the specified event with the passed parameters (minus the event name).",
228       "sig" : "(eventName, args)",
229       "static" : false,
230       "memberOf" : "",
231       "isStatic" : false,
232       "isConstructor" : false,
233       "isPrivate" : false,
234       "example" : "",
235       "deprecated" : "",
236       "since" : "",
237       "see" : "",
238       "exceptions" : "",
239       "requires" : "",
240       "params" : [
241         {
242           "name" : "eventName",
243           "type" : "String",
244           "desc" : "",
245           "isOptional" : false
246         },
247         {
248           "name" : "args",
249           "type" : "Object...",
250           "desc" : "Variable number of parameters are passed to handlers",
251           "isOptional" : false
252         }
253       ],
254       "returns" : [
255         {
256           "name" : "",
257           "type" : "Boolean",
258           "desc" : "returns false if any of the handlers return false otherwise it returns true"
259         }
260       ]
261     },
262     {
263       "name" : "hasListener",
264       "type" : "function",
265       "desc" : "Checks to see if this object has any listeners for a specified event",
266       "sig" : "(eventName)",
267       "static" : false,
268       "memberOf" : "",
269       "isStatic" : false,
270       "isConstructor" : false,
271       "isPrivate" : false,
272       "example" : "",
273       "deprecated" : "",
274       "since" : "",
275       "see" : "",
276       "exceptions" : "",
277       "requires" : "",
278       "params" : [
279         {
280           "name" : "eventName",
281           "type" : "String",
282           "desc" : "The name of the event to check for",
283           "isOptional" : false
284         }
285       ],
286       "returns" : [
287         {
288           "name" : "",
289           "type" : "Boolean",
290           "desc" : "True if the event is being listened for, else false"
291         }
292       ]
293     },
294     {
295       "name" : "capture",
296       "type" : "function",
297       "desc" : "Starts capture on the specified Observable. All events will be passed\nto the supplied function with the event name + standard signature of the event\n<b>before</b> the event is fired. If the supplied function returns false,\nthe event will not fire.",
298       "sig" : "(o, fn, scope)",
299       "static" : true,
300       "memberOf" : "",
301       "isStatic" : true,
302       "isConstructor" : false,
303       "isPrivate" : false,
304       "example" : "",
305       "deprecated" : "",
306       "since" : "",
307       "see" : "",
308       "exceptions" : "",
309       "requires" : "",
310       "params" : [
311         {
312           "name" : "o",
313           "type" : "Observable",
314           "desc" : "The Observable to capture",
315           "isOptional" : false
316         },
317         {
318           "name" : "fn",
319           "type" : "Function",
320           "desc" : "The function to call",
321           "isOptional" : false
322         },
323         {
324           "name" : "scope",
325           "type" : "Object",
326           "desc" : "(optional) The scope (this object) for the fn",
327           "isOptional" : false
328         }
329       ],
330       "returns" : []
331     },
332     {
333       "name" : "addListener",
334       "type" : "function",
335       "desc" : "Appends an event handler to this component",
336       "sig" : "(eventName, handler, scope, options)",
337       "static" : false,
338       "memberOf" : "",
339       "isStatic" : false,
340       "isConstructor" : false,
341       "isPrivate" : false,
342       "example" : "",
343       "deprecated" : "",
344       "since" : "",
345       "see" : "",
346       "exceptions" : "",
347       "requires" : "",
348       "params" : [
349         {
350           "name" : "eventName",
351           "type" : "String",
352           "desc" : "The type of event to listen for",
353           "isOptional" : false
354         },
355         {
356           "name" : "handler",
357           "type" : "Function",
358           "desc" : "The method the event invokes",
359           "isOptional" : false
360         },
361         {
362           "name" : "scope",
363           "type" : "Object",
364           "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
365           "isOptional" : false
366         },
367         {
368           "name" : "options",
369           "type" : "Object",
370           "desc" : "(optional) An object containing handler configuration\nproperties. This may contain any of the following properties:<ul>\n<li>scope {Object} The scope in which to execute the handler function. The handler function's \"this\" context.</li>\n<li>delay {Number} The number of milliseconds to delay the invocation of the handler after te event fires.</li>\n<li>single {Boolean} True to add a handler to handle just the next firing of the event, and then remove itself.</li>\n<li>buffer {Number} Causes the handler to be scheduled to run in an {@link Roo.util.DelayedTask} delayed\nby the specified number of milliseconds. If the event fires again within that time, the original\nhandler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>\n</ul><br>\n<p>\n<b>Combining Options</b><br>\nUsing the options argument, it is possible to combine different types of listeners:<br>\n<br>\nA normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)\n\t\t<pre><code>\n\t\tel.on('click', this.onClick, this, {\n \t\t\tsingle: true,\n    \t\tdelay: 100,\n    \t\tforumId: 4\n\t\t});\n\t\t</code></pre>\n<p>\n<b>Attaching multiple handlers in 1 call</b><br>\nThe method also allows for a single argument to be passed which is a config object containing properties\nwhich specify multiple handlers.\n<pre><code>\n\t\tel.on({\n\t\t\t'click': {\n        \t\tfn: this.onClick,\n        \t\tscope: this,\n        \t\tdelay: 100\n    \t\t}, \n    \t\t'mouseover': {\n        \t\tfn: this.onMouseOver,\n        \t\tscope: this\n    \t\t},\n    \t\t'mouseout': {\n        \t\tfn: this.onMouseOut,\n        \t\tscope: this\n    \t\t}\n\t\t});\n\t\t</code></pre>\n<p>\nOr a shorthand syntax which passes the same scope object to all handlers:\n     \t<pre><code>\n\t\tel.on({\n\t\t\t'click': this.onClick,\n    \t\t'mouseover': this.onMouseOver,\n    \t\t'mouseout': this.onMouseOut,\n    \t\tscope: this\n\t\t});\n\t\t</code></pre>",
371           "isOptional" : false
372         }
373       ],
374       "returns" : []
375     }
376   ],
377   "events" : []
378 }