-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for signalling content changes
- Loading branch information
Showing
3 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
import * as contentflow from 'content-flow' | ||
import * as $ from 'manhattan-essentials' | ||
|
||
|
||
export class FlowAPI extends contentflow.BaseAPI { | ||
|
||
constructor(baseURL='/', baseParams={}) { | ||
constructor(baseURL='/', baseParams={}, updateSignalKey=null) { | ||
super(baseURL, baseParams) | ||
|
||
this._updateSignalKey = updateSignalKey | ||
} | ||
|
||
_callEndpoint(method, endpoint, params={}) { | ||
const response = super._callEndpoint(method, endpoint, params) | ||
|
||
// Signal that a content update may have occurred | ||
if (method.toLowerCase() !== 'get') { | ||
$.dispatch( | ||
window, | ||
'contentupdatesignalled', | ||
{'key': this._updateSignalKey} | ||
) | ||
} | ||
|
||
return response | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters