0.3.0 • Published 11 months ago
@web-companions/h v0.3.0
A set of helper functions
Installation
npm install @web-companions/h --save
Usage
css
index.jsx
import { css } from '@web-companions/h';
<div>
<span
style={css`
color: red;
`}
>
Red text
</span>
</div>
setStyle
index.jsx
import { setStyle } from '@web-companions/h';
// domNode is an Element or ShadowRoot
setStyle(require('./style.css'), domNode);
instantMapper
The easier and simples mapper for EG. It will update a component's property immediately without waiting other changes.
NOTE: Use it only if you want to maximal speed up you component.
! Pay attention that it's not possible to change several different properties inside one updating iteration with this mapper.
index.jsx
import { instantMapper } from '@web-companions/h';
import { EG } from '@web-companions/gfc';
import { render } from 'lit-html';
let sum = 0;
export const demoElement = EG(
mapper: instantMapper
)(function* () {
let state: number = 0;
const setState = (newState: number) => {
state = newState;
this.next();
};
while (true) {
if (state < 5) {
setState(++sum);
}
yield render(<div>Sum Immediate - {String(state)}</div>, this);
}
});
License
0.3.0
11 months ago
0.2.3
11 months ago
0.3.0-alpha.0
11 months ago
0.2.3-develop.0
1 year ago
0.1.0
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.2.0-develop.0
2 years ago
0.2.2
2 years ago
0.1.0-develop.1
2 years ago
0.1.0-develop.2
2 years ago
0.0.1
3 years ago
0.1.0-develop.0
4 years ago