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.

unsupport to use Object.defineProperty to change the 'name' of a function.

See original GitHub issue

Environment

Environment: OS: macOS High Sierra 10.13.4 Node: 8.4.0 Yarn: 1.3.2 npm: 6.0.0 Watchman: 4.9.0 Xcode: Xcode 9.3 Build version 9E145 Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: 0.55.4 => 0.55.4

Description

Cannot change the name of anonymous function; like this:

function _genSynMethod(moduleName, methodName) {
    return Object.defineProperty(
        function () {
           ... 
           }, 'name', {value:methodName}) ;
}

Steps to Reproduce

just call function _genSynMethod

Expected Behavior

running normal , just like iOS.

Actual Behavior

2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hramoscommented, Dec 14, 2018

This will likely be fixed once we move on from the old JSC used in Android: https://github.com/facebook/react-native/issues/19737

0reactions
hramoscommented, Mar 14, 2019

0.59 is now out. If anyone happens to verify this on 0.59 and it’s still an issue, please let us know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object.defineProperty() - JavaScript - MDN Web Docs
When the property is accessed, this function is called without arguments and with this set to the object through which the property is...
Read more >
How to change Javascript function name that appears in ...
@Pointy - You can't update it (assign to it), but as the OP said, you can redefine it with defineProperty . But that...
Read more >
feeling alone and unsupported during pregnancy - Synergex
Object.defineProperties:function(t,e){a(t);for(var r,n=u(e),o=c(e) ... .exports=function(t){if("object"==typeof t||n(t))return t;throw i("Can't set "+o(t)+" ...
Read more >
Unsupported JavaScript functions and alternatives
Use the following JavaScript to return a new array iterator object that enables you to iterate through the key/value pairs in the array....
Read more >
JSDoc: Source: orasocket.js
changeHandler; //Reset the getter and setter Object.defineProperty(subject, property, { get: function () { return this.value; }, set: function (newValue) ...
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