UNPKG

1.85 kBJavaScriptView Raw
1import { _ClientsidePage } from "../clientside-pages/types.js";
2import { Item } from "../items/index.js";
3import { spPost } from "../operations.js";
4import { SPQueryable } from "../spqueryable.js";
5_ClientsidePage.prototype.addComment = async function (info) {
6 const item = await this.getItem();
7 return item.comments.add(info);
8};
9_ClientsidePage.prototype.getCommentById = async function (id) {
10 const item = await this.getItem();
11 const data = await item.comments.getById(id)();
12 return Object.assign(item.comments.getById(id), data);
13};
14_ClientsidePage.prototype.clearComments = async function () {
15 const item = await this.getItem();
16 return item.comments.clear();
17};
18_ClientsidePage.prototype.getComments = async function () {
19 const item = await this.getItem();
20 return item.comments();
21};
22_ClientsidePage.prototype.like = async function () {
23 const item = await this.getItem("ID");
24 return spPost(SPQueryable(item, "like"));
25};
26_ClientsidePage.prototype.unlike = async function () {
27 const item = await this.getItem("ID");
28 return spPost(SPQueryable(item, "unlike"));
29};
30_ClientsidePage.prototype.getLikedByInformation = async function () {
31 const item = await this.getItem("ID");
32 return item.getLikedByInformation();
33};
34_ClientsidePage.prototype.enableComments = async function () {
35 return this.setCommentsOn(true).then(r => {
36 this.commentsDisabled = false;
37 return r;
38 });
39};
40_ClientsidePage.prototype.disableComments = async function () {
41 return this.setCommentsOn(false).then(r => {
42 this.commentsDisabled = true;
43 return r;
44 });
45};
46_ClientsidePage.prototype.setCommentsOn = async function (on) {
47 const item = await this.getItem();
48 return Item(item, `SetCommentsDisabled(${!on})`).update({});
49};
50//# sourceMappingURL=clientside-page.js.map
\No newline at end of file