Skip to content

Instantly share code, notes, and snippets.

@jhpedemonte
Last active October 7, 2015 19:02
Show Gist options
  • Save jhpedemonte/5193b20258742172778c to your computer and use it in GitHub Desktop.
Save jhpedemonte/5193b20258742172778c to your computer and use it in GitHub Desktop.
Shows timing issue when using Urth Polymer import. See https://github.com/jupyter-incubator/declarativewidgets/issues/25
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from urth.widgets.widget_channels import channel"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%%html\n",
"<link rel=\"import\" href=\"./static/urth_components/paper-toggle-button/paper-toggle-button.html\"\n",
" is=\"urth-core-import\" package=\"PolymerElements/paper-toggle-button\">\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"## comment out these lines as a \"workaround\" for the timing issue\n",
"# import time\n",
"# time.sleep(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"%%html\n",
"\n",
"<dom-module id=\"dynamic-list\">\n",
" <template>\n",
" <paper-toggle-button checked=\"{{liveUpdate}}\"></paper-toggle-button>\n",
" </template>\n",
"\n",
" <script>\n",
" (function () {\n",
" 'use strict';\n",
"\n",
" Polymer({\n",
" is: 'dynamic-list',\n",
"\n",
" properties: {\n",
" liveUpdate: {\n",
" type: Boolean,\n",
" value: true,\n",
" observer: '_liveUpdateChanged'\n",
" }\n",
" },\n",
"\n",
" _liveUpdateChanged: function(newVal, oldVal) {\n",
" console.log('live update:',this.liveUpdate);\n",
" }\n",
" });\n",
" })();\n",
" </script>\n",
"</dom-module>\n",
"\n",
"<dynamic-list></dynamic-list>\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment