enable grammerly in editor
[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   "config" : [
23     {
24       "name" : "listeners",
25       "type" : "Object",
26       "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>",
27       "memberOf" : "Roo.util.Observable",
28       "optvals" : []
29     }
30   ],
31   "methods" : [
32     {
33       "name" : "purgeListeners",
34       "desc" : "Removes all listeners for this object",
35       "isStatic" : false,
36       "isConstructor" : false,
37       "isPrivate" : false,
38       "memberOf" : "Roo.util.Observable",
39       "example" : "",
40       "deprecated" : "",
41       "since" : "",
42       "see" : "",
43       "params" : [],
44       "returns" : []
45     },
46     {
47       "name" : "on",
48       "desc" : "Appends an event handler to this element (shorthand for addListener)",
49       "isStatic" : false,
50       "isConstructor" : false,
51       "isPrivate" : false,
52       "memberOf" : "Roo.util.Observable",
53       "example" : "",
54       "deprecated" : "",
55       "since" : "",
56       "see" : "",
57       "params" : [
58         {
59           "name" : "eventName",
60           "type" : "String",
61           "desc" : "The type of event to listen for",
62           "isOptional" : false
63         },
64         {
65           "name" : "handler",
66           "type" : "Function",
67           "desc" : "The method the event invokes",
68           "isOptional" : false
69         },
70         {
71           "name" : "scope",
72           "type" : "Object",
73           "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
74           "isOptional" : false
75         },
76         {
77           "name" : "options",
78           "type" : "Object",
79           "desc" : "(optional)",
80           "isOptional" : false
81         }
82       ],
83       "returns" : []
84     },
85     {
86       "name" : "un",
87       "desc" : "Removes a listener (shorthand for removeListener)",
88       "isStatic" : false,
89       "isConstructor" : false,
90       "isPrivate" : false,
91       "memberOf" : "Roo.util.Observable",
92       "example" : "",
93       "deprecated" : "",
94       "since" : "",
95       "see" : "",
96       "params" : [
97         {
98           "name" : "eventName",
99           "type" : "String",
100           "desc" : "The type of event to listen for",
101           "isOptional" : false
102         },
103         {
104           "name" : "handler",
105           "type" : "Function",
106           "desc" : "The handler to remove",
107           "isOptional" : false
108         },
109         {
110           "name" : "scope",
111           "type" : "Object",
112           "desc" : "(optional) The scope (this object) for the handler",
113           "isOptional" : false
114         }
115       ],
116       "returns" : []
117     },
118     {
119       "name" : "addEvents",
120       "desc" : "Used to define events on this Observable",
121       "isStatic" : false,
122       "isConstructor" : false,
123       "isPrivate" : false,
124       "memberOf" : "Roo.util.Observable",
125       "example" : "",
126       "deprecated" : "",
127       "since" : "",
128       "see" : "",
129       "params" : [
130         {
131           "name" : "object",
132           "type" : "Object",
133           "desc" : "The object with the events defined",
134           "isOptional" : false
135         }
136       ],
137       "returns" : []
138     },
139     {
140       "name" : "releaseCapture",
141       "desc" : "Removes <b>all</b> added captures from the Observable.",
142       "isStatic" : true,
143       "isConstructor" : false,
144       "isPrivate" : false,
145       "memberOf" : "Roo.util.Observable",
146       "example" : "",
147       "deprecated" : "",
148       "since" : "",
149       "see" : "",
150       "params" : [
151         {
152           "name" : "o",
153           "type" : "Observable",
154           "desc" : "The Observable to release",
155           "isOptional" : false
156         }
157       ],
158       "returns" : []
159     },
160     {
161       "name" : "removeListener",
162       "desc" : "Removes a listener",
163       "isStatic" : false,
164       "isConstructor" : false,
165       "isPrivate" : false,
166       "memberOf" : "Roo.util.Observable",
167       "example" : "",
168       "deprecated" : "",
169       "since" : "",
170       "see" : "",
171       "params" : [
172         {
173           "name" : "eventName",
174           "type" : "String",
175           "desc" : "The type of event to listen for",
176           "isOptional" : false
177         },
178         {
179           "name" : "handler",
180           "type" : "Function",
181           "desc" : "The handler to remove",
182           "isOptional" : false
183         },
184         {
185           "name" : "scope",
186           "type" : "Object",
187           "desc" : "(optional) The scope (this object) for the handler",
188           "isOptional" : false
189         }
190       ],
191       "returns" : []
192     },
193     {
194       "name" : "fireEvent",
195       "desc" : "Fires the specified event with the passed parameters (minus the event name).",
196       "isStatic" : false,
197       "isConstructor" : false,
198       "isPrivate" : false,
199       "memberOf" : "Roo.util.Observable",
200       "example" : "",
201       "deprecated" : "",
202       "since" : "",
203       "see" : "",
204       "params" : [
205         {
206           "name" : "eventName",
207           "type" : "String",
208           "desc" : "",
209           "isOptional" : false
210         },
211         {
212           "name" : "args",
213           "type" : "Object...",
214           "desc" : "Variable number of parameters are passed to handlers",
215           "isOptional" : false
216         }
217       ],
218       "returns" : [
219         {
220           "name" : "",
221           "type" : "Boolean",
222           "desc" : "returns false if any of the handlers return false otherwise it returns true"
223         }
224       ]
225     },
226     {
227       "name" : "hasListener",
228       "desc" : "Checks to see if this object has any listeners for a specified event",
229       "isStatic" : false,
230       "isConstructor" : false,
231       "isPrivate" : false,
232       "memberOf" : "Roo.util.Observable",
233       "example" : "",
234       "deprecated" : "",
235       "since" : "",
236       "see" : "",
237       "params" : [
238         {
239           "name" : "eventName",
240           "type" : "String",
241           "desc" : "The name of the event to check for",
242           "isOptional" : false
243         }
244       ],
245       "returns" : [
246         {
247           "name" : "",
248           "type" : "Boolean",
249           "desc" : "True if the event is being listened for, else false"
250         }
251       ]
252     },
253     {
254       "name" : "capture",
255       "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.",
256       "isStatic" : true,
257       "isConstructor" : false,
258       "isPrivate" : false,
259       "memberOf" : "Roo.util.Observable",
260       "example" : "",
261       "deprecated" : "",
262       "since" : "",
263       "see" : "",
264       "params" : [
265         {
266           "name" : "o",
267           "type" : "Observable",
268           "desc" : "The Observable to capture",
269           "isOptional" : false
270         },
271         {
272           "name" : "fn",
273           "type" : "Function",
274           "desc" : "The function to call",
275           "isOptional" : false
276         },
277         {
278           "name" : "scope",
279           "type" : "Object",
280           "desc" : "(optional) The scope (this object) for the fn",
281           "isOptional" : false
282         }
283       ],
284       "returns" : []
285     },
286     {
287       "name" : "addListener",
288       "desc" : "Appends an event handler to this component",
289       "isStatic" : false,
290       "isConstructor" : false,
291       "isPrivate" : false,
292       "memberOf" : "Roo.util.Observable",
293       "example" : "",
294       "deprecated" : "",
295       "since" : "",
296       "see" : "",
297       "params" : [
298         {
299           "name" : "eventName",
300           "type" : "String",
301           "desc" : "The type of event to listen for",
302           "isOptional" : false
303         },
304         {
305           "name" : "handler",
306           "type" : "Function",
307           "desc" : "The method the event invokes",
308           "isOptional" : false
309         },
310         {
311           "name" : "scope",
312           "type" : "Object",
313           "desc" : "(optional) The scope in which to execute the handler\nfunction. The handler function's \"this\" context.",
314           "isOptional" : false
315         },
316         {
317           "name" : "options",
318           "type" : "Object",
319           "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>",
320           "isOptional" : false
321         }
322       ],
323       "returns" : []
324     }
325   ],
326   "events" : []
327 }