Comments (5)
@stijnie2210 thank you for the suggestion, this should already be possible to do with this.emit
, but the Emitter is not passed to the method yet.
I will try this out in a few testcases to see how best it would work in typescript
-- although I based this package on the dart implementation I dont want to just copy the features blindly. But this feature seems pretty straight forward 👍
from blac.
from blac.
@stijnie2210 all the react components are part of the BlocReact
class you create at the moment,
in my state.ts
file I export them like this:
const state = new BlocReact();
export const { useBloc, BlocProvider, withBlocProvider, BlocBuilder } = state;
this is to easily keep track of the context right now, but I would like to improve this that you can just just import {BlocBuilder} from 'bloc-react'
, but thats not possibly yet
from blac.
@stijnie2210 what I said before was not correct, you cannot use this.emit
on a Bloc, only in Cubits. I have now update the Bloc implementation to be more like the new bloclibrary bloc implementation
Now you can use this.on(<event>, async (event, emit) => ...)
and use emit
as many times as you like :) in JS you need to define the function as async
to use await
.
I have also update the readme: https://github.com/jsnanigans/bloc-react#bloc
also have a look at this component: https://github.com/jsnanigans/bloc-react/blob/main/src/react/components/LazyToggle.tsx
I have created an example that should fit your use-case nicely
I will close this for now, but please let me know if you have any other issues!
Fixed in https://github.com/jsnanigans/bloc-react/releases/tag/v0.2.0
from blac.
from blac.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blac.