Open arselzer opened 10 years ago
If you can see the commented code above the require()
you will see that I used to use your super-old-long-outdated-forever-lost-and-never-again-retrieved callback function for getting things from the server.
You have the freedom to add anything to my branch. So if you have a vision of how to do it then do it. As long as you don't break any code... Oh Wait! nvm we are using git
Could you please explain to me which function you mean?
Why do you empathize callback?
Where is a function for getting things from a server? I see none, sorry.
How is it 'old' and 'long'?
Please explain 'outdated'. I do not understand your complaints.
I only have the "vision" of making client-side usage of the library possible, for the app to work.
BTW, we should maybe consider integrating it into the master branch soon. Much looks stable. We are in alpha anyway.
Line 1 - 3 app/chemistrymath.js
//Mendeleev.getElements(function(e){
// var elements = e;
//});
btw How do you want to make the chemistry logic independent of the elements.json? This is where I get the mass of the atoms and more!
@AlexanderSelzer is obsessed with calling @zpiman crazy and complaining!
This was solely an example function. It had nothing to do with AngularJS. The chemistry calculations will be independent of Angular, but a thin wrapper (service) will be created.
It does not get anything from the server. It is not long. Why did you complain about it being a callback?
I am pretty sure there is a reason for empathizing anything. In my point of view your empathizing of "callback" shows disagreement. Of course you may correct me if wrong. Why exactly "forever-lost-and-never-again-retrieved"?
You are telling me to implement it myself. This is totally fine. No need to complain.
We could embed the elements.json in the chemistrymath.js file. Of course this would be bad.
What I meant was having an initialization function, which takes the elements array, somehow like...
$http.get("/elements.json").success(function(elements) {
ChemistryMath.initialize(elements);
textfield.on("contentchange" /* all made up */, function(contents) {
var equation = new ChemistryMath.Equation(contents);
otherTextfield.fillwithResults(equation.doSomeCalculation());
}
});
This means that the library could be used with any other elements file with the same fields.
This could be solved by sepparating the file from the require and doing some tests in another file.
And, please, use Mocha (http://visionmedia.github.io/mocha/), or another real test framework.
These tests are bound to become a problem.
Go censorship!!!! Cool I can edit your comment! <- @zpiman
Sorry, but it sounded like a complaint. Not really "lost". "never-again-retrieved" somehow sounds off.
We really shouldn't debate over such things.
Yeah, please use mocha. It is great.
How will we do this?
In the current state of it, this is not possible.
The problem is that it require()s elements.json. This is great for testing, but not great on the client.
I would suggest making the require() conditional ( if in node), and adding a way of initializing the library with the array of elements.
A global object with a initialization function (taking the elements), which returns all the other classes would be great.
Using it, we can then build AngularJS services around it.
TLDR; I suggest making the chemistry logic independent of the elements.json file.