-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
infinite loop inside of live() #6
Comments
I see 🤔, don’t worry 😉, I’ll try to fix that for you as soon as possible. The In the next week, I’ll try to fix every function to deliver the Thank you 🙏 for submitting this issue 😊. |
Just to make sure, why are you using |
For the moment, you can use: var cart = {
amount: 0.0,
charge: 0.0
};
var $djs = new DisplayJS(cart);
$djs.var();
$djs.target(function () {
var charge = calcCharge(parseInt(cart.amount));
cart["charge"] = charge;
$djs.var()
});
function calcCharge(goal) {
var stripeFixed = 0.3;
var stripePercent = 0.029;
var numerator = goal + stripeFixed;
var denominator = 1.0 - stripePercent;
var charge = numerator / denominator;
return charge;
} |
I didn't mean to leave the "self" in there. I was trying something else and forgot to remove it. It's gone now. |
@guyjacks Also, the |
I just got it working with the code you shared above. Thank you. |
The problem was that you triggered 2 things in the exact moment (which is technically impossible in JavaScript, but because I'm dealing with low-level APIs, there is bugs), but because JavaScript is a working on single core, your browser that simply doesn't want to crash skip this step 😊 |
https://codepen.io/guyjacks/pen/eRwadE
This is probably more of a javascript issue than an issue with DJS, but I can't figure out how to prevent an infinite loop from occurring when I update the variable that I'm watching.
I don't see the difference between my example and the dog example in the docs.
I love this little framework... Cheers!
The text was updated successfully, but these errors were encountered: