2021-10-17 18:26:00 +02:00
|
|
|
---
|
|
|
|
title: Design
|
2021-08-25 16:09:31 +02:00
|
|
|
order: 10
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
The `Design` object in FreeSewing's core library serves a single purpose:
|
|
|
|
To instantiate new pattern designs.
|
|
|
|
|
|
|
|
## Design constructor
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
|
|
|
function freesewing.Design(
|
|
|
|
object config,
|
|
|
|
object|array plugins, // optional
|
|
|
|
object|array conditionalPlugins // optional
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
2022-02-19 08:04:25 +01:00
|
|
|
This constructor creates a new pattern design.
|
2021-08-25 16:09:31 +02:00
|
|
|
It takes the following arguments:
|
|
|
|
|
2022-02-20 14:44:38 +01:00
|
|
|
- `config` : The pattern configuration
|
|
|
|
- `plugins` : Either a [plugin object](/guides/plugins/), or an array of plugin objects
|
|
|
|
- `conditionalPlugins` : Either a [conditional plugin object](/guides/plugins/conditionally-loading-build-time-plugins/), or an array
|
|
|
|
of conditional plugin objects to (conditionally) load in your pattern
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
|
|
|
import freesewing from "@freesewing/core"
|
|
|
|
import plugins from "@freesewing/plugin-bundle"
|
|
|
|
import config from "../config"
|
|
|
|
|
|
|
|
// Create new design
|
|
|
|
const Sorcha = new freesewing.Design(config, plugins)
|
|
|
|
```
|
|
|
|
|
|
|
|
<Tip>
|
|
|
|
|
2022-02-20 14:35:50 +01:00
|
|
|
This method is a _super-constructor_. It will return a constructor
|
2021-09-25 17:05:18 +02:00
|
|
|
method that will become the default export of your design and
|
2022-02-19 08:04:25 +01:00
|
|
|
should be called to instantiate your pattern.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-09-25 17:05:18 +02:00
|
|
|
See [creating a new pattern design](/howtos/code/create-new-design) for a complete example.
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
</Tip>
|