Comments (5)
That's interesting - thanks. I haven't put this into Buttons already as I'm concerned as to what would happen if you need to have a pre
or post
action on that button that already has a pre
or post
action! That would then require a prePre
/ postPost
action - gulp...
My inclination is currently to have the extended button define its own action and have that call the action function of the button that it wants to extend - a bit like calling super()
in an OO language, but a bit more verbose.
from buttons.
I think if there were some pre/post
events thrown around the execution of the action (Akin to Bootstraps events for modals, tooltips and the likes) that might help. The reason I didn't go with that solution is because you don't seem to have many events in the library already, and I didn't want to propose a code solution that is of a completely different style than what we're working with.
I can get behind the idea of making the extended buttons action explicitly call the action. I'm not sure of the best way to get at the actions from inside an action so it still goes through the _resolveExtends
.
With the super()
way, people who are trying to lazily load an action will still get a race condition where the postAction
get called immediately after the action
even though the action hasn't actually completed.
from buttons.
The problem with pre/post
events is that an async action such as loading an external script would not be complete before the action function itself is then executed. These events might be useful in some cases - when synchronous actions are all that are required, but I'm not sure they would help in this case.
from buttons.
ahh, true. I think this could work with Promises, but that's a lot of work for one case. :/
from buttons.
You can now do post actions on a button with the buttons-action
event - 696e161. I think that's probably as far as I want to take it at the moment. I'm not sure how useful a pre event would be, but will consider it in future if there is a solid use case for it. For now going to close.
from buttons.
Related Issues (20)
- Unknown variable m_ake ? HOT 1
- composer error HOT 10
- 1.6.2 update breaks colvis button container opening position HOT 4
- Right alignment of button collections does not work with Bootstrap styling HOT 2
- `stripHtml` option fails when attribute contains `>` symbol HOT 6
- open
- clickme
- I found a bug HOT 2
- TypeError: k[l].trim is not a function HOT 12
- excelHtml5 Creates Corrupted XLSX File when ™ is in the Sheet Name HOT 3
- window.open might return null HOT 1
- Excel export generates a corrupted file while accessing site via proxy/vpn. HOT 2
- npm package: Bulma JS is missing HOT 2
- Excel export $ sign alignment HOT 2
- 218 Character Excel File Name Length Limit HOT 5
- schemas.openxmlformats.org no longer exists HOT 4
- Export Excel with enable CSP HOT 7
- Buttons do not work when using DataTable with ajax HOT 1
- type is not a function HOT 4
- DataTables 2.0 layout Support HOT 3
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 buttons.