question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use computed properties in node.js

See original GitHub issue
require('ember-metal');
require('ember-runtime');

const EmberObject = Ember.Object;
const computed = Ember.computed;

const User = EmberObject.extend({
  firstName: 'Izel',
  lastName: 'Nakri',
  fullName: computed('firstName', 'lastName', function() {
    return `${this.get('firstName')} ${this.get('lastName')}`;
  })
});

let me = User.create();

console.log(me.get('firstName')); // works prints 'Izel'
console.log(me.get('lastName')); // works prints 'Nakri'
console.log(me.get('fullName')); // !! CRASHES: TypeError: this.func.call is not a function

// Stacktrace:
// at ComputedProperty.Cp.get (..myproject../node_modules/ember-metal/ember-metal.js:3738:21)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
krisseldencommented, May 24, 2018

@k3n use const Ember = require('ember-source/dist/ember.debug'); and then try Object.keys(Ember) and then do new Ember.Object

If you did 2 === require('ember-source/dist/ember.debug') it would be false.

Also, the inspect issue is fixed in canary https://github.com/emberjs/ember.js/blob/3a7fd70ace89286eb192897d57d61ab4e0603fa6/packages/ember-utils/lib/inspect.ts#L29-L30

https://nodejs.org/api/util.html#util_custom_inspection_functions_on_objects

1reaction
pixelhandlercommented, Sep 28, 2018

@izelnakri @k3n @krisselden @rwjblue is this still an issue, perhaps we should close, what do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't use computed property in data - Stack Overflow
I want to pass the return value of the someCheck computed property into the disabled value in the data but in the ProgressContent...
Read more >
computed-properties - npm
Start using computed-properties in your project by running `npm i computed-properties`. There are no other projects in the npm registry ...
Read more >
Object initializer - JavaScript - MDN Web Docs - Mozilla
Computed property names are not allowed either. JSON object property values can only be strings, numbers, true , false , null , arrays,...
Read more >
Computed Properties | Docs - Ractive
The idea is fairly simple: you can define computed properties that update reactively based on their dependencies. In previous versions you may have...
Read more >
[Solved]-Can't use computed property in data-Vue.js
You can't assign a computed to a data property while the data is initializing. Even if you could, it would not be reactive,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found