Skip to content

Commit

Permalink
add endpoint option for browser plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
georgigriffiths committed Jul 11, 2018
1 parent 9093d65 commit cf26881
Show file tree
Hide file tree
Showing 4 changed files with 48,567 additions and 48,387 deletions.
5 changes: 3 additions & 2 deletions seneca-browser-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var SenecaExport = function(options, more_options) {

var seneca = SenecaModule(options, more_options)

seneca.use(function browser() {
seneca.use(function browser(options) {
options.endpoint = options.endpoint || '/seneca'
this.add('role:transport,hook:client,type:browser', hook_client_browser)

var tu = this.export('transport/utils')
Expand All @@ -20,7 +21,7 @@ var SenecaExport = function(options, more_options) {

reply({
send: function(msg, reply, meta) {
fetch('/seneca', {
fetch(options.endpoint, {
credentials: 'same-origin',
method: 'post',
body: tu.stringifyJSON(tu.externalize_msg(seneca, msg, meta))
Expand Down
Loading

0 comments on commit cf26881

Please sign in to comment.