-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
48 lines (39 loc) · 1.37 KB
/
example.html
File metadata and controls
48 lines (39 loc) · 1.37 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JS Hook System</title>
<script src="./src/hook.js"></script>
</head>
<body>
<p id="product-name"></p>
<p id="product-price"></p>
<script>
function test() {
var name = document.getElementById('product-name');
var price = document.getElementById('product-price');
// Set up the hooks
Hook.register('_PRODUCT_NAME', function (args) {
return args + ' <small style="color: blue;">Test Category</small>';
});
Hook.register('_PRODUCT_PRICE', function (args) {
return args + 10;
});
Hook.register('_PRODUCT_PRICE', function (args) {
return args + 10;
});
Hook.register('_PRODUCT_PRICE', function (args) {
return args + 10;
});
Hook.register('_PRODUCT_PRICE', function (args) {
return args + 10;
});
name.innerHTML = 'Product Name: ' + Hook.call('_PRODUCT_NAME', 'Test Product');
price.innerHTML = 'Product Price: $' + Hook.call('_PRODUCT_PRICE', 10);
}
test();
</script>
</body>
</html>