Skip to content

Instantly share code, notes, and snippets.

@michabaur
Created February 9, 2017 14:00
Show Gist options
  • Save michabaur/2a627a3e7a5703dbd682b6ef3274e5dc to your computer and use it in GitHub Desktop.
Save michabaur/2a627a3e7a5703dbd682b6ef3274e5dc to your computer and use it in GitHub Desktop.
yWorks Edge Constructor Issue Repro
define(['yfiles/impl/graph-styles-core'], (yfiles) => {
class ExtendingClass extends yfiles.styles.OMC {
constructor() {
super();
}
}
return {ExtendingClass}
});
<!DOCTYPE html>
<html>
<head>
<title>Edge Constructor Issue</title>
</head>
<body>
<h1>Edge Constructor Issue</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js"></script>
<script>
require.config({ baseUrl: 'http://live.yworks.com/yfiles-for-html/2.0/l-a61bcf8f42b1/' });
require([
'./ExtendingClass.js'
], demoStyles => {
let count = 0;
let id = window.setInterval(() => {
let style = new demoStyles.ExtendingClass();
count++;
if (count % 100 === 0) {
document.getElementById('iteration').innerText = count;
}
if (!(style instanceof demoStyles.ExtendingClass)) {
window.clearInterval(id);
alert("Instance is not an instance of the right class. It worked " + count + " times before."
+ "\ntoString: " + style.toString()
+ "\ntypeof: " + typeof(style)
);
}
}, 5)
});
</script>
<p>The test starts automatically. New instances are continuously created until an error is detected.</p>
<p>Iteration Count: <span id="iteration">0</span> ...</p>
<p>In Edge 40.15025.1000.0, this works fine until you open the dev tools. Then, the error is triggered after several
seconds (~5s) and our alert dialog is show.</p>
<p>If the dev tools are already open when the page is loaded, the error is not triggered until you close and re-open
them.</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment