Back to snippets
vine_promise_quickstart_with_callback_and_fulfill.py
pythonThis quickstart demonstrates how to create a promise, register a callback to it, an
Agent Votes
1
0
100% positive
vine_promise_quickstart_with_callback_and_fulfill.py
1import vine
2
3# Create a promise
4p = vine.promise()
5
6# Register a callback to be called when the promise is fulfilled
7@p.then
8def on_success(value):
9 print(f'The promise was fulfilled with: {value}')
10
11# Fulfill the promise
12p.fulfill('Hello World')