vss-web-extension-sdk
Advanced tools
Comparing version 1.110.0 to 2.109.0
{ | ||
"name": "vss-web-extension-sdk", | ||
"version": "1.110.0", | ||
"description": "Visual Studio Services Client SDK. JavaScript library for Visual Studio Online extensions.", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"version": "2.109.0", | ||
"description": "Visual Studio Services Client SDK. JavaScript library for Visual Studio Team Services extensions.", | ||
"repository": { | ||
@@ -12,14 +9,11 @@ "type": "git", | ||
}, | ||
"scripts": { | ||
"build": "tsc -p .", | ||
"prepublish": "npm run build" | ||
}, | ||
"keywords": [ | ||
"extensions", | ||
"visual studio online" | ||
"visual studio team services" | ||
], | ||
"typescript": { | ||
"definitions": [ | ||
"typings/rmo.d.ts", | ||
"typings/tfs.d.ts", | ||
"typings/vss.d.ts" | ||
] | ||
}, | ||
"author": "vsalmopen", | ||
"author": "Microsoft", | ||
"license": "MIT", | ||
@@ -33,3 +27,15 @@ "bugs": { | ||
"format": "global" | ||
}, | ||
"types": "./typings/index.d.ts", | ||
"dependencies": { | ||
"@types/jquery": "^2.0.34", | ||
"@types/jqueryui": "^1.11.31", | ||
"@types/knockout": "^3.4.38", | ||
"@types/q": "0.0.32", | ||
"@types/react": "^0.14.54", | ||
"@types/requirejs": "^2.1.28" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^2.0.10" | ||
} | ||
} |
@@ -5,5 +5,5 @@ # Visual Studio Services Web Extension SDK | ||
This repository contains core client SDK script files and TypeScript declare files needed for developing [Visual Studio Team Services Extensions](https://www.visualstudio.com/integrate/extensions/overview). | ||
Core client SDK script files and TypeScript declare files needed for developing [Visual Studio Team Services Extensions](https://www.visualstudio.com/integrate/extensions/overview). | ||
The core SDK script, `VSS.SDK.js`, enables extensions to communicate to the host Team Services frame and to perform operations like initializing, notifying extension is loaded or getting context about the current page. | ||
The core SDK script, `VSS.SDK.js`, enables web extensions to communicate to the host Team Services frame and to perform operations like initializing, notifying extension is loaded or getting context about the current page. | ||
@@ -14,23 +14,36 @@ > A previous version of the SDK was named ```vss-sdk``. Make sure to switch to the new `vss-web-extension-sdk` name. | ||
### Bower | ||
1. [Download](https://nodejs.org/en/download/) and install Node.js | ||
2. Install Bower (`npm install -g bower`) | ||
3. Run `bower install vss-web-extension-sdk` from a command line | ||
2. Run `npm install vss-web-extension-sdk` from the root of your extension project | ||
From your extension's HTML page, add a reference to the imported SDK script. For example: | ||
This will place `VSS.SDK.js` and `VSS.SDK.min.js` in `node_modules/vss-web-extension-sdk/lib/` | ||
```html | ||
<script src="bower_components/vss-web-extension-sdk/lib/VSS.SDK.min.js"></script> | ||
``` | ||
### NPM | ||
### Add script to HTML page | ||
Alternatively, the SDK is available via NPM. Run `npm install vss-web-extension-sdk` | ||
\ | ||
If you are developing a web extension, you will need to reference the SDK script from your HTML pages. For example: | ||
``` | ||
<script src="lib/VSS.SDK.min.js"></script> | ||
``` | ||
To ensure the SDK is included with your extension package, update your extension manifest (typically `vss-extension.json`) with a new `files` entry: | ||
``` | ||
{ | ||
"files": [{ | ||
"path": "node_modules/vss-web-extension-sdk/lib/VSS.SDK.min.js", | ||
"addressable": true, | ||
"partName": "lib/VSS.SDK.min.js" | ||
}] | ||
} | ||
``` | ||
## Use the SDK | ||
Next step is initializing the extension using two options below: | ||
1. Implicit handshake | ||
```javascript | ||
To initialize the SDK from your HTML page you have two options. | ||
1. Implicit handshake (simplest) | ||
```html | ||
<script> | ||
// Initialize | ||
@@ -46,6 +59,10 @@ VSS.init({ | ||
}); | ||
</script> | ||
``` | ||
2. Explicit handshake | ||
```javascript | ||
```html | ||
<script> | ||
// Initialize with explicitNotifyLoaded set to true | ||
@@ -58,5 +75,5 @@ VSS.init({ | ||
// Perform some async operation here | ||
doSomeAsyncStuff().then( | ||
function(result) { | ||
// Perform some async operation here | ||
doSomeAsyncStuff().then( | ||
function(result) { | ||
// Succeeded | ||
@@ -66,7 +83,9 @@ VSS.notifyLoadSucceeded(); | ||
// Start using VSS | ||
}, | ||
function(error) { | ||
}, | ||
function(error) { | ||
// Failed | ||
VSS.notifyLoadFailed(error); | ||
}); | ||
} | ||
); | ||
</script> | ||
``` | ||
@@ -87,15 +106,14 @@ | ||
### Using tsd | ||
Although TypeScript declare files do not exist at [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) repo, they can still be used through [tsd](https://www.npmjs.com/package/tsd). | ||
### Consuming the Types | ||
1. First, make sure that the dependencies are loaded using below command: | ||
* `tsd install jquery knockout q react require --save` | ||
2. Next, run below command to get vss-web-extension-sdk types added to tsd.d.ts: | ||
* `tsd link` | ||
You only need to add below line to the top of your TypeScript file: | ||
3. Finally, add only reference to typings/tsd.d.ts in your TypeScript files. | ||
``` | ||
/// <reference types="vss-web-extension-sdk" /> | ||
``` | ||
Make sure that you specify ```"moduleResolution": "node"``` in your tsconfig.json file. | ||
## Code of Conduct | ||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
1844120
13
52644
0
114
6
1
+ Added@types/jquery@^2.0.34
+ Added@types/jqueryui@^1.11.31
+ Added@types/knockout@^3.4.38
+ Added@types/q@0.0.32
+ Added@types/react@^0.14.54
+ Added@types/requirejs@^2.1.28
+ Added@types/jquery@2.0.68(transitive)
+ Added@types/jqueryui@1.12.23(transitive)
+ Added@types/knockout@3.4.77(transitive)
+ Added@types/q@0.0.32(transitive)
+ Added@types/react@0.14.57(transitive)
+ Added@types/requirejs@2.1.37(transitive)