Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. // The module
  2. function MyModule(config) {
  3. // do some connection stuff here
  4. connected = true
  5. }
  6.  
  7. MyModule.prototype.sendCommand = function() {
  8. if(connected) {
  9. // do command
  10. } else {
  11. // output an error
  12. }
  13. }
  14.  
  15. module.exports = MyModule;
  16.  
  17. // The script interacting with the module
  18. var MyModule = require('./MyModule');
  19. var config = { // config stuff };
  20. var mod = new MyModule(config);
  21. var mod.sendCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement