Advertisement
Guest User

excerpt of code for sth

a guest
Feb 24th, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    "watchPage": (page, expiry, callback) => {
  2.         // https://www.mediawiki.org/wiki/API:Watch
  3.         // MediawikiJS api
  4.         const expireParam = expiry == 0 ? { unwatch: true } : { expiry: expiry };
  5.         new mw.Api().postWithToken('watch', { action: 'watch', titles: page, format: 'json', ...expireParam }).done((data) => {
  6.             if (data.errors == null || data.errors.length < 1) {
  7.                 callback(true);
  8.             } else {
  9.                 console.error(data);
  10.                 callback(false);
  11.             }
  12.         }).fail(() => {
  13.             console.log("fail received") /* when testing i saw this logged */
  14.             callback(false)
  15.         });
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement