mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-72108 js: Fix incorrect jsdoc examples for core/ajax
This commit is contained in:
parent
3610f1ee3b
commit
36f21508fb
2 changed files with 25 additions and 9 deletions
File diff suppressed because one or more lines are too long
|
@ -150,29 +150,45 @@ define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Lo
|
||||||
* @return {Promise[]} The Promises for each of the supplied requests.
|
* @return {Promise[]} The Promises for each of the supplied requests.
|
||||||
* The order of the Promise matches the order of requests exactly.
|
* The order of the Promise matches the order of requests exactly.
|
||||||
*
|
*
|
||||||
|
* @example <caption>A simple example that you might find in a repository module</caption>
|
||||||
|
*
|
||||||
|
* import {call as fetchMany} from 'core/ajax';
|
||||||
|
*
|
||||||
|
* export const fetchMessages = timeSince => fetchMany([{methodname: 'core_message_get_messages', args: {timeSince}}])[0];
|
||||||
|
*
|
||||||
|
* export const fetchNotifications = timeSince => fetchMany([{
|
||||||
|
* methodname: 'core_message_get_notifications',
|
||||||
|
* args: {
|
||||||
|
* timeSince,
|
||||||
|
* }
|
||||||
|
* }])[0];
|
||||||
|
*
|
||||||
|
* export const fetchSomethingElse = (some, params, here) => fetchMany([{
|
||||||
|
* methodname: 'core_get_something_else',
|
||||||
|
* args: {
|
||||||
|
* some,
|
||||||
|
* params,
|
||||||
|
* gohere: here,
|
||||||
|
* },
|
||||||
|
* }])[0];
|
||||||
|
*
|
||||||
* @example <caption>An example of fetching a string using the cachekey parameter</caption>
|
* @example <caption>An example of fetching a string using the cachekey parameter</caption>
|
||||||
* import {call as fetchMany} from 'core/ajax';
|
* import {call as fetchMany} from 'core/ajax';
|
||||||
* import * as Notification from 'core/notification';
|
* import * as Notification from 'core/notification';
|
||||||
*
|
*
|
||||||
* export const performAction = (some, args) => {
|
* export const performAction = (some, args) => {
|
||||||
* Promises.all(fetchMany('core_get_string', {
|
* Promises.all(fetchMany([{methodname: 'core_get_string', args: {
|
||||||
* stringid: 'do_not_copy',
|
* stringid: 'do_not_copy',
|
||||||
* component: 'core',
|
* component: 'core',
|
||||||
* lang: 'en',
|
* lang: 'en',
|
||||||
* stringparams: [],
|
* stringparams: [],
|
||||||
* }, true, false, false, undefined, M.cfg.langrev))
|
* }}], true, false, false, undefined, M.cfg.langrev))
|
||||||
* .then(([doNotCopyString]) => {
|
* .then(([doNotCopyString]) => {
|
||||||
* window.console.log(doNotCopyString);
|
* window.console.log(doNotCopyString);
|
||||||
* })
|
* })
|
||||||
* .catch(Notification.exception);
|
* .catch(Notification.exception);
|
||||||
* };
|
* };
|
||||||
*
|
*
|
||||||
* @example <caption>A simple example that you might find in a repository function</caption>
|
|
||||||
*
|
|
||||||
* import {call as fetchMany} from 'core/ajax';
|
|
||||||
*
|
|
||||||
* export const fetchMessages = timeSince => fetchMany('core_message_get_messages', {timeSince}})[0];
|
|
||||||
* export const fetchNotifications = timeSince => fetchMany('core_message_get_notifications', {timeSince}})[0];
|
|
||||||
*/
|
*/
|
||||||
call: function(requests, async, loginrequired, nosessionupdate, timeout, cachekey) {
|
call: function(requests, async, loginrequired, nosessionupdate, timeout, cachekey) {
|
||||||
$(window).bind('beforeunload', function() {
|
$(window).bind('beforeunload', function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue