HTML and CSS Reference
In-Depth Information
FIGURE 9-8 The user interface displayed when the user attempts to share content from an application that
doesn't support the Share source contract.
Sharing data as plain text
Now you add the following new function to the bottom of the todolist.js file. The new function is
responsible for sharing the task information with other applications.
TodoList.shareDataAsPlainText = function (e, task) {
var request = e.request;
// Add data to the package
request.data.properties.title = "TO DO";
request.data.properties.description = task.description;
request.data.setText(task.description + " due by "
+ task.dueDate.toLocaleDateString());
}
The data package to fill up is given by the request.data object. The DataPackage component has
a couple of generic properties, such as title and description . You might want to set them as a way to
describe the data you're going to provide. Consider that both the Share panel and target applications
may be using these properties. So setting them to a meaningful value is always a good thing. In this
case, you set the title property to a static text such as “TO DO” and the description property to the
actual description of the task.
Search WWH ::




Custom Search