Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Home-made collection
Message
 
 
À
04/08/2017 17:35:10
Information générale
Forum:
AngularJS
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01653087
Message ID:
01653091
Vues:
42
>did not really think it through, but...
>
>
>>                if (inventoryMatrix) {
>>                    $scope.currentIitem = inventoryMatrix;
>>                }
>>                else {
>>                    log.debug("Getting inventory row...");
>>                    services.IItem.getByItemIdAndAttributes($scope.currentItem.itemId, rowId, columnId).
>>                        then(function (results) {
>>
>>                           results.rowValueId = rowId;
>>                            results.columnValueId = columnId;
>>                            if (results.inventId == 0) {
>>                                results.itemId = $scope.currentItem.itemId;
>>                                results.department = $scope.currentItem.department;
>>                                results.category = $scope.currentItem.category;
>>                                results.item = $scope.currentItem.item;
>>                                results.descrip = getMatrixDescription(rowId, columnId);
>>                            }
>>
>>                            // log.debug(results);
>>                            $scope.currentIitem = results;})
>
>>
>>Does it look like OK implementation?
>>
>>The question I have - if I found my item in collection already, I want to replace my current object in collection with the more recent copy of it. What would you suggest?
>>
>>Thanks in advance.
>
>Modifying globals often incurred speed penalty a few years back at least compared to modifying lot of props of a local.
>Also shorter access path, but V8 should optimize that away, dunno about other engines.

Sounds like a good improvement in the code, I'll make the change. I finished the implementation, will be testing on Monday.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform