eco-state
Version:
Light Weight Asynchronous JavaScript Eco friendly State Management Library.
29 lines (26 loc) • 848 B
HTML
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Eco State</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<script src='../dist/eco-state.min.js'></script>
</head>
<body>
<script>
ecoState.createListeners('localData', null, (state, action) => {
return {
date: action.payload
}
});
ecoState.registerToUpdate((state) => console.log('new data', state['localData']));
ecoState.eventCreator('localData', {payload: 423423})
ecoState.eventCreator('localData', {payload: 454})
setTimeout(() => {
console.log('emitting');
ecoState.eventCreator('localData', {payload: 454333});
}, 3000);
</script>
</body>
</html>