mozilla
Los resultados de tu búsqueda

    MozActivity

    No estándar
    This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

    This API is available on Firefox or Firefox OS for installed or higher privileged applications.

    Summary

    The MozActivity interface allows apps to delegate an activity to another app.

    This interface fully inherits from the DOMRequest interface excepts that it has a constructor that it takes a MozActivityOptions as a parameter.

    Note: As soon as a MozActivity is instentiated, the system will prompt the user to choose an activity handler. It's not possible to instentiate an activity and wait to use it.

    Properties

    Inherited from DOMRequest:

    DOMRequest.onsuccess
    A callback handler called when the operation represented by the DOMRequest is completed.
    DOMRequest.onerror
    A callback handler that gets called when an error occurs while processing the operation.
    DOMRequest.readyState
    A string indicating whether or not the operation is finished running. Its value is either "done" or "pending".
    DOMRequest.result
    The operation's result.
    DOMRequest.error
    Error information, if any.

    Methods

    None.

    Example

    var activity = new MozActivity({
      // The name of the activity the app wants to delegate the action
      name: "pick",
    
      // Data requierd by the activity. Each application acting as an activity handler 
      // can have it's own requirement for the activity. If the data does not fulfill
      // all the requirement of any activity handler, the error event will be sent
      // otherwise, the event sent depend on the activity handler itself.
      data: {
        type: "image/jpeg"
      }
    });
    
    activity.onsuccess = function() {
      console.log("Activity successfuly handled");
    
      var imgSrc = this.result.blob;
    }
    
    activity.onerror = function() {
      console.log("The activity encouter en error: " + this.error);
    }
    

    Specification

    Web Activities is not part of any specification. However, it has some overlap with the proposed Web Intents specification. Mozilla actually proposed Web Activities as a counter proposal to Web Intents. For more information about this, see discussion on the Web Intents Task Force ML.

    See also

    Etiquetas y colaboradores del documento

    Contributors to this page: khalid32, fscholz, Osgux
    Última actualización por: khalid32,