Skip to content

Commit

Permalink
📝 Update examples with set_listener instead of add_listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Apr 25, 2024
1 parent b13b8ec commit d604ae6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions examples/3_Functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,21 @@
"metadata": {},
"outputs": [],
"source": [
"def getObjectData(data):\n",
"def get_object_data(data):\n",
" print(\"It clicked.\")\n",
" return data\n",
"\n",
"\n",
"def getObjectRaDecProduct(data):\n",
"def get_object_ra_dec_product(data):\n",
" return data[\"ra\"] * data[\"dec\"]\n",
"\n",
"\n",
"# when triggered, the listeners on the js side of the application will send a\n",
"# json object whose parameter data will be used by the python functions\n",
"# (data is a literal object on the js side, it will be converted as a dictionary\n",
"# object on the python side)\n",
"aladin.add_listener(\"object_hovered\", getObjectRaDecProduct)\n",
"aladin.add_listener(\"object_clicked\", getObjectData)"
"aladin.set_listener(\"object_hovered\", get_object_ra_dec_product)\n",
"aladin.set_listener(\"object_clicked\", get_object_data)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/7_on-click-callback.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
" info.value = \"<h2>%s</h2><br><br>%s\" % (obj_name, sed_img)\n",
"\n",
"\n",
"aladin.add_listener(\"click\", process_result)"
"aladin.set_listener(\"click\", process_result)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/8_Rectangular-selection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
" table_info.value = s\n",
"\n",
"\n",
"aladin.add_listener(\"select\", process_result)"
"aladin.set_listener(\"select\", process_result)"
]
}
],
Expand Down

0 comments on commit d604ae6

Please sign in to comment.