/
Proxy.yml
114 lines (101 loc) 路 4.61 KB
/
Proxy.yml
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
name: Titanium.Proxy
summary: The base for all Titanium objects.
description: |
On platforms that use native code (Android and iOS), the `Proxy` type represents a
JavaScript wrapper or _proxy_ around a native object. Setting or getting a property
on a proxy object results in a method invokation on the native object. Likewise,
calling a method on the proxy object results in a method invokation on the native
object.
Some Titanium objects are _createable_: new instances of these objects can be created using
factory methods. For example, a [Window](Titanium.UI.Window) object can be created using the
<Titanium.UI.createWindow> method.
In general, developers should avoid modifying the prototype of a Titanium object, or
adding methods to a Titanium object. (Adding a simple property such as an ID value is
generally OK.)
since: "0.1"
createable: false
methods:
- name: addEventListener
summary: Adds the specified callback as an event listener for the named event.
parameters:
- name: name
summary: Name of the event.
type: String
- name: callback
summary: Callback function to invoke when the event is fired.
type: Callback<Titanium.Event>
- name: removeEventListener
summary: Removes the specified callback as an event listener for the named event.
description: |
Multiple listeners can be registered for the same event, so the
`callback` parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function
in order to remove the listener later:
``` js
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
```
To remove the listener, pass in a reference to the callback function:
``` js
window.removeEventListener('click', listener);
```
parameters:
- name: name
summary: Name of the event.
type: String
- name: callback
summary: Callback function to remove. Must be the same function passed to `addEventListener`.
type: Callback<Titanium.Event>
- name: fireEvent
summary: Fires a synthesized event to any registered listeners.
parameters:
- name: name
summary: Name of the event.
type: String
- name: event
optional: true
summary: A dictionary of keys and values to add to the <Titanium.Event> object
sent to the listeners.
type: Dictionary
- name: applyProperties
summary: Applies the properties to the proxy.
description: |
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that
myproxy[key] = value.
parameters:
- name: props
summary: A dictionary of properties to apply.
type: Dictionary
since: {android: "3.0.0", iphone: "3.0.0", ipad: "3.0.0"}
properties:
- name: bubbleParent
summary: Indicates if the proxy will bubble an event to its parent.
description: |
Some proxies (most commonly views) have a relationship to other proxies, often
established by the add() method. For example, for a button added to a window, a
click event on the button would bubble up to the window. Other common parents are
table sections to their rows, table views to their sections, and scrollable views
to their views. Set this property to false to disable the bubbling to the proxy's parent.
type: Boolean
default: true
platforms: [iphone, ipad, android, macos]
since: {android: "3.0.0", iphone: "3.0.0", ipad: "3.0.0", macos: "9.2.0"}
- name: apiName
summary: The name of the API that this proxy corresponds to.
description: |
The value of this property is the fully qualified name of the API. For example, [Button](Titanium.UI.Button)
returns `Ti.UI.Button`.
permission: read-only
type: String
platforms: [android, iphone, ipad, macos]
since: {android: "3.2.0", iphone: "3.2.0", ipad: "3.2.0", macos: "9.2.0"}
- name: lifecycleContainer
summary: The Window or TabGroup whose Activity lifecycle should be triggered on the proxy.
description: |
If this property is set to a Window or TabGroup, then the corresponding Activity lifecycle event callbacks
will also be called on the proxy. Proxies that require the activity lifecycle will need this property set
to the appropriate containing Window or TabGroup.
type: [Titanium.UI.Window, Titanium.UI.TabGroup]
platforms: [android]
since: "3.6.0"