Add removeField

This commit is contained in:
Crow Crowcrow 2017-08-31 12:22:52 +02:00
parent 460ab16b93
commit e0d86209ff

View File

@ -111,6 +111,23 @@ class Serializer {
} }
} }
/**
* removeField
*
* @param {(HTMLElement|Serializer|SerializerField)} f Serializer child
*/
removeField(f){
if(this._fields.has(f.name)){
let fields = this._fields.get(f.name)
if(Array.isArray(fields)){
let index = fields.indexOf(f);
this._fields.set(f.name, fields.splice(index, 1))
} else {
this._fields.delete();
}
}
}
/** /**
* serialize * serialize
* *