()
| 153 | } |
| 154 | |
| 155 | buildAttributesWithDefaults () { |
| 156 | const t0 = new Date() |
| 157 | const clone = $.extend(true, {}, this.attributes) |
| 158 | const thisTV4 = tv4.freshApi() |
| 159 | thisTV4.addSchema('#', this.schema()) |
| 160 | thisTV4.addSchema('metaschema', require('schemas/metaschema')) |
| 161 | TreemaUtils.populateDefaults(clone, this.schema(), thisTV4) |
| 162 | this.attributesWithDefaults = clone |
| 163 | const duration = new Date() - t0 |
| 164 | if (duration > 10) { return console.debug(`Populated defaults for ${this.type()}${this.attributes.name ? ' ' + this.attributes.name : ''} in ${duration}ms`) } |
| 165 | } |
| 166 | |
| 167 | loadFromBackup () { |
| 168 | if (!this.saveBackups) { return } |
no test coverage detected