You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think the { onceOnly: boolean } option works the way i want. I think it applies to each element it finds in the selector. I don't want this, I want something that I don't think the library can do: I want the observer to fire only once, regardless of how many elements I set it on.
e.g.,
$(document).arrive("li", { fireOnce: true}, function() {
// tell me the FIRST TIME a li element shows up.
});
This is useful because I don't want to fire it until a li is visible on the page, but I also don't want to run the body of the function more than once.
Honestly, this and a lot of other useful features could be used if the API let you pass in a jquery instead of a string.
$(document).arrive($("li").first(), function() {
// tell me the FIRST TIME a li element shows up.
});
Of course, the library is a black box to me, and I don't know if that's a feasible implementation.
The text was updated successfully, but these errors were encountered:
document.arrive(".class",{fireOnAttributesModification:true,existing:true,onceOnly:true},function(){document.unbindArrive(".class")console.log('only called once')});
Unfortunately it is called for each element of class "class"
I found this because I wanted to make sure that it was fired once for each element matching the selector.
The suggestion would be a non-obvious breaking change if changing the functionality of onceOnly, so if implemented it should be a new parameter, or at least make it an obvious breaking change by renaming onceOnly to onceOnlyPerElement and adding a new parameter for the new functionality.
I don't think the { onceOnly: boolean } option works the way i want. I think it applies to each element it finds in the selector. I don't want this, I want something that I don't think the library can do: I want the observer to fire only once, regardless of how many elements I set it on.
e.g.,
This is useful because I don't want to fire it until a li is visible on the page, but I also don't want to run the body of the function more than once.
Honestly, this and a lot of other useful features could be used if the API let you pass in a jquery instead of a string.
Of course, the library is a black box to me, and I don't know if that's a feasible implementation.
The text was updated successfully, but these errors were encountered: