Skip to content

Instantly share code, notes, and snippets.

@e-jigsaw
Last active December 10, 2015 03:48
Show Gist options
  • Save e-jigsaw/4377027 to your computer and use it in GitHub Desktop.
Save e-jigsaw/4377027 to your computer and use it in GitHub Desktop.
(function() {
"use strict";
var app = WinJS.Application;
app.onactivate = function(args) {
Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView().addEventlistener("datarequested", shareHandler);
// なんやかんや
};
app.oncheckpoint = function(args) {
Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView().removeEventlistener("datarequested", shareHandler);
// なんやかんや
}
function shareHandler(e) {
var request = e.request;
var url = "http://jgs.me/";
var uri = new Windows.Foundation.Uri(url);
request.data.properties.title = "タイトル";
request.data.properties.description = "説明";
request.data.setText("Textdayo");
request.data.setUri(uri);
url = "http://jgs.me/some.png";
uri = new Windows.Foundation.Uri(url);
request.data.setBitmap(Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(uri));
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment