mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-19 20:19:05 +00:00
Adds an app skeleton. Still needs some work.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { Component } from 'preact';
|
||||
|
||||
export function updater(obj, property, value) {
|
||||
return e => {
|
||||
let update = {};
|
||||
@@ -8,3 +10,10 @@ export function updater(obj, property, value) {
|
||||
|
||||
export const toggle = value => !value;
|
||||
|
||||
export class When extends Component {
|
||||
state = { ready: !!this.props.value };
|
||||
render({ value, children: [child] }, { ready }) {
|
||||
if (value && !ready) this.setState({ ready: true });
|
||||
return ready ? (typeof child === 'function' ? child() : child) : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user