Code Monkey home page Code Monkey logo

Comments (23)

micahkatz avatar micahkatz commented on May 3, 2024

+1
how do you fix this?

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

Would it be an acceptable fix to do something like:

return typeof HTMLElement !== "undefined" && obj instanceof HTMLElement;

?

If so, we'd accept a PR for that!

/cc @kenwheeler

from react-game-kit.

micahkatz avatar micahkatz commented on May 3, 2024

@ryan-roemer I fixed it

from react-game-kit.

micahkatz avatar micahkatz commented on May 3, 2024

I changed that line but it came up with another error about performance in world.js, located in lib/native/components. Line 44 has the current time by performance.now(), which brings an error. I changed it to d.getTime() after doing var d = new Date();

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

For the performance.now() we could either document a required polyfill for usertiming or put guards around performance -- any preference @kenwheeler ?

from react-game-kit.

notlose avatar notlose commented on May 3, 2024

Still facing this problem "ReferenceError: Can't find variable: HTMLElement"
any workaround for this? since matter-js already have a fix on this one
liabru/matter-js@18a0845
but i still have no luck on make this work.

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

@notlose -- matter-js needs to release a new version. It's just committed to master and not actually published.

from react-game-kit.

notlose avatar notlose commented on May 3, 2024

@ryan-roemer thanks for reply. tried to update package.json inside react-game-kit with github repository url, still getting same result 🤔

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

@notlose -- What's your full stack trace?

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

@stefvhuynh -- Side note: This ticket may be blocked by upstream matter-js release. If so, Add [Blocked] to the title and move to bottom of Backlog. Thanks!

from react-game-kit.

notlose avatar notlose commented on May 3, 2024

@ryan-roemer

[email protected] /Users/xxx/projects/TestApp
└─┬ [email protected]
└── [email protected] (git://github.com/liabru/matter-js.git#64be5a5e3ea3092c3318779966df6cd5a1d71e89)

2017-11-28 11 11 53

thanks!

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

So here's the problem -- they haven't updated build/*.js:

https://github.com/liabru/matter-js/blob/64be5a5e3ea3092c3318779966df6cd5a1d71e89/package.json#L8

  "main": "build/matter.js",

which leads us to: https://github.com/liabru/matter-js/blob/64be5a5e3ea3092c3318779966df6cd5a1d71e89/build/matter.js#L4384-L4392

    /**
     * Returns true if the object is a HTMLElement, otherwise false.
     * @method isElement
     * @param {object} obj
     * @return {boolean} True if the object is a HTMLElement, otherwise false
     */
    Common.isElement = function(obj) {
        return obj instanceof HTMLElement;
    };

I think you might need to go into node_modules/matter-js and install dev dependencies and run something like:

$ gulp build:release

if I'm reading their scripts right.

... or we wait for them to publish 😛

from react-game-kit.

micahkatz avatar micahkatz commented on May 3, 2024

@notlose you have to go into node modules and change a few things. In node_modules/matter-js/build/matter.js, you need to change liabru/matter-js@63b02cf#diff-8af3a370948de7c6ae76591bfafe12d1R4391 to
return typeof HTMLElement !== "undefined" && obj instanceof HTMLElement;`
and in world.js inside of react-game-kit/native/...world.js, you need to change the performance error that pulls up after fixing the first HTMLElement error. My earlier comment should help
screen shot 2017-11-27 at 11 11 27 pm

from react-game-kit.

notlose avatar notlose commented on May 3, 2024

@ryan-roemer , @katzmannn thanks for advise! it works now combining you two's advise.
i have cloned matter-js from git and gulp build:release, and then fix the performance error by @katzmannn suggestion. thanks!

from react-game-kit.

kjin9174 avatar kjin9174 commented on May 3, 2024

Hello
I am starting react game kit
so i need your help.
I need simple code package for simple animation.
I will understand well about this example.
Thanks

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

@kjin9174 -- Please only comment on issues that you are directly facing or can help out with. General purpose help is best sought out on Stack Overflow, or the existing "help me get started" issue you opened at #51. Thanks!

from react-game-kit.

kjin9174 avatar kjin9174 commented on May 3, 2024

thanks

from react-game-kit.

stefvhuynh avatar stefvhuynh commented on May 3, 2024

@Dantix, can you confirm that this issue is resolved with the release of [email protected]? Our package.json pulls in matter-js: ^0.13.0, so you should be able to get 0.14.0 with a fresh npm i.

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

I don’t have a computer around but for 0.x.x will that actually match 0.14.0? I didn’t think it would

from react-game-kit.

stefvhuynh avatar stefvhuynh commented on May 3, 2024

ah, you are right, @ryan-roemer

from react-game-kit.

kowalk avatar kowalk commented on May 3, 2024

@ryan-roemer but you have a yarn.lock file in your repository, please upgrade matter-js there (version in lock file is 0.13). I've seen source of [email protected] and it has proper fix.

from react-game-kit.

stefvhuynh avatar stefvhuynh commented on May 3, 2024

Here is the PR to close this issue: #55

from react-game-kit.

ryan-roemer avatar ryan-roemer commented on May 3, 2024

Thanks @stefvhuynh

@kowalk -- The yarn.lock file doesn't matter at all for consuming packages taking an npm dependency on react-game-kit. In fact, it's not even published to the registry -- e.g., https://unpkg.com/[email protected]/

from react-game-kit.

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.