Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Logic problem
Message
De
09/02/2018 03:12:09
 
 
Information générale
Forum:
HTML5
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01657073
Message ID:
01658041
Vues:
44
Untested: as JS has static methods in new version, you should be able to create a existsAndIsPristine Method on form class without running into Nullpointer issues
or
(no need to test) just create a traditional function for it,

as newer JS engines are very agressive towards inlining.
If run often I'd say the danger of sometimes NOT inlining should be enough to let the source as it is.
In C it would be tailor-made for preprocessor statement, but as JS does not have one, you always run the danger of added runtime of function calls if breaking up long logical statements.

>I'm having another problem I'm trying to figure out. Here is the current code which seems to be working:
>
>
>if (this.form && !this.form.$dirty || this.parentForm && !this.parentForm.$dirty) {
>            onRouteChangeOff();
>            return;
>        }
>
>However, I'm confused in this code. The idea is to make sure that if form is defined it's in pristine state and if parentForm is defined it's also in the pristine state.
>
>Do you see how to re-state the above to convey the intent of this code more clearly?
>
>Thanks in advance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform