1
0
mirror of synced 2025-11-08 21:07:23 +00:00

feat(examples): improve browser usage example

This commit is contained in:
Jason Dreyzehner
2017-02-12 16:15:08 -05:00
parent 5f18048ab7
commit c8199e72ce
6 changed files with 70 additions and 18 deletions

View File

@@ -1,3 +1,10 @@
<html><body>
<script src="test.js" />
</body></html>
<html>
<head>
<script src="test.js"></script>
</head>
<body>
</body>
</html>

View File

@@ -1,10 +1,24 @@
// Note: we're not using the double method, so it should be excluded from the bundle
import { power, asyncABC } from '../../../'
if (power(3,4) === 81) {
console.log('✔ power(3,4) === 81')
} else {
console.error('The "power" method seems to be broken.')
let output = ''
function log(str: string) {
console.log(str)
output += str + '\n'
}
asyncABC().then( abc => console.log('✔ asyncABC returned:', abc) )
function logAndAlert(data: string[]) {
log('✔ asyncABC returned: ' + data)
window.alert(output)
}
log('Output:')
if (power(3,4) === 81) {
log('✔ power(3,4) === 81')
} else {
log('The "power" method seems to be broken.')
}
asyncABC().then( abc => logAndAlert(abc) )