Note |
---|
This page is outdated and no longer receives updates! |
This page contains recommended conventions for JavaScript Development, both in the browser and on the server via Node.
...
It's a good idea to namespace any functions, objects, or other Javascript variables you include in your code in order to avoid name collisions with other parts of OpenMRS, or any 3rd party javascript libraries we include. If you're working on a module you can use openmrs.module_id for your namespace. A simple way to achieve this, using the reporting module as an example, is with the following idiom that can be included at the top of the javascript for any page.
Code Block | ||
---|---|---|
| ||
var openmrs = openmrs || {}; openmrs.reporting = openmrs.reporting || {}; // Now use the namespace for functions, etc openmrs.reporting.triggerReport = function(args) { }; |
...