-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from vvideo/example
Add CommonJS support
- Loading branch information
Showing
8 changed files
with
1,225 additions
and
4,042 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# v1.2.0 | ||
- Add CommonJS support. | ||
- Add example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Calc Aspect Ratio</title> | ||
<meta charset="utf-8" /> | ||
<style> | ||
html, body { | ||
padding: 0; | ||
margin: 0; | ||
border: 0; | ||
background: black; | ||
color: white; | ||
} | ||
|
||
.screen { | ||
position: fixed; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate(-50%, -50%); | ||
font-size: 30px; | ||
} | ||
|
||
.screen__title { | ||
font-size: 40px; | ||
margin-bottom: 5px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="screen"> | ||
<div class="screen__title">Your screen</div> | ||
<div class="screen__size"> | ||
Size: <span class="screen__size-value"></span> | ||
</div> | ||
<div class="screen__aspect-ratio"> | ||
Aspect ratio: <span class="screen__aspect-ratio-value"></span> | ||
</div> | ||
</div> | ||
<script type="module"> | ||
import { calcAspectRatio } from 'https://unpkg.com/calc-aspect-ratio/dist/index.esm.js'; | ||
|
||
const screenWidth = window.screen.width; | ||
const screenHeight = window.screen.height; | ||
|
||
const sizeElem = document.querySelector('.screen__size-value'); | ||
const aspectRatioElem = document.querySelector('.screen__aspect-ratio-value'); | ||
|
||
function updateText() { | ||
sizeElem.innerHTML = `${screenWidth}×${screenHeight}`; | ||
|
||
const aspectRatio = calcAspectRatio(screenWidth, screenHeight) | ||
aspectRatioElem.innerHTML = aspectRatio.value; | ||
} | ||
|
||
setInterval(updateText, 1000); | ||
updateText(); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.