Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Exporting Objects with the Exports Object in electron

//myModule.js

var MyObject = function() {

    // This is private because it is not being return
    var _privateFunction = function(param1, param2) {
        ...
        return;
    }

    var function1 = function(param1, callback) {
        ...
        callback(err, results);    
    }

    var function2 = function(param1, param2, callback) {
        ...
        callback(err, results);    
    }

    return {
        function1: function1
       ,function2: function2
    }
}();

module.exports = MyObject;
------------------------------------------------------------------------
//someFile.js

var myObject = require('myModule');

myObject.function1(param1, function(err, result) { 
    ...
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: express dynamic api template 
Javascript :: js filter out html 
Javascript :: leetcode solution problem 66 plus one 
Javascript :: How to Loop Through an Array with a for Loop in JavaScript 
Javascript :: sort items 
Javascript :: express get, post, delete, put template 
Javascript :: Backbone Collection 
Javascript :: Prevent HTTP Parameter Polution in NodeJS 
Javascript :: In express redirect user to external url 
Javascript :: angular file upload code anji 
Javascript :: quill js laravel 
Javascript :: Solution-1-Part-B--solution options for reverse bits algorithm js 
Javascript :: add seconds to date 
Javascript :: types of variables in javascript 
Javascript :: object.map() nest js 
Javascript :: or js 
Javascript :: hello world js 
Javascript :: event solidity 
Javascript :: traversing in jquery 
Javascript :: javascript buffer to file 
Javascript :: graph data structure in js 
Javascript :: intersection array of object javascript 
Javascript :: js add obj prop dynamically 
Javascript :: javascript Create Objects: Constructor Function Vs Object Literal 
Javascript :: javascript Assign Default Values 
Javascript :: JavaScript Iterables 
Javascript :: jQuery - Dimensions 
Javascript :: jQuery Prevent Submit on Enter Key Except in Textarea 
Javascript :: gatsby js quick start 
Javascript :: phaser animation on complete event 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =