Code Monkey home page Code Monkey logo

Comments (3)

enkol avatar enkol commented on September 13, 2024

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.

kybishop avatar kybishop commented on September 13, 2024

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.

kybishop avatar kybishop commented on September 13, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.