elstar IT

Fullstack | Java | Tech Speaker | Tech Coach | Frank van der Linden

  • About me
  • Blog license
  • My Open source projects

Quick XPages tip: add pace.js to your app

29-03-2016 4 responses flinden68 development

pace-js-custom-loading-bar-featured-720x340

Last week John Jardin pointed me to a very interested progress bar project, Pace JS.

It is a loading progress bar which runs out of the box only by adding the Javascript and CSS theme. There is a possibility to configure it, but it is not necessary.

Getting started

I added in bower.json file the Bower package name and run Bower to update my client side framework in my On Disk Project.
{
“name”: “bower4xpages”,
“version”: “0.0.1”,
“dependencies”: {
“bootstrap.growl”: “latest”,
“eonasdan-bootstrap-datetimepicker”: “latest”,
“moment”: “latest”,
“underscore”: “latest”,
“fontawesome”: “latest”,
“pace”:”latest”
},
“private”: true
}

Next step is to refresh my On Disk Project in the Navigator inside the Domino Designer and sync the Database with my On Disk Project.

Include it

In my theme I only have to add 2 new entries

<resource>
		<content-type>application/x-javascript</content-type>
		<href>libs/pace/pace.js</href>
	</resource>
	
	<resource>
		<content-type>text/css</content-type>
		<href>libs/pace/themes/blue/pace-theme-minimal.css</href>
	</resource>

Build my application an reload a page in my XPages app……… but there was an javascript.

There is a need to disable in the AMD loader in the javascript file, or use the working around at XSnippets.

To disable AMD in the Pace.js file, replace this

if (typeof define === 'function' && define.amd) {
    define(['pace'], function() {
      return Pace;
    });
  } else if (typeof exports === 'object') {
    module.exports = Pace;
  } else {
    if (options.startOnPageLoad) {
      Pace.start();
    }
  }

By this

if (options.startOnPageLoad) {
      Pace.start();
    }

Happy coding…

Tags: bower, development, xpages

4 thoughts on “Quick XPages tip: add pace.js to your app”

  1. Eric McCormick says:
    29-03-2016 at 20:28

    Nice one.

    Side note: have you considered either a syntax highlighter for your code blocks (or using gist.github.com)?

    Reply
    1. Frank van der Linden says:
      29-03-2016 at 20:55

      Thanks, I have updated my blog with the highlighter

      Reply
  2. Patrick Kwinten says:
    30-03-2016 at 15:08

    I tried it, looks good!

    It tested it with a page with a data view on it, at page load the indicator was shown, when I navigated through the view via a pager control the indicator never appeared (too short interval). I guess it needs some kind of minimal load time? Can I specify this interval?

    Reply
    1. Frank van der Linden says:
      30-03-2016 at 16:11

      Please see the documentation. There you can find more configuration parameters.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • « Update of the Jackson JSON mapper plugin
  • Hello Jackson4XPages f.k.a Jackson JSON wrapper »

Contact me

My name is Frank van der Linden and I am an independent software developer based in the Netherlands. The last 2 years I was awarded as IBM Champion. Also I am on the board of OpenNTF. My specialisations are Java, Web development and Domino.


If you want to hire me, please fill in the Contact form


IBM Champion web badge
Apache Logo

All the code on this blog are under the Apache License 2.0. For more details, see Apache License 2.0

Most recent posts

  • Engage 2020: Hello are you listening, There is stream for everything
  • Spring Cloud Function on Azure run locally
  • Deploy Spring Cloud Function to IBM Cloud
  • Speaking (again) at Engage in a Zoo
  • Congratulations, you’re an IBM Champion (again)!

Latest reactions

  • Spring Cloud Function on Azure run locally - elstar IT on Deploy Spring Cloud Function to IBM Cloud
  • flinden68 on Quick XPages tip: add Fullcalendar plugin to your application
  • Rajesh samal on Quick tip: Swagger support for Spring Webflux
  • dsieyx on Quick XPages tip: add Fullcalendar plugin to your application
  • John on Named as IBM Champion 2019

Archive

  • March 2020
  • February 2020
  • January 2020
  • October 2019
  • September 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • October 2018
  • September 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014

Category

  • bluemix
  • business
  • cloudant
  • community
  • development
  • hrassistant
  • openntf
  • running
  • salesforce
  • Springboot
  • Tesla
  • trailrunning
  • Uncategorized
  • watson
  • OpenNTF
  • Collaboration Today
  • XSnippets
  • Stackoverflow
  • IBM Collaboration Solutions
  • Social Business Toolkit
  • About me
  • Dutch curriculum vitae
  • English curriculum vitae
  • Google+
  • LinkedIn profile
  • Twitter
  • Slideshare
  • Blog license
  • My open source projects