0.0.18 • Published 10 years ago

mojo-pubnub v0.0.18

Weekly downloads
2
License
ISC
Repository
github
Last release
10 years ago

This plugin is still very experimental.

This plugin will automatically discover relationships between your model layer, and synchronize changes across different platforms via pubnub. No need to change your application structure - just add a few lines of code!

See Also

  • event bus - event bus system for views & models.

Example

var Application = require("mojo-application"),
models          = require("mojo-models");

var MyApplication = Application.extend({
  config: {
    pubnub: {
      key: "ABC-DEF-GHI"
    }
  },
  plugins: [  
    models,                    // model layer we're gonna make realtime
    require("mojo-event-bus"), // required for hooking mojo models with pubnub
    require("mojo-pubnub"),    // takes event bus changes, and publishes them to pubnub
    require("./models")
  ]
});


var app = new MyApplication();
app.initialize();

./models/index.js:

module.exports = function (app) {
  app.models.register({
    todo: require("./todo"),
    todos: require("./todos")
  });
}

./models/todo.js:

var models = require("models");
module.exports = models.Base.extend({
});

./models/todos.js:

var models = require("models");
module.exports = models.Collection.extend({
  createModel: function (properties) {
    return this.application.models.create(properties);
  }
});

That's all there is to it!

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago