mn

meteor-namespace

A namespacing utility for meteor

Showing:

Popularity

Downloads/wk

1

GitHub Stars

5

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

1

Size (min+gzip)

8.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

meteor-namespace

A simple javascript namespacing utility that allows the easy creation of global namespaces. This package functions by creating the namespace and attaching it to GLOBAL if it's on the server or window if it's on the client. Now on NPM!

Installation

Node

npm install meteor-namespace

Meteor

meteor add zephraph:namespace

Usage

To use this with node add a require like normal:

var Namespace = require('meteor-namespace');

Calling the Namespace function creates a global namespace and returns the namespace to be edited

Namespace('my.app.namespace').test = 'hello world';
console.log(my.app.namespace.test); // Prints out 'hello world'

When passing in a function 'this' is bound to the specified namespace

Namespace('my.app.namespace', function() {
  this.test2 = 'hello again!';
});
console.log(my.app.namespace.test2); // Prints out 'hello again!'

If passing in a object literal the key/value pairs will be added to the namespace

Namespace('my.app.namespace', {
  test3: 'goodbye!'
});
console.log(my.app.namespace.test3); // Prints out 'goodbye!'

Meteor Only

A namespace can be limited to the client or server by calling Namespace.server or Namespace.client

Namespace.server('my.app.namespace', function() {
  this.serverVal = my.app.do.secret.thing();
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100