A JavaScript module (written in TypeScript) for interfacing with the mockdown
server interface, plus some utilities for working with constraints
as well as Cassowary (kiwi.js
).
First, compile it:
yarn build // or npm run build
Then link it:
yarn link // or npm link
And finally, in any project you want to use your copy of this package:
yarn link mockdown-client // or npm link mockdown-client
(Instructions are more or less the same if you use npm link
.)
If you have examples such as:
const examples = [
{
"name": "p",
"rect": [0, 0, 100, 100],
"children": [/*...*/]
},
// ...
]
Then you can just:
import {fetchConstraints} from 'mockdown-client';
// If you live in the future:
const constraints = await fetchConstraints(examples);
// And if you don't, then:
fetchConstraints(examples).then((constraints) => {
// ...
});