FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



May 27, 2015, 5:14 AM
178 Posts
topic has been resolvedResolved

loading a JS library -> Object not created

  • Category: Other
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags: javascript
  • Replies: 5

I am using a JavaScript library to identify swipe gestures.

The documentation describes how to refer to the library. In HTML it should be something as followed:

 

<html>
<head>
<script src="dist/slideout.min.js"></script>
<style>

</head>

This should create the following object:

 

I tried the following approaches in XPages to load the library:

<head>
<script src="dist/slideout.min.js"></script>
<style>

with the library as an imported file.

<xp:this.resources>
        <xp:script src="/slideout.js" clientSide="true"></xp:script>
    </xp:this.resources>

with the library as a client js library (original code imported in the library)

and finally the library code in a script block.

All these three methods seem to fail while the object is not being created.

What should I do to correct this?

 

May 27, 2015, 5:50 AM
300 Posts
What is on the browser console?
Are there any errors thrown in the console of the browser? That would be the first place to look.

Howard
May 27, 2015, 7:33 AM
178 Posts
no errors

no errors in the console. 

 

ofcourse they arise when I try to access the object which is not here.

 

the references are good too, the script is available via firebug

May 27, 2015, 9:38 AM
300 Posts
Does slideout use AMD loading?
If so, there is an incompatibility between AMD and Dojo in XPages. Google that and you will find the workarounds. Howard
May 28, 2015, 2:39 AM
178 Posts
loading a JS library -> Object not created

I am using a JavaScript library to identify swipe gestures.

The documentation describes how to refer to the library. In HTML it should be something as followed:

 

<html>
<head>
<script src="dist/slideout.min.js"></script>
<style>

</head>

This should create the following object:

 

I tried the following approaches in XPages to load the library:

<head>
<script src="dist/slideout.min.js"></script>
<style>

with the library as an imported file.

<xp:this.resources>
        <xp:script src="/slideout.js" clientSide="true"></xp:script>
    </xp:this.resources>

with the library as a client js library (original code imported in the library)

and finally the library code in a script block.

All these three methods seem to fail while the object is not being created.

What should I do to correct this?

 


FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.