fusionjs / fusion-plugin-universal-events Goto Github PK
View Code? Open in Web Editor NEWMigrated to https://github.com/fusionjs/fusionjs
License: MIT License
Migrated to https://github.com/fusionjs/fusionjs
License: MIT License
Documentation regarding Fusion API is out of date given recent changes to leverage new Dependency Injection architecture.
Update documentation
It appears navigator.sendBeacon
is fairly well supported across browsers: https://caniuse.com/#feat=beacon
Perhaps this API should be used when possible.
const emitter = EventEmitter.of();
emitter.on('browser-performance-emitter:stats:browser-only', (e, ctx) => {
emitter.emit('browser-performance-emitter:stats', mapPerfEvent(e), ctx);
});
Currently, ctx
is not passed in handleEvent()
when emits from a global emitter service, which prevents plugin listeners on server-side to re-emit browser events with ctx
emit(type, payload, ctx)
was the contract agreed upon, therefore we should still support it until a proper alternative.
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Preset name not found within published preset config (monorepo:angularmaterial). Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Passing objects to createToken results in poor error messages. We should
pass a string instead.
Bug
If you follow the getting started guide and register fetch via the window,
// ...
__BROWSER__ && app.register(FetchToken, window.fetch)
this will fail in chrome with “Uncaught TypeError: Illegal invocation”, as the fetch is later executed during flush
in the context of current object.
For this to work properly, it must be executed in the context of window, https://stackoverflow.com/a/10743608/1403990
A naive change is to modify the constructor of the UniversalEmitter:
this.fetch = fetch; // from
this.fetch = fetch.bind(window); // to
but i'm not sure how this would play out in older browsers, different fetch implementations, etc.
One other thing. This bug, is unreported to devs as the try catch surrounding the call to the fetch, swallows the error.
try {
const res = await this.fetch('/_events', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({items}),
});
if (!res.ok) {
// sending failed so put the logs back into storage
this.storage.addToStart(...items);
}
} catch (e) {
// There should be some noise here during development
// that this branch is being executed...
this.storage.addToStart(...items);
}
It can be useful to map or handle all events. For example,
an event logger that logs all events. We can support this
through an interface such as:
events.on('*', payload => {});
events.map('*', payload => {});
We need to handle the case where events are
emitted after the batch is flushed for a given
request.
It is useful to batch events emitted on the server to
allow plugins to add mappers that are dependent on data
coming from middleware.
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.