Socket
Socket
Sign inDemoInstall

nogap

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nogap - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

67

lib/ComponentBootstrap.js

@@ -347,2 +347,7 @@ /**

};
/**
* Names of components already requested but not there yet.
*/
var pendingComponents = {};

@@ -386,6 +391,9 @@ return {

var compName = componentNames[i];
if (Instance[compName]) {
if (Instance[compName] || pendingComponents[componentName]) {
// component already exists: remove
componentNames.splice(i, 1);
}
else {
pendingComponents[componentName] = 1;
}
}

@@ -418,2 +426,3 @@

}
delete pendingComponents[componentName];
}

@@ -432,36 +441,32 @@

// call this code delayed, so server-sent commands (that came in the same batch!)
// can properly set some initial client-side stuff
//setTimeout(function() {
// call `onNewComponent`
Instance.forEachComponentOfAnyType(function(component) {
if (component.onNewComponent) {
for (var j = 0; j < componentDefs.length; ++j) {
var componentName = componentDefs[j].Client.FullName;
component.onNewComponent(Instance[componentName]);
}
// call `onNewComponent`
Instance.forEachComponentOfAnyType(function(component) {
if (component.onNewComponent) {
for (var j = 0; j < componentDefs.length; ++j) {
var componentName = componentDefs[j].Client.FullName;
component.onNewComponent(Instance[componentName]);
}
});
// check for pending callbacks to call
for (var i = pendingInitializers.length-1; i >= 0; --i) {
var init = pendingInitializers[i];
var done = true;
for (var j = 0; j < init.names.length; ++j) {
if (!Instance[init.names[j]]) {
// this callback is still waiting for components that were not delivered
done = false;
break;
}
}
});
// check for pending callbacks to call
for (var i = pendingInitializers.length-1; i >= 0; --i) {
var init = pendingInitializers[i];
var done = true;
for (var j = 0; j < init.names.length; ++j) {
if (!Instance[init.names[j]]) {
// this callback is still waiting for components that were not delivered
done = false;
break;
}
if (done) {
// all requested components have been loaded
// -> call callback & remove initializer
if (init.cb) {
init.cb();
}
pendingInitializers.splice(i, 1);
}
if (done) {
// all requested components have been loaded
// -> call callback & remove initializer
if (init.cb) {
init.cb();
}
pendingInitializers.splice(i, 1);
}
//}, 1);
}
}

@@ -468,0 +473,0 @@ }

{
"name": "nogap",
"version": "0.1.6",
"version": "0.1.7",
"author": {

@@ -5,0 +5,0 @@ "name": "Dominik Seifert",

@@ -227,35 +227,46 @@ NoGap

+-- components/
| +-- models/
| +-- ui/
+-- lib/
+-- pub/
+-- app.js
+-- appConfig.js
+-- package.json
+-- appConfig.js
+-- app.js
Let's have a look at the different files and folders:
This is the recommended file structure for the average web application. As always, the structure might look vastly different for special purpose applications.
### package.json
### `components/`
This is the standard `Node` configuration file. Here you can declare your app's basic metadata and, most importantly, your dependencies.
If you need one of the thousands over thousands of publicly available `Node` modules, two steps are required:
This folder contains your `NoGap` components, and possibly (some of) their assets. You can name it anything you want.
1. add their name and your preferred version to `dependencies`
2. Run `npm install`
NOTE: Placing assets (such as *.html templates, stylesheets, images etc.) next to code is actually good style, if it supports modularization.
If your components have a sufficiently modular design, you can simply copy their folder, to deploy them and their assets in other places.
Done. Now the new module is available in your code via:
`var someModule = require('some-module');`
### `components/models/`
where `some-module` is the name you gave it in the package.json file.
This folder contains the interface with your DB and possibly other storage systems. They provide [CRUD](http://en.wikipedia.org/wiki/Create,_read,_update_and_delete) functionality to the rest of the application.
Check out [NPM JS]("https://www.npmjs.org/") to see all available modules.
### `components/ui/`
### `components/`
This folder contains UI-related components. That is UI controller and view code. Views are in separate files from the code, but they can be in the same folder to support modularity.
This folder contains your `NoGap` components, and possibly (some of) their assets. You can name it anything you want.
NOTE: Placing assets (such as *.html templates, stylesheets, images etc.) next to code is actually good style, if it supports modularization.
If your components have a sufficiently modular design, you can simply copy their folder, to deploy them and their assets in other places.
### `app.js`
This defines your actual application. You can name it anything you want. Usually, this file only does three things:
1. Setup your app
2. Start `NoGap`
3. Start your [`express` server](http://expressjs.com/4x/api.html)
Express is the standard Node way of starting a HTTP server and let clients connect.
Once it is running you can connect to it with your browser on the specified port.
NOTE: When using `NoGap` you will not need to work with express anymore (other than starting the server). You can use it, but you are recommended to use components instead.
### `appConfig.js`

@@ -299,16 +310,25 @@

### `app.js`
### package.json
This defines your actual application. You can name it anything you want. Usually this file only does two things:
This is the standard `Node` configuration file. Here you can declare your app's basic metadata and, most importantly, your dependencies.
If you need one of the thousands over thousands of publicly available `Node` modules, two steps are required:
1. Setup your app
2. Start `NoGap`
3. Start your [`express` server](http://expressjs.com/4x/api.html)
1. Add their name and your preferred version to `dependencies`
2. Run `npm install`
Express is the standard Node way of starting a HTTP server and let clients connect.
Once it is running you can connect to it with your browser on the specified port.
NOTE: When using `NoGap` you will not need to work with express anymore. You can, but you are recommended to use components instead.
Done. Now the new module is available in your code via:
With that in mind, you are recommended to take a look at the [`NoGap Sample App`](samples/sample_app) to look at a slightly more complete example of using `NoGap`.
`var someModule = require('some-module');`
where `some-module` is the name you gave it in the package.json file.
Check out [NPM JS](https://www.npmjs.org/) to see all available modules.
Final Words
=============
Good luck! You are recommended to take a look at the [`NoGap Sample App`](samples/sample_app) for a slightly more complete example of using `NoGap`.
In case of questions, feel free to contact me.

@@ -8,3 +8,3 @@ /**

// ##########################################################################
// Define TwoWayStreetAsync component
// Define TwoWayStreetAsync component

@@ -24,4 +24,2 @@ var NoGapDef = require('nogap').Def;

tellClientSomething: function() {
this.Tools.keepOpen();
// wait 500 milliseconds before replying

@@ -28,0 +26,0 @@ setTimeout(function() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc