Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 96dc3d3

Browse files
Updating VSDoc and associated files
1 parent 4067dfa commit 96dc3d3

File tree

2 files changed

+162
-23
lines changed

2 files changed

+162
-23
lines changed

lib/rx.jquery-vsdoc.js

Lines changed: 152 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
proto = $.fn;
2626

2727
$.Deferred.prototype.toObservable = function () {
28+
/// <summary>Converts a jQuery Deferred object to an Observable sequence.</summary>
29+
/// <returns>An Observable sequenced defined from the jQuery Deferred object.</returns>
2830
var subject = new asyncSubject();
29-
parent.done(function () {
31+
this.done(function () {
3032
subject.onNext(slice.call(arguments));
3133
subject.onCompleted();
3234
}).fail(function () {
@@ -36,6 +38,8 @@
3638
};
3739

3840
observableProto.toDeferred = function () {
41+
/// <summary>Converts an existing Observable sequence to a jQuery Deferred object.</summary>
42+
/// <returns>A jQuery Deferred object</returns>
3943
var deferred = $.Deferred();
4044
this.subscribe(function (value) {
4145
deferred.resolve(value);
@@ -159,27 +163,73 @@
159163
return this.bindAsObservable('scroll', eventData);
160164
};
161165
proto.selectAsObservable = function(eventData) {
166+
/// <summary>
167+
/// Bind an event handler to the "select" JavaScript event, or trigger that event on an element as an Observable sequence.
168+
/// &#10;1 - selectAsObservable()
169+
/// &#10;2 - selectAsObservable(eventData)
170+
/// </summary>
171+
/// <param name="data" type="Object">
172+
/// A map of data that will be passed to the event handler.
173+
/// </param>
174+
/// <returns>An Observable sequence</returns>
162175
return this.bindAsObservable('select', eventData);
163176
};
164177
proto.submitAsObservable = function(eventData) {
178+
/// <summary>
179+
/// Bind an event handler to the "submit" JavaScript event, or trigger that event on an element as an Observable sequence.
180+
/// &#10;1 - submitAsObservable()
181+
/// &#10;2 - submitAsObservable(eventData)
182+
/// </summary>
183+
/// <param name="data" type="Object">
184+
/// A map of data that will be passed to the event handler.
185+
/// </param>
186+
/// <returns>An Observable sequence</returns>
165187
return this.bindAsObservable('submit', eventData);
166188
};
167189
proto.unloadAsObservable = function(eventData) {
190+
/// <summary>
191+
/// Bind an event handler to the "unload" JavaScript event as an Observable sequence.
192+
/// &#10;1 - unloadAsObservable()
193+
/// &#10;2 - unloadAsObservable(eventData)
194+
/// </summary>
195+
/// <param name="data" type="Object">
196+
/// A map of data that will be passed to the event handler.
197+
/// </param>
198+
/// <returns>An Observable sequence</returns>
168199
return this.bindAsObservable('unload', eventData);
169200
};
170-
proto.oneAsObservable = function(eventType, eventData) {
201+
proto.oneAsObservable = function(types, selector, data) {
202+
/// <summary>
203+
/// Attach a handler to an event for the elements as an Observable sequence.. The Observer onNext handler is executed at most once per element.
204+
/// &#10;1 - oneAsObservable(events, data)
205+
/// &#10;2 - oneAsObservable(events, selector, data)
206+
/// </summary>
207+
/// <param name="types" type="String">
208+
/// One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
209+
/// </param>
210+
/// <param name="selector" type="String">
211+
/// A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
212+
/// </param>
213+
/// <param name="data" type="Anything">
214+
/// Data to be passed to the handler in event.data when an event is triggered.
215+
/// </param>
216+
/// <returns>An Observable sequence</returns>
171217
var parent = this;
172218
return observableCreateWithDisposable(function(observer) {
173219
var handler = function(eventObject) {
174-
parent.unbind(eventType, handler);
220+
parent.off(types, selector, data, handler);
175221
observer.onNext(eventObject);
176222
observer.onCompleted();
177223
};
178-
parent.bind(eventType, eventData, handler);
224+
parent.on(types, selector, data, handler);
179225
return dispoableEmpty;
180226
});
181227
};
182228
proto.readyAsObservable = function() {
229+
/// <summary>
230+
/// Specify a function to execute when the DOM is fully loaded as an Observable sequence.
231+
/// </summary>
232+
/// <returns>An Observable sequence</returns>
183233
var parent = this;
184234
return observableCreateWithDisposable(function(observer) {
185235
var handler = function(eventObject) {
@@ -189,15 +239,41 @@
189239
return dispoableEmpty;
190240
});
191241
};
192-
proto.hideAsObservable = function(duration) {
242+
proto.hideAsObservable = function(duration, easing) {
243+
/// <summary>
244+
/// Hide the matched elements as an Observable sequence.
245+
/// &#10;1 - hideAsObservable()
246+
/// &#10;2 - hideAsObservable(duration)
247+
/// &#10;3 - hideAsObservable(duration, easing)
248+
/// </summary>
249+
/// <param name="speed" type="Number">
250+
/// A string or number determining how long the animation will run.
251+
/// </param>
252+
/// <param name="easing" type="String">
253+
/// A string indicating which easing function to use for the transition.
254+
/// </param>
255+
/// <returns>An Observable sequence</returns>
193256
var subject = new asyncSubject();
194-
this.hide(duration, function() {
257+
this.hide(duration, easing, function() {
195258
subject.onNext(this);
196259
subject.onCompleted();
197260
});
198261
return subject;
199262
};
200-
proto.showAsObservable = function(duration) {
263+
proto.showAsObservable = function(duration, easing) {
264+
/// <summary>
265+
/// Display the matched elements as an Observable sequence.
266+
/// &#10;1 - showAsObservable()
267+
/// &#10;2 - showAsObservable(duration)
268+
/// &#10;3 - showAsObservable(duration, easing)
269+
/// </summary>
270+
/// <param name="speed" type="Number">
271+
/// A string or number determining how long the animation will run.
272+
/// </param>
273+
/// <param name="easing" type="String">
274+
/// A string indicating which easing function to use for the transition.
275+
/// </param>
276+
/// <returns>An Observable sequence</returns>
201277
var subject = new asyncSubject();
202278
this.show(duration, function() {
203279
subject.onNext(this);
@@ -206,38 +282,101 @@
206282
return subject;
207283
};
208284
proto.animateAsObservable = function(properties, duration, easing) {
285+
/// <summary>
286+
/// Perform a custom animation of a set of CSS properties as an Observable sequence.
287+
/// &#10;1 - animate(properties, duration, easing)
288+
/// </summary>
289+
/// <param name="prop" type="Object">
290+
/// A map of CSS properties that the animation will move toward.
291+
/// </param>
292+
/// <param name="speed" type="Number">
293+
/// A string or number determining how long the animation will run.
294+
/// </param>
295+
/// <param name="easing" type="String">
296+
/// A string indicating which easing function to use for the transition.
297+
/// </param>
298+
/// <returns>An Observable sequence</returns>
209299
var subject = new asyncSubject();
210300
this.animate(properties, duration, easing, function() {
211301
subject.onNext(this);
212302
subject.onCompleted();
213303
});
214304
return subject;
215305
};
216-
proto.fadeInAsObservable = function(duration) {
306+
proto.fadeInAsObservable = function(duration, easing) {
307+
/// <summary>
308+
/// Display the matched elements by fading them to opaque as an Observable sequence.
309+
/// &#10;1 - fadeInAsObservable(duration)
310+
/// &#10;2 - fadeInAsObservable(duration, easing)
311+
/// </summary>
312+
/// <param name="speed" type="Number">
313+
/// A string or number determining how long the animation will run.
314+
/// </param>
315+
/// <param name="easing" type="String">
316+
/// A string indicating which easing function to use for the transition.
317+
/// </param>
318+
/// <returns>An Observable sequence</returns>
217319
var subject = new asyncSubject();
218-
this.fadeIn(duration, function() {
320+
this.fadeIn(duration, easing, function() {
219321
subject.onNext(this);
220322
subject.onCompleted();
221323
});
222324
return subject;
223325
};
224-
proto.fadeToAsObservable = function(duration, opacity) {
326+
proto.fadeToAsObservable = function(duration, opacity, easing) {
327+
/// <summary>
328+
/// Adjust the opacity of the matched elements as an Observable sequence.
329+
/// &#10;1 - fadeToAsObservable(duration, opacity)
330+
/// &#10;2 - fadeToAsObservable(duration, opacity, easing)
331+
/// </summary>
332+
/// <param name="speed" type="Number">
333+
/// A string or number determining how long the animation will run.
334+
/// </param>
335+
/// <param name="to" type="Number">
336+
/// A number between 0 and 1 denoting the target opacity.
337+
/// </param>
338+
/// <param name="easing" type="String">
339+
/// A string indicating which easing function to use for the transition.
340+
/// </param>
341+
/// <returns>An Observable sequence</returns>
225342
var subject = new asyncSubject();
226-
this.fadeTo(duration, opacity, function() {
343+
this.fadeTo(duration, opacity, easing, function() {
227344
subject.onNext(this);
228345
subject.onCompleted();
229346
});
230347
return subject;
231348
};
232-
proto.fadeOutAsObservable = function(duration) {
349+
proto.fadeOutAsObservable = function(duration, easing) {
350+
/// <summary>
351+
/// Hide the matched elements by fading them to transparent.
352+
/// &#10;1 - fadeOutAsObservable(duration)
353+
/// &#10;2 - fadeOutAsObservable(duration, easing)
354+
/// </summary>
355+
/// <param name="speed" type="Number">
356+
/// A string or number determining how long the animation will run.
357+
/// </param>
358+
/// <param name="easing" type="String">
359+
/// A string indicating which easing function to use for the transition.
360+
/// </param>
361+
/// <returns>An Observable sequence</returns>
233362
var subject = new asyncSubject();
234-
this.fadeOut(duration, function() {
363+
this.fadeOut(duration, easing, function() {
235364
subject.onNext(this);
236365
subject.onCompleted();
237366
});
238367
return subject;
239368
};
240369
proto.fadeToggleAsObservable = function(duration, easing) {
370+
/// <summary>
371+
/// Display or hide the matched elements by animating their opacity as an Observable sequence.
372+
/// </summary>
373+
/// <param name="speed" type="Number">
374+
/// A string or number determining how long the animation will run.
375+
/// </param>
376+
/// <param name="easing" type="String">
377+
/// A string indicating which easing function to use for the transition.
378+
/// </param>
379+
/// <returns>An Observable sequence</returns>
241380
var subject = new asyncSubject();
242381
this.fadeToggle(duration, easing, function() {
243382
subject.onNext(this);

lib/rx.jquery.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,15 @@
167167
proto.unloadAsObservable = function(eventData) {
168168
return this.bindAsObservable('unload', eventData);
169169
};
170-
proto.oneAsObservable = function(eventType, eventData) {
170+
proto.oneAsObservable = function(types, selector, data) {
171171
var parent = this;
172172
return observableCreateWithDisposable(function(observer) {
173173
var handler = function(eventObject) {
174-
parent.unbind(eventType, handler);
174+
parent.off(types, selector, data, handler);
175175
observer.onNext(eventObject);
176176
observer.onCompleted();
177177
};
178-
parent.bind(eventType, eventData, handler);
178+
parent.on(types, selector, data, handler);
179179
return dispoableEmpty;
180180
});
181181
};
@@ -197,7 +197,7 @@
197197
});
198198
return subject;
199199
};
200-
proto.showAsObservable = function(duration) {
200+
proto.showAsObservable = function(duration, easing) {
201201
var subject = new asyncSubject();
202202
this.show(duration, function() {
203203
subject.onNext(this);
@@ -213,25 +213,25 @@
213213
});
214214
return subject;
215215
};
216-
proto.fadeInAsObservable = function(duration) {
216+
proto.fadeInAsObservable = function(duration, easing) {
217217
var subject = new asyncSubject();
218-
this.fadeIn(duration, function() {
218+
this.fadeIn(duration, easing, function() {
219219
subject.onNext(this);
220220
subject.onCompleted();
221221
});
222222
return subject;
223223
};
224-
proto.fadeToAsObservable = function(duration, opacity) {
224+
proto.fadeToAsObservable = function(duration, opacity, easing) {
225225
var subject = new asyncSubject();
226-
this.fadeTo(duration, opacity, function() {
226+
this.fadeTo(duration, opacity, easing, function() {
227227
subject.onNext(this);
228228
subject.onCompleted();
229229
});
230230
return subject;
231231
};
232-
proto.fadeOutAsObservable = function(duration) {
232+
proto.fadeOutAsObservable = function(duration, easing) {
233233
var subject = new asyncSubject();
234-
this.fadeOut(duration, function() {
234+
this.fadeOut(duration, easing, function() {
235235
subject.onNext(this);
236236
subject.onCompleted();
237237
});

0 commit comments

Comments
 (0)