Debian Codegraph @

resources/src/mediawiki.cookie/jquery.js

raw symbols SCIP
1 const jar = require( './jar.js' );
2
3 /**
4 * Set a cookie.
5 *
6 * To use this {@link jQuery} plugin, load the `mediawiki.cookie` module using {@link mw.loader}.
7 *
8 * @memberof module:mediawiki.cookie
9 * @method
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).
17 *
18 * @example
19 * mw.loader.using( 'mediawiki.cookie' ).then( () => {
20 * $.cookie( 'name', 'value', {} );
21 * } );
22 */
23 $.cookie = jar.cookie;
24
25 /**
26 * Remove a cookie by key.
27 *
28 * To use this {@link jQuery} plugin, load the `mediawiki.cookie` module using {@link mw.loader}.
29 *
30 * @example
31 * mw.loader.using( 'mediawiki.cookie' ).then( () => {
32 * $.removeCookie( 'name', {} );
33 * } );
34 *
35 * @memberof module:mediawiki.cookie
36 * @method
37 * @param {string} key
38 * @param {module:mediawiki.cookie~CookieOptions} options
39 * @return {boolean} True if the cookie previously existed
40 */
41 $.removeCookie = jar.removeCookie;