Merge pull request #3935 from kazimuth/jsns

Add @namespace annotation to namespaces in javascript
This commit is contained in:
Wouter van Oortmerssen 2016-07-25 10:47:46 -07:00 committed by GitHub
commit f61f0449c7
6 changed files with 23 additions and 10 deletions

View File

@ -2,6 +2,10 @@
/// @addtogroup flatbuffers_javascript_api
/// @{
/// @cond FLATBUFFERS_INTERNAL
/**
* @const
* @namespace
*/
var flatbuffers = {};
/**

View File

@ -110,7 +110,7 @@ class JsGenerator : public BaseGenerator {
std::string &exports = *exports_ptr;
for (auto it = sorted_namespaces.begin();
it != sorted_namespaces.end(); it++) {
code += "/**\n * @const\n*/\n";
code += "/**\n * @const\n * @namespace\n */\n";
if (it->find('.') == std::string::npos) {
code += "var ";
exports += "this." + *it + " = " + *it + ";\n";

Binary file not shown.

View File

@ -2,22 +2,26 @@
/**
* @const
*/
* @namespace
*/
var MyGame = MyGame || {};
/**
* @const
*/
* @namespace
*/
MyGame.Example = MyGame.Example || {};
/**
* @const
*/
* @namespace
*/
MyGame.Example2 = MyGame.Example2 || {};
/**
* @const
*/
* @namespace
*/
MyGame.OtherNameSpace = MyGame.OtherNameSpace || {};
/**

View File

@ -2,12 +2,14 @@
/**
* @const
*/
* @namespace
*/
var NamespaceA = NamespaceA || {};
/**
* @const
*/
* @namespace
*/
NamespaceA.NamespaceB = NamespaceA.NamespaceB || {};
/**

View File

@ -2,17 +2,20 @@
/**
* @const
*/
* @namespace
*/
var NamespaceA = NamespaceA || {};
/**
* @const
*/
* @namespace
*/
NamespaceA.NamespaceB = NamespaceA.NamespaceB || {};
/**
* @const
*/
* @namespace
*/
var NamespaceC = NamespaceC || {};
/**