-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtemplate.html
More file actions
96 lines (81 loc) · 2.72 KB
/
template.html
File metadata and controls
96 lines (81 loc) · 2.72 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Yo Hello World Page</title>
<style>
body {
font-family: system-ui, sans-serif;
padding: 2rem;
line-height: 1.6;
max-width: 900px;
margin: 0 auto;
}
pre, code {
background: #f4f4f4;
padding: 0.2em 0.4em;
border-radius: 4px;
}
pre {
padding: 1rem;
}
</style>
<!-- STRING will be replaced -->
<script src="YOUR_MINIFIED_SCRIPT"></script>
</head>
<body>
<h1>Yo - Test Page</h1>
<p>This is a starter page to test your <code>Yo</code> script.</p>
<p>Open the browser console (F12) to see output.</p>
<hr>
<h2>Yo - Public Methods</h2>
<h3>Argument Checker</h3>
<p>check multiple is type of by feeding 2 arrays, 1 of the values and the other containing the types they should be</p>
<pre><code>// returns: true/false
const plinky = YourYo.argumentChecker(
[1,'',[],{},undefined, null],
['Number', 'String', 'Array', 'Object', 'Undefined', 'Null']
);</code></pre>
<h3>is Type of</h3>
<p>check multiple is type of by feeding 2 arrays, 1 of the values and the other containing the types they should be</p>
<pre><code>// returns: true/false
const plinky = YourYo.argumentChecker(
[1,'',[],{},undefined, null],
['Number', 'String', 'Array', 'Object', 'Undefined', 'Null']
);</code></pre>
<hr>
<h2>Your Custom Scripts can go here</h2>
<script>
// Namespace setup - feel free to change
var CompanyName = window.CompanyName || {};
CompanyName.whatever = CompanyName.whatever || {};
var YourYo = new Yo();
YourYo.init({
namespace: CompanyName.whatever,
scriptRoot: 'scriptiesHere', // ← customize if needed
// globalDependencies: { ... },
// debugMode: true,
// debugScripts: ['myCoolWidget', 'data.something']
});
// ←←←←←←←←←←←←←←←←←←←←←←←←←←←←
// Write your test code / examples below!
// Feel free to delete or comment out anything here
// ←←←←←←←←←←←←←←←←←←←←←←←←←←←←
console.log("YourYo instance:", YourYo);
// Example: YourYo.add('test.hello', () => console.log("Hello from Yo!"));
console.log( YourYo.isTypeOf('Array', []) );
console.log( YourYo.argumentChecker([1,'',[],{},undefined], ['Number', 'String', 'Array', 'Object', 'Undefined']) );
YourYo.add("something", { egg: 'the.egg' }, (dep) => {
console.log(`Something ${dep.egg.say()}`);
});
YourYo.add("the.egg", () => {
return {
say: () => {
return 'The EGG'
}
}
});
</script>
</body>
</html>