Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s-kainet/spasyncscript
SPAsyncScript lets you implement SharePoint Script On Demand (SOD) easily
https://github.com/s-kainet/spasyncscript
Last synced: about 10 hours ago
JSON representation
SPAsyncScript lets you implement SharePoint Script On Demand (SOD) easily
- Host: GitHub
- URL: https://github.com/s-kainet/spasyncscript
- Owner: s-KaiNet
- License: mit
- Created: 2015-03-17T07:38:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-03-17T14:43:13.000Z (over 9 years ago)
- Last Synced: 2024-04-09T13:21:30.712Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 234 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SPAsyncScript
---
This small JavaScript file can help you implement SharePoint SOD (Script On Demand) solution for your own (or even external) scripts.
## Examples
Register your script:
```
var asyncScript = new SPAsyncScript(name, src, scriptLoadedCallback);
```
`name` - required, unique script name
`src` - required, script src, any valid value for javascript src is acceptable
`scriptLoadedCallback` - optional, this function will be called when your script will be loadedExplicitly load your script:
```
asyncScript.load(sync);
````sync` - optional, if true script will be loaded synchronously
You can also register a dependency on other scripts (including out-of-the-box):
```
var coreScript = new SPAsyncScript("myApp.core", coreSrc);
asyncScript.registerDependency([coreScript]);
asyncScript.registerDependencyByName(["sp.js", "sp.runtime.js"]);
```Your script will be loaded after the `sp.js`, `sp.runtime.js`, `coreScript`.
Additionally you can use `ExecuteOrDelayUntilScriptLoaded` function in order to execute some code when your script will be loaded:
```
ExecuteOrDelayUntilScriptLoaded(function () {
alert("My app script loaded!");
}, "myApp.core");
```