Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create onMounting hook #6

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions copy-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const copy = require('copy');

copy('dist/*.js', 'example', ()=> console.log('copied pill.js build into example'));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part should be removed. It's presented in PR #10.

23 changes: 13 additions & 10 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@
<head>
<title>Main Page</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
<script type="text/javascript" src="/pill.js"></script>
</head>
<body>
<div id="indicator">Loading...</div>
<!-- PAGE CONTENT START -->
<div id='page'>
<div>
<nav>
<a href="/">Home</a>
<a href="/pages/a">Page A</a>
<a href="/pages/b">Page B</a>
<a href="/pages/x">Page X</a>
</nav>

<h1>Main page</h1>
<p>
Main page content.
<a href='#anchor'>Anchor</a>
</p>
<div style="height: 100vh"></div>
<p>
<a name="anchor"></a> <span>Anchor</span> <a href="/pages/a">Page A</a>
</p>
<main id="page">
<h1>Main page</h1>
<p>
Main page content.
<a href='#anchor'>Anchor</a>
</p>
<div style="height: 100vh"></div>
<p>
<a name="anchor"></a> <span>Anchor</span> <a href="/pages/a">Page A</a>
</p>
</main>
</div>
<!-- PAGE CONTENT END -->
<script src='/site.js' type='module'></script>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presented in PR #9

Expand Down
9 changes: 4 additions & 5 deletions example/pages/a.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
<html>
<head>
<title>Page A</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div id="indicator">Loading...</div>
<!-- PAGE CONTENT START -->
<div id='page'>
<div>
<nav>
<a href="/">Home</a>
<a href="/pages/a">Page A</a>
<a href="/pages/b">Page B</a>
</nav>
<h1>Page A</h1>
<main id='page'>
<h1>Page A</h1>
<p>
Page A content.
</p>
</main>
</div>
<!-- PAGE CONTENT END -->
<script src='/site.js' type='module'></script>
</body>
</html>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presented in PR #9

16 changes: 8 additions & 8 deletions example/pages/b.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
<html>
<head>
<title>Page B</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div id="indicator">Loading...</div>
<!-- PAGE CONTENT START -->
<div id='page'>
<div>
<nav>
<a href="/">Home</a>
<a href="/pages/a">Page A</a>
<a href="/pages/b">Page B</a>
</nav>
<h1>Page B</h1>
<p>
Page B content.
</p>
<main id='page'>
<h1>Page B</h1>
<p>
Page B content.
</p>
</main>

</div>
<!-- PAGE CONTENT END -->
<script src='/site.js' type='module'></script>
</body>
</html>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presented in PR #9

1 change: 1 addition & 0 deletions example/pill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/site.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import pill from '/pill.js'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conflicts with PR #9


const indicator = document.getElementById('indicator');

Expand All @@ -16,5 +16,8 @@ pill('#page', {
timeout = setTimeout(() => {
indicator.style.display = 'none';
}, 1000)
},
onMounting(){
console.log('content is mounting');
}
})
Loading