Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. // Con Promise
  2.  
  3. let ifcObject = ... // un oggetto ritornato dal model
  4.  
  5. ifcObject.promiseGetIsDefinedBy(relations => {
  6. relations = relations.filter(rel => rel.getType() === "IfcRelDefinesByType");
  7. return relations[0].promiseGetRelatingType();
  8. }).then(ifcObjectType => {
  9. console.log(ifcObjectType.getName());
  10. });
  11.  
  12. // Senza Promise
  13. ifcObject.getIsDefinedBy(relation => {
  14. if (relation.getType() === "IfcRelDefinesByType") {
  15. relation.getRelatingType((ifcObjectType) => {
  16. console.log(ifcObjectType.getName());
  17. })
  18. }
  19. });
  20.  
  21. // 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!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement