Files
notehub/resources/public/js
Maciej Smolinski e25926619e Events: Allow for easier application extension with hook points.
How does it work?

Every time someone wants to extend the application, instead of modifying original `publishing.js` file, he or she can subscribe to given events, e.g.

Scenario: Table Of Contents extension

```
// resources/public/js/toc.js

events.subscribe('content:rendered', function () {
  // Prepend table of contents in edit mode on updates
});

events.subscribe('document:loaded', function () {
  // Prepend table of contents on initial load in edit view and preview
});
```

Now, having structured way to hook into app allows to keep the main codebase maintainable and pretty stable and extremely extensible at the same time.
2016-07-19 19:03:20 +02:00
..