Socket
Socket
Sign inDemoInstall

qbus

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qbus - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

1

lib/index.js

@@ -0,1 +1,2 @@

/** @license Licenced under MIT - qbus - ©2015 Pehr Boman <github.com/unkelpehr> */
(function () {

@@ -2,0 +3,0 @@ 'use strict';

2

package.json
{
"name": "qbus",
"description": "Powerful and fast isomorphic mediator with dynamic queries",
"version": "v0.9.2",
"version": "v0.9.3",
"author": "Pehr Boman <unkelpehr@gmail.com>",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/unkelpehr/qbus",

@@ -11,16 +11,11 @@ # qbus

```js
bus.on('/entries/get/:id?', function (id, res) {
var html;
if (id) {
html = render('article', id);
} else {
html = render('article-index');
}
res(html);
});
**Node**
```sh
$ npm install qbus
```
<a target="_blank" href="https://marijnhaverbeke.nl/uglifyjs?utf8=on&code_url=https://raw.githubusercontent.com/unkelpehr/qbus/master/lib/index.js&header=/**%20@license%20Licenced%20under%20MIT%20-%20qbus%20-%20%C2%A92015%20Pehr%20Boman%20%3Cgithub.com/unkelpehr%3E%20*/">Browser? Get the latest version of qbus minified and ready to-go here</a>
##### <a href="http://unkelpehr.github.io/qbus" target="_blank">You can also try a live demo of qbus' query parser here</a>
### Behaviour

@@ -216,3 +211,3 @@ Queries can be anything but Qbus is built with a "path-based" approach for routing e.g. URLs.

##### Parasitic inheritance
Qbus will latch on to any object ("_parent_") passed to it's constructor. This is a simple way of extending your own modules with Qbus' functionality. Four functions will be added to `parent`: `on`, `once`, `off`, `emit` along with a non-enumerable object called `qbus`; where all the subscriptions will be stored.
Qbus will latch on to any object ("_parent_") passed to it's constructor. This is a simple way of extending your own modules with Qbus' functionality. Four functions will be added to `parent`'s properties: `on`, `once`, `off`, `emit` along with a non-enumerable object called `qbus`; where all the subscriptions will be stored.
```js

@@ -228,2 +223,17 @@ var Qbus = require('Qbus');

Or, if you want to add Qbus' functionality to your constructors prototype:
```js
var $, Qbus = require('Qbus');
function MyLib () {
Qbus.call(this, MyLib.prototype);
}
$ = new MyLib();
$.on('stuff', function () {
// `this` is now `myLib`
}).emit('stuff');
```
##### .on(<`query`= String|RegExp>, <`handler` = Function>)

@@ -230,0 +240,0 @@ Let `handler` execute on given `query`.

@@ -8,2 +8,6 @@ if (typeof require === 'function') {

var qbuses = function () {
function Parent () {
Qbus.call(this, Parent.prototype);
}
return [

@@ -13,5 +17,7 @@ new Qbus(),

Qbus({}),
new Qbus({})
new Qbus({}),
new Parent()
];
},
qbusesLen = qbuses().length,
noop = function () {};

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

assert.equal(calls, 4, '.once(str) only execute the handler once');
assert.equal(calls, qbusesLen, '.once(str) only execute the handler once');
}());

@@ -52,3 +58,3 @@

assert.equal(calls, 4 * 3, '.on(str) execute the handler three times with three emits');
assert.equal(calls, qbusesLen * 3, '.on(str) execute the handler three times with three emits');
}());

@@ -104,3 +110,3 @@

assert.equal(calls, 4, '.once(expression) only execute the handler once');
assert.equal(calls, qbusesLen, '.once(expression) only execute the handler once');
}());

@@ -117,3 +123,3 @@

assert.equal(calls, 4 * 3, '.on(expression) execute the handler three times with three emits');
assert.equal(calls, qbusesLen * 3, '.on(expression) execute the handler three times with three emits');
}());

@@ -169,3 +175,3 @@

assert.equal(calls, 4, '.once(RegExp) only execute the handler once');
assert.equal(calls, qbusesLen, '.once(RegExp) only execute the handler once');
}());

@@ -182,3 +188,3 @@

assert.equal(calls, 4 * 3, '.on(RegExp) execute the handler three times with three emits');
assert.equal(calls, qbusesLen * 3, '.on(RegExp) execute the handler three times with three emits');
}());

@@ -185,0 +191,0 @@

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