Webview:onMessage(msg) event
This event is fired when the Webview widget has received a message from the web page.
The message is provided as a string in JSON encoded format.
Return value
The event returns no value.Example
local ui = require "ui"
require "webview"
-- creates a simple window
local win = ui.Window("Webview:onResult() event sample", 320, 200)
local Webview = ui.Webview(win, 150, 70)
-- Don't show the Webview widget
Webview:hide()
-- Webview:onResult() event to center the Webview widget
function Webview:onResult(result)
ui.info(result, "Result of Math.PI in Javascript")
win:hide()
end
function Webview:onReady()
self:eval("Math.PI")
end
win:show()
-- update the ui
while win.visible do
ui.update()
end