Skip to content

Commit

Permalink
Merge pull request #8 from stagfoo/feature/tidy
Browse files Browse the repository at this point in the history
Feature/tidy
  • Loading branch information
stagfoo authored Jul 28, 2020
2 parents 1856b7e + c75f662 commit a971b64
Show file tree
Hide file tree
Showing 8 changed files with 9,671 additions and 27 deletions.
19 changes: 0 additions & 19 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -389,24 +389,5 @@

<body>
<div id="app"></div>
<script>
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("./service-worker.js", {
scope: "."
}).then(
(registration) => {
console.log(
`ServiceWorker registration successful with scope: ${registration.scope}`
);
registration.pushManager.subscribe({userVisibleOnly: true});
},
(error) => {
console.log(`ServiceWorker registration failed: ${error}`);
}
);
});
}
</script>
</body>
</html>
9,662 changes: 9,662 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"joro": "^1.0.4",
"morphdom": "^2.5.12",
"nanohtml": "^1.9.0",
"nanomorph": "^5.4.2",
"obake.js": "^1.0.1",
"page": "^1.11.4"
},
Expand Down
2 changes: 1 addition & 1 deletion src/actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { state } from './index';

export function handleGreetingClick() {
state._update('changeGreeting', state.greeting + '🍖')
state._update('updateGreeting', state.greeting + '🍖')
};
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { hydrateState, dehydrateState} from 'utils'
import { createStore } from 'obake.js';
import { AppRoot } from './ui';
import { BaseStyles } from './styles';
import morphdom from 'morphdom';
import morph from 'nanomorph';

//Default render
const ROOT_NODE = document.body.querySelector('#app');
Expand All @@ -19,10 +19,13 @@ export const state = createStore(
},
reducers
);

//Render Loop function
function renderer(newState) {
morphdom(ROOT_NODE, AppRoot(newState), {
morph(ROOT_NODE, AppRoot(newState), {
onBeforeElUpdated: function(fromEl, toEl) {
// spec - https://dom.spec.whatwg.org/#concept-node-equals

if (fromEl.isEqualNode(toEl)) {
return false
}
Expand All @@ -31,7 +34,6 @@ function renderer(newState) {
})
}
//Start Router listener
//too fast for fonts
startRouters();
BaseStyles();

Expand Down
2 changes: 1 addition & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const reducers = {
updateCurrentPage: reducer((state, value: string) => {
state.currentPage = { name: value, activePage:activePage[value] };
}),
changeGreeting: reducer((state, value: string) => {
updateGreeting: reducer((state, value: string) => {
state.greeting = value;
}),
updateNotification: reducer((state, value:{text: string, show: boolean}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const HOME_PAGE = (ctx: Context, next: any) => {
};
const EXAMPLE_FETCH = (ctx: Context, next: any) => {
getData('chum').then(data => {
state._update('changeGreeting', data.greeting)
state._update('updateGreeting', data.greeting)
state._update('updateCurrentPage', 'EXAMPLE_FETCH')
state._update('updateNotification', {
text: "Shark data loaded (´ε` )♡",
Expand Down
2 changes: 0 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ module.exports = {
cacheId: `${new Date().getTime()}`,
cleanupOutdatedCaches: true,
inlineWorkboxRuntime: true,
navigateFallback: "index.html",
include:[
"main.bundle.js",
"index.html",
"data.json",
],
clientsClaim: true,
Expand Down

1 comment on commit a971b64

@vercel
Copy link

@vercel vercel bot commented on a971b64 Jul 28, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.