You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_data/api.yml
+63-46Lines changed: 63 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,20 @@
1
-
constants:
2
-
- name: webview.CALLBACK_RESULT_URL_OK
3
-
- name: webview.CALLBACK_RESULT_URL_ERROR
4
-
- name: webview.CALLBACK_RESULT_URL_LOADING
5
-
- name: webview.CALLBACK_RESULT_EVAL_OK
6
-
- name: webview.CALLBACK_RESULT_EVAL_ERROR
7
-
8
-
functions:
9
-
- name: webview.create
10
-
short_desc: Creates a webview
11
-
desc: "Creates a webview instance. It can show HTML pages as well as evaluate
1
+
- name: webview
2
+
type: table
3
+
desc: Functions and constants for interacting with webview APIs
4
+
members:
5
+
6
+
- name: create
7
+
type: function
8
+
desc: Creates a webview instance.
9
+
It can show HTML pages as well as evaluate
12
10
Javascript. The view remains hidden until the first call. There can exist a
13
11
maximum of 4 webviews at the same time.
14
12
15
13
On iOS, the callback will never get a `webview.CALLBACK_RESULT_EVAL_ERROR`,
16
14
due to the iOS SDK implementation."
17
-
params:
15
+
parameters:
18
16
- type: function
19
-
params:
17
+
parameters:
20
18
- name: self
21
19
type: object
22
20
desc: The calling script
@@ -32,12 +30,16 @@ functions:
32
30
- name: type
33
31
type: enum
34
32
desc: The type of callback
35
-
options:
36
-
- webview.CALLBACK_RESULT_URL_OK
37
-
- webview.CALLBACK_RESULT_URL_ERROR
38
-
- webview.CALLBACK_RESULT_URL_LOADING
39
-
- webview.CALLBACK_RESULT_EVAL_OK
40
-
- webview.CALLBACK_RESULT_EVAL_ERROR
33
+
34
+
- `webview.CALLBACK_RESULT_URL_OK`
35
+
36
+
- `webview.CALLBACK_RESULT_URL_ERROR`
37
+
38
+
- `webview.CALLBACK_RESULT_URL_LOADING`
39
+
40
+
- `webview.CALLBACK_RESULT_EVAL_OK`
41
+
42
+
- `webview.CALLBACK_RESULT_EVAL_ERROR`
41
43
42
44
- name: data
43
45
type: table
@@ -59,7 +61,7 @@ functions:
59
61
desc: The id number of the webview
60
62
61
63
examples:
62
-
- example: |-
64
+
- desc: |-
63
65
```lua
64
66
local function webview_callback(self, webview_id, request_id, type, data)
65
67
if type == webview.CALLBACK_RESULT_URL_OK then
@@ -84,18 +86,18 @@ functions:
84
86
local webview_id = webview.create(webview_callback)
85
87
```
86
88
87
-
- name: webview.destroy
88
-
short_desc: Destroys a webview
89
+
- name: destroy
90
+
type: function
89
91
desc: Destroys an instance of a webview.
90
-
params:
92
+
parameters:
91
93
- name: webview_id
92
94
type: number
93
95
desc: The webview id (returned by the `webview.create()` call)
94
96
95
97
- name: webview.open
96
-
short_desc: Open a page using an URL
97
-
desc: Opens a web page in the webview, using an URL. Once the request is done, the callback (registered in `webview.create()`) is invoked.
98
-
params:
98
+
desc: Opens a web page in the webview, using an URL.
99
+
Once the request is done, the callback (registered in `webview.create()`) is invoked.
100
+
parameters:
99
101
- name: webview_id
100
102
type: number
101
103
desc: The webview id
@@ -110,15 +112,16 @@ functions:
110
112
type: boolean
111
113
desc: If true, the webview will stay hidden (default=false)
112
114
examples:
113
-
- example: |-
115
+
- desc: |-
114
116
```lua
115
117
local request_id = webview.open(webview_id, "http://www.defold.com", {hidden = true})
116
118
```
117
119
118
-
- name: webview.open_raw
119
-
short_desc: Open a page using HTML
120
-
desc: Opens a web page in the webview, using HTML data. Once the request is done, the callback (registered in `webview.create()`) is invoked.
121
-
params:
120
+
- name: open_raw
121
+
type: function
122
+
desc: Opens a web page in the webview, using HTML data.
123
+
Once the request is done, the callback (registered in `webview.create()`) is invoked.
124
+
parameters:
122
125
- name: webview_id
123
126
type: number
124
127
desc: The webview id
@@ -129,16 +132,17 @@ functions:
129
132
type: table
130
133
desc: "A table of options for the request. See `webview.open()`"
131
134
examples:
132
-
- example: |-
135
+
- desc: |-
133
136
```lua
134
137
local html = sys.load_resource("/main/data/test.html")
135
138
local request_id = webview.open_raw(webview_id, html, {hidden = true})
136
139
```
137
140
138
-
- name: webview.eval
139
-
short_desc: Evaluates javascript in a webview
140
-
desc: Evaluates JavaScript within the context of the currently loaded page (if any). Once the request is done, the callback (registered in `webview.create()`) is invoked. The callback will get the result in the `data["result"]` field.
141
-
params:
141
+
- name: eval
142
+
type: function
143
+
desc: Evaluates JavaScript within the context of the currently loaded page (if any).
144
+
Once the request is done, the callback (registered in `webview.create()`) is invoked. The callback will get the result in the `data["result"]` field.
145
+
parameters:
142
146
- name: webview_id
143
147
type: number
144
148
desc: The webview id
@@ -149,37 +153,37 @@ functions:
149
153
type: number
150
154
desc: The id number of the request
151
155
examples:
152
-
- example: |-
156
+
- desc: |-
153
157
```lua
154
158
local request_id = webview.eval(webview_id, "GetMyFormData()")
155
159
```
156
160
157
-
- name: webview.set_visible
158
-
short_desc: Shows or hides a webview
161
+
- name: set_visible
162
+
type: function
159
163
desc: Shows or hides a webview
160
-
params:
164
+
parameters:
161
165
- name: webview_id
162
166
type: number
163
167
desc: The webview id
164
168
- name: visible
165
169
type: number
166
170
desc: If `0`, hides the webview. If non zero, shows the view
167
171
168
-
- name: webview.is_visible
169
-
short_desc: Gets the visibility state of the webview
172
+
- name: is_visible
173
+
type: function
170
174
desc: Returns the visibility state of the webview.
171
-
params:
175
+
parameters:
172
176
- name: webview_id
173
177
type: number
174
178
desc: The webview id
175
179
return:
176
180
type: number
177
181
desc: Returns `0` if not visible, `1` if it is visible
178
182
179
-
- name: webview.set_position
180
-
short_desc: Sets the position and size of the webview
183
+
- name: set_position
184
+
type: function
181
185
desc: Sets the position and size of the webview
182
-
params:
186
+
parameters:
183
187
- name: webview_id
184
188
type: number
185
189
desc: The webview id
@@ -195,3 +199,16 @@ functions:
195
199
- name: height
196
200
type: number
197
201
desc: The height of the webview (-1 to match screen height)
0 commit comments