Skip to content

Instantly share code, notes, and snippets.

@GiacomoManzoli
Created March 14, 2019 22:30
Show Gist options
  • Select an option

  • Save GiacomoManzoli/d993cc358112a80047e9c9d469dda922 to your computer and use it in GitHub Desktop.

Select an option

Save GiacomoManzoli/d993cc358112a80047e9c9d469dda922 to your computer and use it in GitHub Desktop.
// 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