GithubHelp home page GithubHelp logo

Comments (3)

malatin3 avatar malatin3 commented on August 21, 2024

@asross Did you ever get a chance to think about which direction to take this? I'm willing to work on a PR

from dynamic-link.

asross avatar asross commented on August 21, 2024

Hey, thanks for the issue and your willingness to work on a PR. This is a tricky one, isn't it?

The best thing would be if we could somehow use target to get the component's target object but still allow users to pass target='_blank' when creating the component. That would keep the library totally backwards-compatible. It would be worth looking into whether that's possible.

If it isn't, then I think we should just bite the bullet and introduce another property like linkTarget which we include in attributeBindings as 'linkTarget:target' (but support both target and linkTarget in the params). So basically:

attributeBindings: ['linkTarget:target'],

linkTarget: Ember.computed('params.linkTarget', 'params.target', function() {
  return this.get('params.linkTarget') || this.get('params.target')
}),

performAction: function() {
  var target = this.get('target') || this.get('targetObject') || this.get('_targetObject');
   // ...
}

We can then remove support for the bare target property and bump the major version. Sound like a reasonable plan?

from dynamic-link.

asross avatar asross commented on August 21, 2024

Actually, if we wanted to be really sneaky, we could check if this.get('target') is a string or not, like this:

linkTarget: Ember.computed('params.linkTarget', 'params.target', 'target', function() {
  if (typeof this.get('target') === 'string') {
     return this.get('target');
  } else {
     return this.get('params.linkTarget') || this.get('params.target');
   }
}),

performAction: function() {
  var target = this.get('target');
  if (typeof target === 'string') {
     target = this.get('targetObject') || this.get('_targetObject');
  }
   // ...
}

Then we avoid introducing a backwards incompatibility :)

from dynamic-link.

Related Issues (5)

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.