postaljs / postal.request-response Goto Github PK
View Code? Open in Web Editor NEWpostal.js add-on that provides a request/response pattern API.
License: MIT License
postal.js add-on that provides a request/response pattern API.
License: MIT License
I'm currently using require('postal.request-response')(require('postal'))
to include the module but this seems to fail with webpack for some reason.
So excuse me if this is obvious but what's the way to use ES6 import
with this? I can't seem to find the right combination so that postal
itself is included.
Would love to see them added for this plugin!
Perhaps this can help?
The API is confusing.
Using promises is lovely, but envelope.reply
appears to be a node-style callback.
I was actually bitten by this, I expected .reply
to simply accept my data and ended up having to dig up where an error Firefox couldn't print was coming from.
I would recommend an alternative to .reply
that simply accepts a value, paired with another that accepts an error.
Hello,
When adding a admin or non-admin user to the portal, the invite mail is not being send (the button Add User keeps spinning after you click it).
This means that users will never be added to the portal.
This is not really an issue but don't know where I should put it instead.
It would be nice to have similar features like for example SendinBlue.
@ifandelse Is there anyway the implementation could be changed to the following:
postal.publish({
channel: 'some.channel',
request: {
topic: 'some.topic',
data: {some: data},
timeout: 2000
},
response: {
onSuccess: function (d, e) { }
onFail: function (err) { }
always: function (d, e, err) { }
}
});
The problem I'm having with the current implementation is that it introduces a whole new approach to publishing by having to work with the channel itself. The approach is different, and yet, fundamentally, there's nothing particularly different about request-response.
Also, I think the then should be internalized (but still conform to the configuration for creating promises, of course). Further, onSuccess
, onFail
, and always
conform to the language of the promises domain.
The approach I take above is crystal clear, and we stay within the confines of how we publish otherwise.
It seems to me that it should be easy enough to ingest the object literal above (request, response), and then wrap the channel in request semantics. The response callbacks could internally be mapped to then. So, in effect, the approach I take above becomes sugar on top of the current implementation.
I do like the subscriber side, though (i.e. envelope.reply({ })
).
Just some suggestions...
Thanks for the great plugin, it is very useful! It helped me avoid a much more code heavy tight-augmentation approach. This plugin works with the latest version of postal.js (1.0.2) - any reason the dependency should not be updated? Also, is there really a need to declare a dependency on lo-dash when it's just a pass-through and given postal.js already declares a dependency on lo-dash? Happy to submit a pull request.
Just as a reference. When used in combination with postal.js(1.0.6), postal.xframe(0.3.2) and postal.federation(0.2.4) the following error is thrown in the default configuration.
Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': An object could not be cloned.
in postal.xframe line 109.
Looks like the .reply
method added to the envelope causes this issue.
This can be fixed by setting
postal.fedx.transports.xframe.configure({ safeSerialize: true });
First of all,
thanks for postal.js.
I took a look at postal.request-response code and I couldn't find any constraint related to the number of listeners. I think this number should be limited to one at a time. Do you agree? Did I overlook something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.