2019-08-03 15:03:33 +02:00
|
|
|
import Pattern from './pattern'
|
2019-02-16 07:28:56 +01:00
|
|
|
|
|
|
|
export default function Design(config, plugins = false) {
|
|
|
|
const pattern = function(settings) {
|
2019-08-03 15:03:33 +02:00
|
|
|
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)
|
2019-02-16 07:28:56 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return this
|
|
|
|
}
|
2019-02-16 07:28:56 +01:00
|
|
|
|
|
|
|
// Set up inheritance
|
2019-08-03 15:03:33 +02:00
|
|
|
pattern.prototype = Object.create(Pattern.prototype)
|
|
|
|
pattern.prototype.constructor = pattern
|
2019-02-16 07:28:56 +01:00
|
|
|
|
2019-08-03 15:03:33 +02:00
|
|
|
return pattern
|
2019-02-16 07:28:56 +01:00
|
|
|
}
|