forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsf.d.ts
77 lines (64 loc) · 2.92 KB
/
jsf.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Type definitions for for the JSF 2.0 Ajax request API
// Project: https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html
// Definitions by: Lars Michaelis and Stephan Zerhusen <https://github.com/ButterFaces/ButterFaces>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace jsf {
namespace ajax {
interface RequestData {
status: string;
description: string;
}
interface RequestOptions {
/**
* space seperated list of client identifiers
*/
execute?: String;
/**
* space seperated list of client identifiers
*/
render?: String;
/**
* function to callback for event
* @param callback the callback function
*/
onevent?(callback:(data:RequestData) => void): void;
/**
* function to callback for error
* @param callback the callback function
*/
onerror?(callback:(data:RequestData) => void): void;
/**
* object containing parameters to include in the request
*/
params?: any;
/**
* client behavior event name from the request parameter
*/
'javax.faces.behavior.event'?: any;
}
/**
* Register a callback for event handling.
* @param callback a reference to a function to call on an event
*/
function addOnEvent(callback:(data:RequestData) => void):void;
/**
* Register a callback for error handling.
* @param callback a reference to a function to call on an error
*/
function addOnError(callback:(data:RequestData) => void):void;
/**
* Send an asynchronous Ajax request to the server.
* @param source The DOM element that triggered this Ajax request, or an id string of the element to use as the triggering element.
* @param event The DOM event that triggered this Ajax request. The event argument is optional.
* @param options The set of available options that can be sent as request parameters to control client and/or server side request processing.
*/
function request(source:any, event?:String, options?:RequestOptions):void;
/**
* Receive an Ajax response from the server.
* @param request The XMLHttpRequest instance that contains the status code and response message from the server.
* @param context An object containing the request context, including the following properties: the source element, per call onerror callback function, and per call onevent callback function.
* @throws EmptyResponse error if request contains no data
*/
function response(request:any, context:any):void;
}
}