dataarts / dat.gui

Lightweight controller library for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

async functions cannot be added to dat.gui

saviski opened this issue · comments

return Object.prototype.toString.call(obj) === '[object Function]';

async functions returns "[object AsyncFunction]"

This code fails:

let obj = {
  async f() {}
};

gui.add(obj, 'f');

Thanks! Want to open a PR changing this to obj instanceof Function, or similar?

Pull request #241 fixes this, though I used typeof obj === "function".

It also returns the ability to provide button text for your FunctionController:

gui.add( obj, property, 'Click Me!' );

Finally it fixes a double-firing click-event issue unmasked by the returned button text.
( Maybe that's why someone set button text to an empty string in ControllerFactory? )

I left the default button text of 'Fire' in place.... but its been blank so long maybe it should default to no text?

Now fixed by #242

with a one line change in utils.