Created
March 14, 2019 22:30
-
-
Save GiacomoManzoli/d993cc358112a80047e9c9d469dda922 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Con Promise | |
| let ifcObject = ... // un oggetto ritornato dal model | |
| ifcObject.promiseGetIsDefinedBy(relations => { | |
| relations = relations.filter(rel => rel.getType() === "IfcRelDefinesByType"); | |
| return relations[0].promiseGetRelatingType(); | |
| }).then(ifcObjectType => { | |
| console.log(ifcObjectType.getName()); | |
| }); | |
| // Senza Promise | |
| ifcObject.getIsDefinedBy(relation => { | |
| if (relation.getType() === "IfcRelDefinesByType") { | |
| relation.getRelatingType((ifcObjectType) => { | |
| console.log(ifcObjectType.getName()); | |
| }) | |
| } | |
| }); | |
| // Poi poi commentare che "Già così il codice inizia ad essere più difficile da comprendere... e ci sono solamente due chiamate. Per arrivare da un elemento alle sue quantità ci sono minimo 4 chiamate consecuitive da fare, che devono essere tra loro sincronizzate!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment