Skip to content

Commit

Permalink
docs: remote webview, fix two errors (#13322)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Mar 23, 2022
1 parent 07b108a commit 0372c45
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apidoc/Titanium/UI/OptionBar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ excludes:
properties: [children]
methods: [add, remove, removeAllChildren, replaceAt]

events:
events:
- name: click
summary: Fired when an option has been selected.
properties:
properties:
- name: index
summary: Index of the option clicked on.
type: Number
Expand Down Expand Up @@ -62,7 +62,7 @@ examples:
``` js
const win = Ti.UI.createWindow();
const optionBar = Ti.UI.createOptionBar({
labels: [ 'Option 1', 'Option 2', Option 3 ]
labels: [ 'Option 1', 'Option 2', 'Option 3' ]
});
optionBar.addEventListener('click', (e) => {
Ti.API.info(`Option ${e.index} was selected.`);
Expand Down
2 changes: 1 addition & 1 deletion apidoc/Titanium/UI/OptionDialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ examples:
- title: Dialog with 3 Options
example: |
``` js
Ti.UI.setBackgroundColor('white');
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
title: 'Click window to test',
backgroundColor: 'white'
Expand Down
16 changes: 16 additions & 0 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ description: |
[evalJS](Titanium.UI.WebView.evalJS) method to execute a JavaScript expression
inside the web view and retrieve the value of an expression.
You can inject the local `Ti.App.fireEvent` bindings yourself by adding a script element using
evalJS.
```js
webview.evalJS(
'javascript=(function addBinding(){' +
'var s=document.createElement("script");' +
's.setAttribute("type","text/javascript");' +
's.innerHTML="' + require('/binding.js') + '";'
+
'document.getElementsByTagName("body")[0].appendChild(s);' +
'})()'
);
```
The `binding.min.js` is available in the [repository](https://github.com/tidev/titanium_mobile/tree/master/android/modules/ui/assets/Resources/ti.internal/webview).
#### Local JavaScript Files
During the build process for creating a package, all JavaScript files, that is, any file with a
Expand Down

0 comments on commit 0372c45

Please sign in to comment.