-
Notifications
You must be signed in to change notification settings - Fork 500
/
Copy pathReceivedShardText.js
40 lines (34 loc) · 1.68 KB
/
ReceivedShardText.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// For an introduction to the Blank template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232509
(function () {
"use strict";
var app = WinJS.Application;
var output = document.getElementById("output");
// This function responds to all application activations.
app.onactivated = function (eventObject) {
if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.shareTarget) {
//document.getElementById("output").innerText = "shareTarget Activation success.";
//<SnippetHowToReceiveSharedText>
var shareOperation = eventObject.detail.shareOperation;
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
//<SnippetGetTextAsync>
shareOperation.data.getTextAsync().done(function (text) {
// To output the text using this example,
// you need a div tag with an id of "output" in your HTML file.
document.getElementById("output").innerText = text;
}, function (e) {
displayError("Error retrieving Text format: " + e);
}
});
//</SnippetGetTextAsync>
}
//</SnippetHowToReceiveSharedText>
//<SnippetReceivedContentContainsText>
if (shareOperation.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.text)) {
// Code to process text goes here.
}
//</SnippetReceivedContentContainsText>
}
};
app.start();
})();