Last active
April 24, 2017 12:32
-
-
Save vlindhol/a9e8ef7af3b26d7513ffbad5825fbf90 to your computer and use it in GitHub Desktop.
This file contains 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
// Kun funktiolle täytyy antaa monta parametria alkaa olla vaikea muistaa niiden järjestys ja merkitys, esim | |
// esimerkkiFunktio(1, true, '123ABC', 'ABC123', 3, 6, 3) jne jne. | |
// Jos funktiolle sen sijaan annetaan yksi objekti parametrina, kaikki tiedot ovat yhä siinä, ja parametrien | |
// nimet näkyvät myös funktiokutsussa => helpompi lukea => vähemmän bugeja. | |
libQuestions.addSuggestedAction({ | |
actionType: 'OrderService', | |
actionText: 'Sairaanhoitajan vastaanotto', | |
codes: [ | |
{ | |
system: '1.2.246.537.6.49', | |
value: 'EDA', | |
}, | |
{ | |
system: 'palvelunKiireellisyys', | |
value: 'P3', | |
}, | |
], | |
}); | |
// Tai täsmälleen sama asia ilmaistu toisella tavalla: | |
const action = { | |
actionType: 'OrderService', | |
actionText: 'Sairaanhoitajan vastaanotto', | |
codes: [ | |
{ | |
system: '1.2.246.537.6.49', | |
value: 'EDA', | |
}, | |
{ | |
system: 'palvelunKiireellisyys', | |
value: 'P3', | |
}, | |
], | |
}; | |
libQuestions.addSuggestedAction(action); | |
// Eli samat tiedot kuin muutenkin, paitsi että tähän objektiin voi lisätä niitä koodeja siihen codes-listaan loputtomiin | |
// ilman muutoksia moottorin koodiin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment