webfan JavaScript Intents Service Server: Register and call services to handle Web intents

Recommend this page to a friend!
  Info   Example   Demos   View files Files   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 56 All time: 494 This week: 3Up
Version License JavaScript version Categories
intents 1.0.2BSD License5Data types, Web services
Description 

Author

This package can register and call services to handle Web intents.

It can register a MIME type and a action to be handled by a given server side service with a given URL.

If the user chooses the registered service to handle the MIME type, this
package invokes a given callback function to process the service request
on given data of that MIME type.

Innovation Award
JavaScript Programming Innovation award nominee
June 2016
Number 3
Web Intents is a new W3C standard that allows to register Web services that can handle data of a certain MIME type.

So when the user needs to open or perform other action with a given file of that MIME type from the browser, he may choose from a list of Web services that can perform that action on the file.

This package can be used to register the URLs Web services that will handle given MIME types. It can also call a given callback function to process the requested action on the file.

Manuel Lemos
Picture of Melanie Wehowski
  Performance   Level  
Name: Melanie Wehowski <contact>
Classes: 3 packages by
Country: Germany Germany
Innovation award
Innovation award
Nominee: 2x

Example

<!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://api.webfan.de/api-d/4/js-api/library.js"></script> <script type="text/javascript" src="http://frdl.webfan.de/cdn/frdl/flow/components/frdl/intent/webintents.js"></script> <script type="text/javascript" src="http://webfan.de/cdn/frdl/flow/components/webfan/webfat/js/intents.js"></script> </head> <body> <b>TestMock service...</b> <script type="text/javascript"> /* var attachEventListener = function(obj, type, func, capture) { var objs = obj instanceof Array || obj instanceof NodeList ? obj : [obj]; for(var i in objs) { if(!!objs[i].addEventListener) { objs[i].addEventListener(type, func, capture); } else if(!!objs[i].attachEvent) { objs[i].attachEvent("on" + type, func); } } }; attachEventListener(window, "message", function(ev) { if(!intent)return; intent.postResult("Test result from service"); window.opener.focus(); setTimeout(function(){ alert('Resolved testIntent (response was posted back to client): ' + JSON.stringify(intent) + ' EventData: '+ JSON.stringify(ev.data) + ' Event: '+ JSON.stringify(ev)); window.close(); },1500); }, false); */ setTimeout(function(){ frdl.when(function(){ return ( 'undefined'!==typeof frdl.frdl$intentService); }, function(){ frdl.frdl$intentService.register('text/uri-list', 'com.webfan.intents.test', function(_intent,config,appData){ var r = { code : 200, replyTo : _intent._id, message : 'Testantwort', error : null, data : { message : 'Testantwort' } }; return r; }, function(){ console.log('initFn') ; }, {}, {}) .run() ; }, {}, function(_intent){console.log('Failed to register action server');}, 1); },10000); </script> <!-- --> <!-- <intent action="http://webintents.org/shorten" type="text/uri-list" href="http://examples.webintents.org/intents/shorten/shorten_action.html" title="Kinlan's Link Shortener" /> attachEventListener(window, "load", function() { var output = document.getElementById("output"); setText(output, intent.data); intent.postResult("http://kin.ly/A"); }, false); http://examples.webintents.org/intents/shorten/shorten_action.html window.navigator.startActivity(new Intent( "http://webintents.org/shorten", "text/uri-list", 'http://example.com'), function (data) { alert(data); }); --> </body> </html>

  Demo Intent 2External page   WebApps Intent Service TestExternal page  
  Files folder image Files (8)  
File Role Description
Files folder imagetest2 (3 files)
Accessible without login Plain text file example.html Data example.html
Accessible without login Plain text file example.live-note.txt Doc. Live example
Accessible without login Plain text file intents.js Class webfanIntents Applications Server
Accessible without login Plain text file test.html Example test.html
Accessible without login Plain text file test.js Example test.js

  Files folder image Files (8)  /  test2  
File Role Description
  Accessible without login Plain text file intents.js Class source
  Accessible without login Plain text file test.html Example Example/test
  Accessible without login Plain text file test.service.html Example Example/test (service)

 Version Control Unique User Downloads Download Rankings  
 0%
Total:56
This week:0
All time:494
This week:3Up