@ua/react-native-airship
Version:
Airship plugin for React Native apps.
61 lines (56 loc) • 1.02 kB
JavaScript
/* Copyright Airship and Contributors */
;
/**
* Tag operation.
* @hidden
*/
/**
* Editor for device tags.
*/
export class TagEditor {
/**
* TagEditor constructor
*
* @hidden
* @param onApply The apply function
*/
constructor(onApply) {
this.onApply = onApply;
this.operations = [];
}
/**
* Adds tags to a channel.
*
* @param tags Tags to add.
* @return The tag editor instance.
*/
addTags(tags) {
const operation = {
operationType: 'add',
tags: tags
};
this.operations.push(operation);
return this;
}
/**
* Removes tags from the channel.
*
* @param tags Tags to remove.
* @return The tag editor instance.
*/
removeTags(tags) {
const operation = {
operationType: 'remove',
tags: tags
};
this.operations.push(operation);
return this;
}
/**
* Applies the tag changes.
*/
apply() {
return this.onApply(this.operations);
}
}
//# sourceMappingURL=TagEditor.js.map