import { html, render } from 'lit'
import { provide, connect } from './unlit'
const app = provide(store)( () => html`<div>${counter}</div>` )
const counter = connect('count', {
This file contains hidden or 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
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
// HTML files: try the network first, then the cache. | |
// Other files: try the cache first, then the network. | |
// Both: cache a fresh version if possible. | |
// (beware: the cache will grow and grow; there's no cleanup) | |
const cacheName = 'files'; |
This file contains hidden or 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
.background { | |
will-change: opacity; | |
transition: opacity 250ms; | |
visibility: hidden; | |
opacity: 0; | |
position: fixed; | |
top: 0; | |
left: 0; |
This file contains hidden or 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
import React from 'react' | |
import styled from 'styled-components' | |
function flex(name, defaultValue) { | |
return (props) => { | |
let value = props[name] | |
if (!value && typeof defaultValue === 'undefined') return '' | |
if (!value) value = defaultValue | |
return `flex-${name}: ${value};` | |
} |
Infinite list: Automatically lazy-loads content from a data source as the user scrolls, view-recycling as necessary.
Lazy-load image: Won't load the resource until it is on or near the screen.
Pull to refresh: Recreate the "pull down to refresh" UI from iOS and Android.
Carousel: Side scroller that handles lazy-loading and optionally snaps to elements.
Multi-line ellipsis: Automatically hide text and replace with a fade/ellipsis after a specified number of lines.
This file contains hidden or 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
// "counter.react" | |
import {format} from 'externalLib'; | |
state { | |
// acts like default state | |
counter = 0; | |
} | |
props { |
This file contains hidden or 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
if (typeof window!=='undefined' && navigator.serviceWorker && navigator.serviceWorker.controller) { | |
let reloadOnNext = false; | |
let pushState = history.pushState; | |
history.pushState = function(state, title, url) { | |
pushState.call(this, state, title, url); | |
if (reloadOnNext===true) location.reload(true); | |
}; | |
navigator.serviceWorker.controller.addEventListener('statechange', e => { |
This file contains hidden or 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
import { h, Component } from 'preact'; | |
import { Router } from 'preact-router'; | |
import Header from './header'; | |
import Home from '../routes/home'; | |
import Profile from '../routes/profile'; | |
import NotifyChange from "./NotifyChange/index"; | |
// import Home from 'async!../routes/home'; | |
// import Profile from 'async!../routes/profile'; |
This file contains hidden or 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
// add this please | |
// add this please | |
require("preact-cli/lib/lib/webpack/polyfills"); | |
// look above | |
import { h } from "preact"; | |
import habitat from "preact-habitat"; | |
import Widget from "./components/hello-world"; |