Comments (3)
I've taken a quick look at this and came up with master...enkol:user-defaults
It basically makes ember-attacher to look in the apps config/environment.js
for options under ENV.emberAttacher
.
Example user default options in config/environment.js:
module.exports = function(environment) {
var ENV = {
...
EmberENV: {
...
},
emberAttacher: {
animation: 'fade',
arrow: true,
hideDelay: 0,
hideDuration: 300,
hideOn: 'mouseleave blur',
interactive: false,
placement: 'bottom',
popperClass: 'popper tooltip fancy',
popperOptions: null,
renderInPlace: false,
showDelay: 0,
showDuration: 300,
showOn: 'mouseenter focus',
}
};
if (environment === 'development') {
...
It's not at build time, but maybe you can use this as a starting point for user default options.
I did not yet try to just import config from '../config/environment
to get rid of the getOwner
stuff in the init
override . I think, this then would be at build time, but i'm not sure if it works from an addon (how to get the correct import path).
from ember-attacher.
This is a great stop-gap until we can come up with a fully build-time solution; happy to accept a PR!
The only thing holding this back from being a permanent approach is that we need to recalculate the default values every time an ember-attacher is initialized, so if we have 10 tooltips, we do the same calculation 10 times. That said, I like that your approach optimizes for the common case (where the default value is used instead of the user-defined one).
I was initially holding off on this kind of approach in hopes of doing all the calculations for default values up-front at build time. Basically the same approach you've done, but without the need for the work done in init()
.
Still haven't figured out an easy way to do that... but have a hard way in mind where we generate a runtime file at build time, then stick that in broccoli. Will probably spike another addon for that since it is a general issue not specific to ember-attacher.
from ember-attacher.
Implemented in #11.
Will revisit build time computed defaults when I or someone else has time to hammer out the details.
from ember-attacher.
Related Issues (20)
- Add Dependabot HOT 2
- Your .dependabot/config.yml contained invalid details HOT 4
- Feature request : Separate tooltip & popover user-defined defaults HOT 2
- Unknown property given for `class` HOT 1
- EmberAttacher no longer allows for component args to pass down, defaults always override HOT 7
- Triggers the `this-property-fallback` deprecation in 3.26 HOT 1
- Deprecation warnings on Ember 3.25 HOT 2
- Popover closing on click in interactive area HOT 8
- Optional component properties, overwrite the default properties HOT 1
- Project status HOT 2
- Deprecation warnings on sass HOT 1
- Show tooltip in disabled button HOT 1
- Support importing test utils from `ember-attacher/test-support`
- Ember 4x issue Ember.Object in dependencies ember-classic-decorator HOT 1
- Allow passing data-* attribute(s) to component
- Error in ember 3.28.x wrong import of htmlSafe, isHTMLSafe HOT 1
- [Quest]: Future Roadmap HOT 2
- "stripInProduction" does not actually strip the code in production HOT 1
- First rendering of a tooltip with `lazyRender="true"` doesn't hide as expected HOT 9
- Component Templates Co-location and Typescript HOT 2
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 ember-attacher.