event-handling

Can I pass more arguments into event handler functions in Javascript?

笑着哭i 提交于 2019-12-25 18:52:01
问题 I have been trying to find out more about mouse events such as onmouseover , onmouseout and onmousemove but there is not much info. It seems these event handlers by default have a single argument, the event its self. element.onmouseover = mouseoverFunction function mouseoverFunction( event ) { // Do stuff here } However I want to be able to pass other arguments to into the function. function mouseoverFunction( event, moreArgs ) { // Do stuff here } How do I pass the event argument and

Serialising my class is failing because of an eventhandler

旧时模样 提交于 2019-12-25 11:56:20
问题 I wasn't expecting to come across this error. I imagine I'm doing something wrong somewhere else. I have an MVVM application. My model can serialise its self using a BinaryFormatter . This was working fine. Today I added in an event handler to my model, and the viewmodel that contains the model subscribes to this event. Now when I try and serialise the model I get an error because my viewmodel isn't serialisable (by design). I am sure it's down to the subscription to the event, because I've

How should I reorganize my control flow for query based on radio input selected?

南楼画角 提交于 2019-12-25 11:53:45
问题 I've been listening to the click event of label elements, but the selected input[type="radio"] does not seem to update during the event. Should I be listening to a different event or do I need to change my control flow somehow? Below is the code: $(function() { $('#reported label').click(function() { var query = $('input[name="filter"]:checked').val(); var time = (new Date()).toString(); // this is filler but I'm actually making an xhr request here $('.query[data-method="click"]').html(query

How to reset all other noUiSliders but the one the user is playing with?

懵懂的女人 提交于 2019-12-25 09:13:16
问题 I have multiple sliders, each of them linked to form fields. When any of them gets updated, either by dragging or typing, I want to reset all the others. The reason for this is that I want the user to save his changes to one slider (form) before he tries to change another. Else, I reset the changes. I can't listen to the update or set events and call .set() on the other sliders, because that would trigger an endless loop. So how can I reset a slider without triggering any event? Or anyone has

Event handler inside event handler is multiplying

故事扮演 提交于 2019-12-25 08:48:01
问题 I have this code jQuery('#parent').on('click', jQuery('#fileInput'), function (e) { jQuery(e.target).attr('data-fileurl', ''); jQuery('#parent').on('change', jQuery('#fileInput'), function (e) { usefulFunction(jQuery(e.target); } } The idea is to detect if cancel was chosen on file browse, and it succeeds at that. The problem is if I click it again, then it will run the .on('chance') twice and thus run usefulFunction . Each click adds a change event handler. usefulFunction should only be run

Access data from Firebase Service in main thread

一曲冷凌霜 提交于 2019-12-25 08:28:36
问题 I am programming an app that receives some data from a FCM message, then updates the UI based on the data payload contained in the message. The service runs fine, and receives the data, but I cant figure out how to get it back to my main activity. The Firebase service is declared in my manifest as <service android:name=".MyFirebaseService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> In my MyFirebaseService class I have overridden

Handling an event on a dynamically-added Button after postback

浪子不回头ぞ 提交于 2019-12-25 08:26:15
问题 Basically, I have an update panel in which i have a link button, when user clicks on the link button all the contents are cleared and textbox shows up in which user enters something and when user hit enter key, the update panel should be refreshed or gets updated or repopulated with all the contents . How can I do it ??? The way I am trying to do this is that when event handler of link button is fired, I created a hidden button dynamically and assign it a new event handler which will get

Getting mysql field data when a link is clicked?

放肆的年华 提交于 2019-12-25 07:47:57
问题 I'm trying to get data from a database if a link is clicked. Basically i have a main.php that contains this: $sql2="SELECT projectsid, projectname, description, SUBSTRING(description,0,80) FROM projects"; $result2=mysql_query($sql2); while($row2 = mysql_fetch_assoc($result2)) { echo "<div id=\"links\">"; echo "<ul>"; echo "<li> <a href=\"fullproject.php\">" . $row2['projectname']; $_SESSION['projectname']= $row2['projectname']; echo "<em>" . $row2['description'] . "</em></a></li>"; echo "</ul

Do Javascript bindings take up memory while not in use?

让人想犯罪 __ 提交于 2019-12-25 06:44:28
问题 I have a calendar that I've built, and on clicking a day on the calendar, a function is run. You can go month to month on the calendar, and it generates months as it goes. Since every day on the calendar, shown or not, is binded to an event using the class of all the "days," I'm worried about the number of "bindings" building up into the thousands. //after a new month is generated, the days are rebound TDs.off("mousedown"); TDs = $(".tableDay"); TDs.on("mousedown", TDmouseDown); While I was

Web Audio API- onended event scope

与世无争的帅哥 提交于 2019-12-25 05:29:27
问题 I'm having a tricky issue with the Web Audio API AudioSourceBufferNode and its onended event. Basically what I'd like to do is have two AudioSourceBufferNodes that are each triggered when the other one finishes and keep playing back-and-forth. I understand that AudioSourceBufferNodes are pretty much done once you call start() and they're designed to be garbage-collected after this. So I tried to work around that like so: var source1; var source2; source1 = getSound(buffer1); source2 =