项目作者: wanderlux

项目描述 :
WAB widget example to use third-party JS libraries
高级语言: HTML
项目地址: git://github.com/wanderlux/thirdparty-wab.git
创建时间: 2018-10-18T09:57:00Z
项目社区:https://github.com/wanderlux/thirdparty-wab

开源协议:GNU General Public License v3.0

下载


thirdparty-wab

WAB widget example to use third-party JS libraries

Since I couldn’t understand ArcGIS documentation and could not find much help online, I made this quick Web AppBuilder for ArcGIS widget to show how to add third-party libraries to them so widgets can be standalone.

Once solved it was pretty obvious but ¯\(ツ)\

I picked to add ClipboardJS as an example:

The library itself

Inside the widget folder create a new folder libs and copy the libraries you need

Loading it

Open Widget.js and add './widgets/thirdparty-wab/libs/mylibrary.js'. In this case I used:

  1. './widgets/thirdparty-wab/libs/clipboard.min.js'

Using it

Don’t forget to include it in the function in the correct order function (..., Mylibrary) if you need to reference it in your widget JS code:

  1. function(declare, BaseWidget, ClipboardJS)

Notes

Of course you could use any other folder or folder name as long as it exists within the widget folder and you load it correctly.

And that’s it.