Isometrica / sub-stance

An angular-meteor subscription manager with substance.
GNU Affero General Public License v3.0
1 stars 0 forks source link

Autorun blocks #2

Open SteveFortune opened 9 years ago

SteveFortune commented 9 years ago

Support the following sub config:

.state('module', {
  url: '/module/:moduleId',
  parent: 'organisation',
  abstract: true,
  template: '<ui-view/>',
  data: {
    $subs: [
        function() {
          return { name:'something', args: [Session.get('param'), 'param2'] };
        },
        ['$stateParams', function($aService) {
          return { name:'somethingElse', args: [Session.get('reactive'), $aService.dep()] };
        }]
    ]
  }
});

..and:

$subs.needBind($scope, function() {
  return { name:'something', args: [Session.get('param'), 'param2'] };
});
SteveFortune commented 9 years ago

SubStance should allow you to register (injectable) functions which return subscription payloads containing reactive dependencies (note the calls to Session.get). Internally, this is how we might manage them:

SteveFortune commented 9 years ago

I think we should also consider decoupling the subscription store from $subs. We could have a $subRepo service will the following methods:

This might manage the queue internally. The $subs would just be responsible for deciding when to post add and discard messages to the repo.