Shaare your links...
3229 links
L!NKS
Retour au blog
Login
RSS Feed
ATOM Feed
Tag cloud
Picture wall
Daily
Links per page:
20
50
100
page 1 / 1
CoursWeb.ch - javascript - Apply et Call
Bon Javascript m'agace...
J'en ai besoin alors je me dis je fais ça propre avec des classes. Et alors je suis confronté au problème "this".
"this" a la fâcheuse tendance à référer à l'instance appelante (normal) ce qui devient rugueux quand on a besoin de "son this" dans une fonction appelée en AJAX dans "onreadystatechange" ou dans un "addEventListener". J'ai dû passer par des copies de "this" (var that = this), des "apply" ou dans le cas de "addeventlistener" par un "bind"...
Merci à Stackoverflow et à toutes les ressources en ligne !
onreadystatechange:
http://fr.openclassrooms.com/forum/sujet/ajax-onreadystatechange-et-this-en-poo
https://stackoverflow.com/questions/19298112/returning-values-from-the-event-onreadystatechange-in-ajax
addEventListener:
https://stackoverflow.com/questions/1338599/the-value-of-this-within-the-handler-using-addeventlistener
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#The_value_of_this_within_the_handler
plus je pratique javascript, plus j'aime python ! (mais bon, je progresse)
permalink
-
-
http://www.coursweb.ch/javascript/apply-call.html
javascript
Links per page:
20
50
100
page 1 / 1