-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example for separated bound objects
- Loading branch information
1 parent
6f2a44e
commit 8502e67
Showing
11 changed files
with
212 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Multitenant Test</title> | ||
<script> | ||
var windows = []; | ||
|
||
window.onmessage = function(e) | ||
{ | ||
var data; | ||
try | ||
{ | ||
data = JSON.parse(e.data); | ||
} catch (e) | ||
{ | ||
// fail silent...? | ||
return; | ||
} | ||
switch (data.event) | ||
{ | ||
case "QueryOpenWindows": | ||
if (windows.indexOf(e.source) === -1) | ||
{ | ||
windows.push(e.source); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
setInterval(function () { | ||
try { | ||
if (window.opener) { | ||
window.opener.postMessage(JSON.stringify({ "event": "QueryOpenWindows"}), "*"); | ||
} | ||
} | ||
catch (e) { | ||
} | ||
}, 100); | ||
|
||
function onLoad() | ||
{ | ||
var p = document.getElementById('p'); | ||
var btn = document.getElementById('btn'); | ||
if (window.opener) { | ||
btn.parentElement.removeChild(btn); | ||
} | ||
|
||
setTimeout(function () { | ||
for (var i = 0; i < windows.length; i++) | ||
{ | ||
windows[i].location.reload(); | ||
} | ||
try { | ||
uniqueObject.id().then(function (res) { | ||
p.innerText = res; | ||
}, function (error) { | ||
p.innerText = error; | ||
}); | ||
} catch (err) { | ||
p.innerText = err; | ||
} | ||
}, 500); | ||
} | ||
|
||
function openWindow() | ||
{ | ||
window.open(window.location, '', 'width=300,height=300'); | ||
window.location.reload(); | ||
} | ||
</script> | ||
</head> | ||
<body onload="onLoad()"> | ||
<button id="btn" onclick="openWindow()">New Window</button> | ||
<p id="p"></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | ||
|
||
using System.Threading; | ||
|
||
namespace CefSharp.Example | ||
{ | ||
public class UniqueBoundObject | ||
{ | ||
private static int lastId = 0; | ||
private int id; | ||
|
||
public UniqueBoundObject() | ||
{ | ||
id = Interlocked.Increment(ref lastId); | ||
} | ||
|
||
public int Id() | ||
{ | ||
return id; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters