Immediatelly resolve a Promise. Convenience function for creating a Promise that gets immediately resolved with the specified value. Arguments: resolve_value: The value to resolve the promise with.
(cls, resolve_value=None)
| 74 | |
| 75 | @classmethod |
| 76 | def resolve(cls, resolve_value=None): |
| 77 | """Immediatelly resolve a Promise. |
| 78 | |
| 79 | Convenience function for creating a Promise that gets immediately |
| 80 | resolved with the specified value. |
| 81 | |
| 82 | Arguments: |
| 83 | resolve_value: The value to resolve the promise with. |
| 84 | """ |
| 85 | def executor(resolve_fn): |
| 86 | return resolve_fn(resolve_value) |
| 87 | |
| 88 | return cls(executor) |
| 89 | |
| 90 | def then(self, callback): |
| 91 | """Create a new promise and chain it with this promise. |
no outgoing calls