Table of contents

Flow

1. File information comment

2. File description(Note) Comment

//============================================================================
// Load Visual Python
//============================================================================

3. Require/Define modules to import

define([
	// external module
	'externalModuleSample',
	...
	// visualpython util
	'vp_base/js/com/com_util'
	...
], function(externalModuleSample, com_util) {
	'use strict';

	// ... following steps (4. ~)

4. Define variable

...
//========================================================================
// Define Variable
//========================================================================
// Constant
const SAMPLE_CONSTANT = 'hello world';

// Variables
var sampleVariable = 'sample variable';
...

5. Functions

5-1. Internal call function

...
//========================================================================
// Internal call function
//========================================================================
/**
 * Function description
 * @param {type} param1
 */
var _internalFunction = function(param1) {
	// internal function should have _(underbar) at the front of its name
	...	
};

5-2. External call function

...
//========================================================================
// External call function
//========================================================================
/**
 * Function description
 * @param {type} param1
 */
var externalFunction = function(param1) {
	...	
};

// export external function
return { externalFunction: externalFunction };

6. Class

//========================================================================
// Define Class
//========================================================================
/**
 * Example class
 */
class ExampleClass {
	constructor() {
		
	}
	// internal function
	_internalFunction() {
		
	}
	// external function
	externalFunction() {
		
	}
} // class

//========================================================================
// Define Class Static Variable
//========================================================================
ExampleClass.StaticVariable = 'static variable';