forked from pieterv/wire
/
init-error.html
80 lines (67 loc) · 2.19 KB
/
init-error.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Init error test</title>
<script src="test-config.js"></script>
<script type="text/javascript">
function error(p) {
throw new Error();
}
define('init-error', [], function() {
function Constructor() {}
Constructor.prototype = {
init: error
};
return Constructor;
});
define('test-plugin', function() {
return {
wire$plugin: function() {
return {
facets: {
error: {
// create: error,
// configure: error
// initialize: error
ready: error
}
}
}
}
}
});
require(['wire'], function(wire) {
doh.register('init-error', [
function(doh) {
var dohd = new doh.Deferred();
wire({
plugins: [
// { module: 'wire/debug' },
{ module: 'test-plugin' }
],
// test1 should should be called as a constructor using new
test: {
create: 'init-error',
error: 'init'
}
}).then(
function(context) {
console.log(context);
console.error(context);
dohd.errback('wire() should not have succeeded');
},
function(err) {
dohd.callback(true);
}
);
return dohd;
}
]);
doh.run();
});
</script>
</head>
<body>
</body>
</html>