Skip to content

Instantly share code, notes, and snippets.

@oeway
Created February 11, 2019 12:52
Show Gist options
  • Save oeway/0654908f0e7f0b74ea40cb4ff561940e to your computer and use it in GitHub Desktop.
Save oeway/0654908f0e7f0b74ea40cb4ff561940e to your computer and use it in GitHub Desktop.
<docs lang="markdown">
[TODO: write documentation for this plugin.]
</docs>
<config lang="json">
{
"name": "PromiseTimerDemo",
"type": "web-python",
"version": "0.1.0",
"api_version": "0.1.2",
"description": "This demo uses promise to interact with js setTimeout",
"tags": [],
"ui": "UI for this plugin",
"inputs": null,
"outputs": null,
"flags": [],
"icon": "extension",
"env": "",
"requirements": [],
"dependencies": []
}
</config>
<script lang="python">
class ImJoyPlugin():
def setup(self):
print('setup in python')
def run(self, my):
api.alert('starting a 5s timer...')
def timeout_callback(_):
api.alert('timeout')
api.utils.sleep(5).then(timeout_callback)
api.export(ImJoyPlugin())
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment