1
0
Fork 0
freesewing/packages/core/src/design.js
Joost De Cock 261da52c3b Integrated Penelope and Waralee patterns, plus 2.1 prep
Penelope and Waralee are two new patterns by @woutervdub
This integrates them in our monorepo, including the translations
in the i18n package and the package info in the pattern-info pattern

This commit also includes a minor tweak to our core package.
Previously, you had to instantiate a pattern to get its config,
but that is no longer the case. The default export (the constructor)
now has a config property you can access without instantiating the pattern.

All of these changes will trigger a new minor release when we merge them
into master. Specifically v2.1
2019-09-21 19:42:53 +02:00

21 lines
556 B
JavaScript

import Pattern from './pattern'
export default function Design(config, plugins = false) {
const pattern = function(settings) {
Pattern.call(this, config)
if (Array.isArray(plugins)) for (let plugin of plugins) this.use(plugin)
else if (plugins) this.use(plugins)
this.apply(settings)
return this
}
// Set up inheritance
pattern.prototype = Object.create(Pattern.prototype)
pattern.prototype.constructor = pattern
// Make config available without need to instantiate pattern
pattern.config = config
return pattern
}