diff --git a/rx-dom/rx-dom-tests.ts b/rx-dom/rx-dom-tests.ts new file mode 100644 index 000000000..49080f076 --- /dev/null +++ b/rx-dom/rx-dom-tests.ts @@ -0,0 +1,5 @@ +/// +/// + +import * as Rx from 'rx'; +import * as DOM from 'rx.DOM'; \ No newline at end of file diff --git a/rx-dom/rx-dom.d.ts b/rx-dom/rx-dom.d.ts new file mode 100644 index 000000000..5a4281060 --- /dev/null +++ b/rx-dom/rx-dom.d.ts @@ -0,0 +1,142 @@ +// Type definitions for RxJS v2.5.3 +// Project: https://github.com/Reactive-Extensions/RxJS-DOM +// Definitions by: oliver Weichhold +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Rx.DOM { + export interface AjaxSettings { + async?: boolean; + body?: string; + // This options does not seem to be used in the code yet + // contentType?: string; + crossDomain?: boolean; + headers?: any; + method?: string; + password?: string; + progressObserver?: Rx.Observer; + responseType?: string; + url?: string; + user?: string; + } + + export interface AjaxSuccessResponse { + response: any; + status: number; + responseType: string; + xhr: XMLHttpRequest; + originalEvent: Event; + } + + export interface AjaxErrorResponse { + type: string; + status: number; + xhr: XMLHttpRequest; + originalEvent: Event; + } + + export interface JsonpSettings { + async?: boolean; + jsonp?: string; + jsonpCallback?: string; + url?: string; + } + + export interface JsonpSuccessResponse { + response: any; + status: number; + responseType: string; + originalEvent: Event; + } + + export interface JsonpErrorResponse { + type: string; + status: number; + originalEvent: Event; + } + + export interface GeolocationOptions { + enableHighAccuracy?: boolean; + timeout?: number; + maximumAge?: number; + } + + // Events + function fromEvent(element:any, eventName:string, selector?:Function, useCapture?:boolean):Rx.Observable; + + function ready():Rx.Observable; + + // Event Shortcuts + function blur(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function change(element: Element, selector?:Function):Rx.Observable; + function click(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function contextmenu(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function dblclick(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function error(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function focus(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function focusin(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function focusout(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function keydown(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function keypress(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function keyup(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function load(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mousedown(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mouseenter(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mouseleave(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mousemove(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mouseout(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mouseover(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function mouseup(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function resize(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function scroll(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function select(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function submit(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function unload(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + + // Pointer Events + function pointerdown(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function pointerenter(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function pointerleave(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function pointermove(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function pointerout(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function pointerover(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function pointerup(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + + // Touch Events + function touchcancel(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function touchend(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function touchmove(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + function touchstart(element: Element, selector?:Function, useCapture?:boolean):Rx.Observable; + + // Ajax + function ajax(url:string):Rx.Observable; + function ajax(settings:AjaxSettings):Rx.Observable; + function get(url:string):Rx.Observable; + function getJSON(url:string):Rx.Observable; + function post(url:string, body:any):Rx.Observable; + function jsonpRequest(url:string):Rx.Observable; + function jsonpRequest(settings:JsonpSettings):Rx.Observable; + + // Server-Sent Events + function fromEventSource(url:string, openObservable?:Rx.Observer):Rx.Observable; + + // Web Sockets + function fromWebSocket(url:string, protocol:string, openObserver?:Rx.Observer, closingObserver?:Rx.Observer):Rx.Subject; + + // Web Workers + function fromWebWorker(url:string):Rx.Subject; + + // Mutation Observers + function fromMutationObserver(target:Node, options:MutationObserverInit):Rx.Observable; + + // Geolocation + export module geolocation { + function getCurrentPosition(geolocationOptions?:GeolocationOptions):Rx.Observable; + function watchPosition(geolocationOptions?:GeolocationOptions):Rx.Observable; + } +} + +declare module "rx.DOM" { + export default Rx.DOM; +} \ No newline at end of file