Skip to content

Instantly share code, notes, and snippets.

@mserranom
Created December 1, 2015 10:29
Show Gist options
  • Save mserranom/0fa5391d312d36dc8b45 to your computer and use it in GitHub Desktop.
Save mserranom/0fa5391d312d36dc8b45 to your computer and use it in GitHub Desktop.
container-ts example
export class NotificationsStore {
@Inject('repository') // injection by id
documentRepository : DocumentRepository;
private notifications : Array<Notifications>;
@PostConstruct
init() {
// invoked after all injections have been resolved
console.log('NotificationsStore initialised');
this.documentRepository.fetch('notifications')
.then((data) => this.notifications = data);
}
@Destroy
destroy() {
console.log('NotificationsStore destroyed');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment