Comments (6)
The main problem / issue that I see is that right now the chaining on an "api" works also with the full API
Ah, I see. I do think though that this is not really "known"/used because TS, at the very least, says that the result is an EventEmitter
, not the full API. But fair point.
from piral.
Well bind
works or alternatively, you could also make it another lambda ((...args) => events.once(...args)
). I think going for the bind
is great - let's do that!
Alternatively, let's check the implementation and maybe once
can be done in a way that does not require this
(and let's check that the others don't suffer from this problem; I think they don't).
from piral.
Alternatively, let's check the implementation and maybe once can be done in a way that does not require this (and let's check that the others don't suffer from this problem; I think they don't).
The others don't seem to have the same problem. I think the only issue that might arise for them in this scenario is that method chaining might be broken. They return this
, for example in on
:
on(type, callback) {
// ...
return this;
}
So, if you were to do on('foo', handler).once('bar', handler)
or something similar, you might run into issues.
I think going for the bind is great - let's do that!
Great, sounds like a plan! I'll tackle it.
from piral.
Yeah with the chaining in mind I'd actually improve the basis for this.
We should have the events properly captured.
from piral.
Instead of
return {
on() {
// ...
return this;
},
// ...
}
we'd go for
const events = {
on() {
// ...
return events;
},
// ...
};
return events;
The main problem / issue that I see is that right now the chaining on an "api" works also with the full API - while with this approach it only works on a subset (events).
from piral.
Ah, I see. I do think though that this is not really "known"/used because TS,
Yes - otherwise it would have been a breaking change.
from piral.
Related Issues (20)
- On Invalid Config Pilet Publish Removes Source
- The index.d.ts of a Pilet Is Placed In dist
- Improve Toggle / Disable+Enable in Debug Tools
- Optional Shadow DOM Isolation HOT 1
- This is Evil
- Piral with Rush HOT 16
- How do I configure this with Nuxt 3? Unable to setup HOT 4
- Remove Pilet-Only Settings When Debugging Piral Instance
- In the app-shell example debugging mode, saving package.json will prompt that the port is used HOT 6
- Navigation storm in angular pilets HOT 1
- Multiple Angular Extensions params HOT 4
- piral-ng: Cannot read properties of null (reading 'bindingStartIndex') HOT 3
- piral-breadcrumbs dependency on react-router v5 HOT 3
- Piral-Cli uses deprecated package HOT 2
- Repeat to connect to the server HOT 5
- Possibility to Define Vue 3 Plugins HOT 15
- Support Standalone Bootstrapping API in piral-ng HOT 1
- `.krasrc` resolution from `process.cwd()` folder HOT 5
- Install Event Listener Earlier
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piral.