1 const jar = require( './jar.js' );
6 * To use this {@link jQuery} plugin, load the `mediawiki.cookie` module using {@link mw.loader}.
8 * @memberof module:mediawiki.cookie
10 * @param {string} [key] Cookie name or (when getting) omit to return an object with all
11 * current cookie keys and values.
12 * @param {string|null} [value] Cookie value to set. If `null`, this method will remove the cookie.
13 * If omited, this method will get and return the current value.
14 * @param {module:mediawiki.cookie~CookieOptions} [options]
15 * @return {string|Object} The current value (if getting a cookie), or an internal `document.cookie`
16 * expression (if setting or removing).
19 * mw.loader.using( 'mediawiki.cookie' ).then( () => {
20 * $.cookie( 'name', 'value', {} );
23 $.cookie = jar.cookie;
26 * Remove a cookie by key.
28 * To use this {@link jQuery} plugin, load the `mediawiki.cookie` module using {@link mw.loader}.
31 * mw.loader.using( 'mediawiki.cookie' ).then( () => {
32 * $.removeCookie( 'name', {} );
35 * @memberof module:mediawiki.cookie
38 * @param {module:mediawiki.cookie~CookieOptions} options
39 * @return {boolean} True if the cookie previously existed
41 $.removeCookie = jar.removeCookie;