UNPKG

@ua/react-native-airship

Version:
81 lines (75 loc) 1.53 kB
/* Copyright Airship and Contributors */ 'use strict'; /** * Tag group operation. * @hidden */ /** * Editor for tag groups. */ export class TagGroupEditor { /** * TagGroupEditor constructor * * @hidden * @param onApply The apply function */ constructor(onApply) { this.onApply = onApply; this.operations = []; } /** * Adds tags to a tag group. * @param group The tag group. * @param tags Tags to add. * @return The tag group editor instance. */ addTags(group, tags) { const operation = { operationType: 'add', group: group, tags: tags }; this.operations.push(operation); return this; } /** * Removes tags from the tag group. * * @param group The tag group. * @param tags Tags to remove. * @return The tag group editor instance. */ removeTags(group, tags) { const operation = { operationType: 'remove', group: group, tags: tags }; this.operations.push(operation); return this; } /** * Overwrite the current set of tags on the Tag Group. * * @param group The tag group. * @param tags Tags to set. * @return The tag group editor instance. */ setTags(group, tags) { const operation = { operationType: 'set', group: group, tags: tags }; this.operations.push(operation); return this; } /** * Applies the tag changes. */ apply() { return this.onApply(this.operations); } } //# sourceMappingURL=TagGroupEditor.js.map