mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
108 lines
3.4 KiB
HTML
108 lines
3.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<title>Binding Test</title>
|
|
</head>
|
|
<body>
|
|
<p>
|
|
Result of calling bound.repeat("hi ", 5) =
|
|
<script type="text/javascript">
|
|
var result = bound.repeat("hi ", 5);
|
|
document.write('"' + result + '"');
|
|
if(result == "hi hi hi hi hi ")
|
|
{
|
|
document.write(" SUCCESS");
|
|
}
|
|
else
|
|
{
|
|
document.write(" FAIL!");
|
|
}
|
|
</script>
|
|
</p>
|
|
|
|
<p>
|
|
Function delegate to c# method
|
|
<br />
|
|
<script type="text/javascript">
|
|
function myFunction(functionParam)
|
|
{
|
|
return functionParam();
|
|
}
|
|
|
|
document.write("echoMyProperty result: " + myFunction(bound.echoMyProperty));
|
|
</script>
|
|
</p>
|
|
|
|
<p>
|
|
Function returning complex type
|
|
<br />
|
|
<script type="text/javascript">
|
|
document.write("bound.getSubObject().simpleProperty result: " + bound.getSubObject().simpleProperty);
|
|
</script>
|
|
</p>
|
|
|
|
<p>
|
|
Stress Test
|
|
<br />
|
|
<script type="text/javascript">
|
|
var stressTestCallCount = 1000;
|
|
for (var i = 1; i <= stressTestCallCount; i++) {
|
|
bound.repeat("hi ", 5);
|
|
}
|
|
|
|
document.write("Stress Test done with : " + stressTestCallCount + " call to bound.repeat(\"hi \", 5)");
|
|
</script>
|
|
</p>
|
|
|
|
<p>
|
|
JSON Serializer Test
|
|
<br />
|
|
<script type="text/javascript">
|
|
var json = bound.returnJsonEmployeeList();
|
|
var jsonObj = JSON.parse(json);
|
|
|
|
document.write("Employee Count : " + jsonObj.employees.length + "<br/>");
|
|
|
|
for (var i = 0; i <= jsonObj.employees.length; i++)
|
|
{
|
|
var employee = jsonObj.employees[i];
|
|
document.write("Employee : " + employee.firstName + " " + employee.lastName + "<br/>");
|
|
}
|
|
</script>
|
|
</p>
|
|
|
|
|
|
|
|
|
|
Methods on bound object 'bound':<br />
|
|
<ul>
|
|
<script type="text/javascript">
|
|
for (var name in bound)
|
|
{
|
|
if (bound[name].constructor.name != 'Function') continue;
|
|
document.write("<li>" + name + "</li>");
|
|
}
|
|
</script>
|
|
</ul>
|
|
|
|
Properties in bound object 'bound':<br />
|
|
<ul>
|
|
<script type="text/javascript">
|
|
for (var name in bound)
|
|
{
|
|
if (bound[name].constructor.name == 'Function') continue;
|
|
|
|
document.write("<li>" + name + "</li>");
|
|
if (typeof bound[name] == "object" && bound[name] !== null)
|
|
{
|
|
for (var sub in bound[name])
|
|
{
|
|
var type = bound[name][sub].constructor.name == 'Function' ? "Function" : "Property";
|
|
document.write("<li>" + name + "." + sub + "(" + type + ")" + "</li>");
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</ul>
|
|
</body>
|
|
</html> |