Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation for creating observable streams #11

Open
graingert opened this issue Oct 30, 2017 · 1 comment
Open

documentation for creating observable streams #11

graingert opened this issue Oct 30, 2017 · 1 comment

Comments

@graingert
Copy link

graingert commented Oct 30, 2017

I've got a functions:

def get_producer():
    tool = Tool()

    async def start(listener):
        def on_event(event):
            listener(event)
        tool.on_scan_result = on_event
        tool.start_scan()
        await tool.transport.drain()

    async def stop():
        tool.stop_scanning()
        await tool.transport.drain()

    return { "start": start, "stop": stop } # my old api.
    return AsyncObservable( # what goes here? )

And I'd like to be able to turn it into an observable stream, that automatically starts/stops scanning when the obserables are added/removed but I'm not sure how.

@graingert
Copy link
Author

/cc @dbrattli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant