-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlottie-polyfill.js
84 lines (64 loc) · 1.87 KB
/
lottie-polyfill.js
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
var navigator = null
var window = null
var document = null
function doBug() {
function initiateExpression() {
var time=5;
function executeExpression() {
time = 20;
var func = eval("[function(){ console.log(time); }]")[0]
func()
}
return executeExpression;
}
var execExpr = initiateExpression();
execExpr();
}
function setInterval(callback, interval) {
console.log("STUB setInterval", callback, interval)
// callback()
}
function setTimeout(callback, interval) {
if (interval === 0) {
Qt.callLater(callback)
} else {
throw "<93490585> Unsupported interval:" + interval
}
}
function initialize(canvas) {
doBug();
var internalNavigator = {};
var internalWindow = {};
var internalDocument = {
createElement: function (type) {
if (type === "canvas") {
return canvas
} else {
throw "<93490585> Unsupported type:" + type
}
},
getElementsByTagName: function (tagName) {
if (tagName === "script") {
return []
} else {
throw "<0586916a> Unsupported tag name:" + tagName
}
}
};
navigator = internalNavigator
document = internalDocument
window = internalWindow
var result = Qt.include("lottie.js")
console.log(result.status, result.exception, JSON.stringify(window))
return window.lottie
// function func() {
// console.log("Hello!")
// lottie.loadAnimation({
// container: element, // the dom element that will contain the animation
// renderer: 'canvas',
// loop: true,
// autoplay: true,
// path: 'data.json' // the path to the animation json
// });
// }
}