Comments (7)
I see π€, donβt worry π, Iβll try to fix that for you as soon as possible. The $.live()
function will always have some bugs because Iβm trying to implement non-standards functions (in this case, Object.prototype.watch()
). Iβm nearly sure that the problem comes from the function itself.
In the next week, Iβll try to fix every function to deliver the v1.0.0
of DisplayJS as soon as possible.
Thank you π for submitting this issue π.
from displayjs.
Just to make sure, why are you using self
in the Λ$.live()Λ function? I think π€ there is an issue here, because the ΛselfΛ object is not ment to be use here π.
from displayjs.
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;
}
from displayjs.
I didn't mean to leave the "self" in there. I was trying something else and forgot to remove it. It's gone now.
from displayjs.
@guyjacks Also, the $.live()
is not a function that should be used often, especially in small projects. DisplayJS have a lot of way to dynamically update values. So, I simply used a callback in the $.target()
function to update everything π
from displayjs.
I just got it working with the code you shared above. Thank you.
from displayjs.
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 π
from displayjs.
Related Issues (20)
- repeat function with updating data
- .repeat example doesn't work
- $.component is not useful. HOT 4
- $.load() how to load a html page? HOT 1
- a wrong word HOT 3
- $.empty() is not work very well HOT 3
- $.css() how to set more CSS properties for the set of matched elements. HOT 1
- i tried the example but i get a opposite result HOT 1
- Hacktoberfest HOT 10
- Adding ability for var to assign to attributes? HOT 2
- Typos in landing page
- Repeat in array with objects HOT 4
- jQuery conflict HOT 3
- TODO MVC challenge HOT 2
- bloat HOT 3
- jsfiddle test `undefined` HOT 2
- Check radio button or checkboxes with $.var? HOT 1
- Load Help HOT 3
- How to change the src of an img? HOT 1
- Run a function when target variable changes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from displayjs.