Improve JS bindings
Summary: - Fix a few things related to how npm should publish the package (sources were in the gitignore file, so I think it would have break the build during install - I fixed this by adding a npmignore that should override the gitignore rules) - The enumerations values are now generated directly from `enums.py` - I added percent unit support (#258) to the bindings (`.setWidthPercent` is currently exposed, but I've also added a very very little parsing to also support `.setWidth("100%")` and `.setWidth(.getWidth())`), added the missing tests, and fixed Travis. Closes https://github.com/facebook/yoga/pull/314 Reviewed By: mikearmstrong001 Differential Revision: D4377198 Pulled By: emilsjolander fbshipit-source-id: 774dfafd416f5421f3be59a1d181eb7056487abe
This commit is contained in:
committed by
Facebook Github Bot
parent
663a93912b
commit
7108454455
31
javascript/sources/Value.hh
Normal file
31
javascript/sources/Value.hh
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
struct Value
|
||||
{
|
||||
static Value fromYGValue(YGValue const & ygValue)
|
||||
{
|
||||
return Value(static_cast<int>(ygValue.unit), ygValue.value);
|
||||
}
|
||||
|
||||
int unit;
|
||||
double value;
|
||||
|
||||
Value(void)
|
||||
: unit(YGUnitUndefined)
|
||||
, value(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
Value(int unit, double value)
|
||||
: unit(unit)
|
||||
, value(value)
|
||||
{
|
||||
}
|
||||
|
||||
void toJS(nbind::cbOutput expose) const
|
||||
{
|
||||
expose(unit, value);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user