Skip to content

Commit 29c38b2

Browse files
committed
Add blob url to example page
1 parent 86d1913 commit 29c38b2

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

example/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<button onclick="testOptions()">test options</button>
3939
<button onclick="throwString()">throw string</button>
4040
<button onclick="showDialog()">show dialog</button>
41+
<button onclick="blobExample()">blob example</button>
4142

4243
</body>
4344
</html>

example/scratch.js

+16
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ function showDialog() {
4646
Raven.showReportDialog();
4747
}
4848

49+
function blobExample() {
50+
var xhr = new XMLHttpRequest();
51+
xhr.open('GET', 'stack.js');
52+
xhr.onreadystatechange = function () {
53+
if (xhr.readyState === 4) {
54+
var blob = new Blob([xhr.responseText], {type: 'application/javascript'});
55+
var url = URL.createObjectURL(blob);
56+
57+
var script = document.createElement('script');
58+
script.src = url;
59+
document.head.appendChild(script);
60+
}
61+
};
62+
xhr.send();
63+
}
64+
4965
function a() { b(); }
5066
function b() { c(); }
5167
function c() { d(); }

example/stack.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(function () {
2+
function bar() {
3+
baz();
4+
}
5+
6+
function foo() {
7+
bar();
8+
}
9+
10+
foo();
11+
})();

0 commit comments

Comments
 (0)