User:Gauransh Dingwani/common.js

mw.loader.using( 'mw.Api' ).then( function {  // Call to the function that uses mw.Api  var api = new mw.Api; api.get( { action: 'query', prop: 'pageviews', titles: [mw.config.get('wgPageName'),] } ).done( function ( data ) { console.log( data["query"].pages[mw.config.get('wgArticleId')].pageviews["2021-02-21"] ); // data["query"].pages[mw.config.get('wgArticleId')].pageviews.map((date) => console.log(date[1])); console.log(mw.config.get('wgArticleId')); } ); } );