Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

citizen

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

citizen - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

80

helper.js

@@ -9,3 +9,3 @@ // core framework functions

methods = {
public: {

@@ -99,4 +99,4 @@

functionListener: function (params, functions, callback) {
var emitters = {},
groupListener: function (functions, callback) {
var emitter = {},
output = {},

@@ -119,53 +119,29 @@ ready = {},

for ( var property in functions ) {
eval("ready." + property + " = false");
ready[property] = false;
};
for ( var property in functions ) {
emitters[property] = new events.EventEmitter();
emitters[property].on('ready', function (result) {
eval("ready." + property + " = true");
eval("output." + property + " = result");
groupTracker();
});
// Copies of params and emitters are passed so these functions can't pollute
// the original objects upstream or interfere with each other
functions[property](methods.public.copy(params), emitters);
if ( functions[property]['controller'] ) {
emitters = methods.public.mvcEmitterSet(property);
emitters.controller.on('ready', function (result) {
ready[this.name] = true;
output[this.name] = result;
groupTracker();
});
// A copy of params is passed so these patterns can't pollute
// the original object upstream or interfere with each other
functions[property]['controller'](methods.public.copy(functions[property]['args']), emitters);
} else {
emitter = new events.EventEmitter();
emitter['name'] = property;
emitter.on('ready', function (result) {
ready[this.name] = true;
output[this.name] = result;
groupTracker();
});
functions[property]['method'](functions[property]['args'], emitter);
}
};
},
patternListener: function (params, patterns, callback) {
var emitters = {},
output = {},
ready = {},
groupTracker = function () {
var allReady = true;
for ( var property in ready ) {
if ( ready[property] === false ) {
allReady = false;
}
}
if ( allReady && typeof callback !== 'undefined' ) {
callback(output);
}
};
for ( var property in patterns ) {
eval("ready." + property + " = false");
};
for ( var property in patterns ) {
emitters = methods.public.mvcEmitterSet(property);
emitters[property].controller.on('ready', function (result) {
eval("ready." + property + " = true");
eval("output." + property + " = result");
groupTracker();
});
// A copy of params is passed so these patterns can't pollute
// the original object upstream or interfere with each other
patterns[property](methods.public.copy(params), emitters);
};
},
isNumeric: function (n) {

@@ -178,6 +154,6 @@ return !isNaN(parseFloat(n)) && isFinite(n);

emitters[name] = {};
emitters[name].model = new events.EventEmitter();
emitters[name].view = new events.EventEmitter();
emitters[name].controller = new events.EventEmitter();
emitters.model = new events.EventEmitter();
emitters.view = new events.EventEmitter();
emitters.controller = new events.EventEmitter();
emitters.controller.name = name;

@@ -184,0 +160,0 @@ return emitters;

@@ -9,3 +9,3 @@ {

"description": "An event-driven MVC framework for Node.js web applications.",
"version": "0.0.3",
"version": "0.0.4",
"repository": {

@@ -12,0 +12,0 @@ "type": "git",

@@ -11,3 +11,13 @@ citizen

Initalizing citizen
Installing citizen
------------------
npm install citizen
I had some issues because of the Handlebars dependency, but installing with the `--no-bin-links` flag worked:
npm install citizen --no-bin-links
Initializing citizen
-------------------

@@ -35,3 +45,3 @@

// Default is '/'.
appUrlFolder: '/',
appUrlFolder: '/to/myapp',

@@ -71,3 +81,3 @@ // Port for the web server, which citizen creates and starts automatically on initialization.

http://www.cleverna.me/article/My-clever-article-title/id/237
http://www.cleverna.me/article/My-clever-article-title/id/237/page/2

@@ -74,0 +84,0 @@

@@ -12,3 +12,3 @@ // server

methods = {
public: {

@@ -39,3 +39,3 @@

emitters = helper.mvcEmitterSet(route.name);
controller[route.name] = eval("app.patterns." + route.name + ".controller");
controller = require(config.appPath + '/patterns/' + route.name + '/' + route.name + '-controller');

@@ -58,7 +58,7 @@ // Overwrite the default route parameters with URL parameters if they exist

case 'GET':
emitters[route.name].controller.on('ready', function (params) {
emitters.controller.on('ready', function (params) {
response.write(helper.renderView(route.name, params));
response.end();
});
controller[route.name].handler(helper.copy(params), helper.copy(emitters));
controller.handler(helper.copy(params), helper.copy(emitters));
break;

@@ -71,3 +71,3 @@ case 'POST':

request.on('end', function () {
emitters[route.name].controller.on('ready', function (params) {
emitters.controller.on('ready', function (params) {
response.write(helper.renderView(route.name, params));

@@ -77,3 +77,3 @@ response.end();

params.form = querystring.parse(body);
controller[route.name].handler(helper.copy(params), helper.copy(emitters));
controller.handler(helper.copy(params), helper.copy(emitters));
});

@@ -80,0 +80,0 @@ break;

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