Ubiquity Commands as HTML Pages – Response to Aza’s Proposal

Aza initiated a very interesting discussion on a new way of writing Ubiquity Commands. I would like to iterate on that concept and provide some feedback.

The core of the idea is to think of the command as a preview which can be executed and center the design on simplifying the implementation of previews. One of the key benefit is that previews are really HTML pages with some extra access so Aza’s suggestion makes Ubiquity commands closer to writing HTML pages. I would like to go one step further and say that a command is an HTML page and the URL of that page is the natural language input of the user.

<html>
<head>
  <!-- DECLARATION/DEFINITION OF THE COMMAND -->
  <title>share on feedly</title>
  <meta name="accepts"
        content="feedly-share [note as noun_arb_text] tagged [tag as noun_type_feedly_tag]" />

  <meta name="dependencies" content="reader, tinyurl" />

  <meta name="description"
        content="Shares the current page in both feedly and Google Reader" />
  <meta name="help"
        content="Feedly will correlate the current web page you are viewing..." />

  <script>
  // DEPENDENCY INJECTION
  // Based on the dependencies meta declaration. Need access control to make sure that the
  // user wants to grant this command the priviledges necessary to access those extra
  // services.
  var reader = null;
  function setReader( value ) {
     reader = value;
  }

  var tinyURL = null;
  function setTinyURL( value ) {
     tinyURL = value
  }

  // LIFECYCLE MANAGEMENT
  //
  window.onLoad = function() {
  }

  // This method is called by the ubiquity framework every time the user changes
  // the input. The magic here is that Ubiquity does all the parsing. Note. There
  // are no more pblock passed in because the body of this document is the pblock.
  window.onInputChanged = function( directObj, modifiers ) {
     // as a command developer I can implement the preview logic, leverage services like
     // reader and tinyURL and when I am ready, update the body of this document.
     // This is 100% standard HTML/Javascript/CSS stuff.
     // As noted by Aza in his initial proposal, one of the benefit of this approach
     // is that the preview can incrementally update itself as the input changes, no need to
     // throw everything away and start over.
  }

  // This method is invoked by the ubiquity framework when the user is happy with that
  // he sees in the preview and he or see wants to execute this command. Like for the
  // onInputChange, the magic is that the natural language input from the user is magically
  // parsed by Ubiquity into a set of inputs based on the accepts meta declaration.
  window.onExecute = function( directObj, headers ) {
      // as a command developer I can implement the execute logic, leverage services
      // like reader and tinyURL and this is 100% standard Javascript.
  }

  window.onUnload = function() {
      reader  = null;
      tinyURL = null;

      // Could use this to change my state to unloaded in case I have pending
      // async requests.
  }
  </script>

  </head>
  <body>
     <!-- UI: The content of the body is the preview displayed by ubiquity -->
  </body>
</html>

I have not thought through all the details but Aza’s note inspired me to try to push a first draft out. Let me know what you think.

Author: @feedly

Read more. Know more.

8 thoughts on “Ubiquity Commands as HTML Pages – Response to Aza’s Proposal”

  1. Hi would you mind stating which blog platform you’re using?

    I’m looking to start my own blog in the near future but I’m
    having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your design seems different then most blogs and I’m looking for something unique.

    P.S My apologies for being off-topic but I had to ask!

  2. Magnificent beat ! I wouyld like to apprentiuce while you amend your site, how could i subscribe for a weblog website?
    The account helped me a appropriate deal. I have been tiny bit acquainted of
    this your broadcast offered bright transparent idea

  3. whoah this blog is wonderful i love studying yolur articles.

    Keep up the good work! You recognize, many individuals are
    searching around for this information, you could aid them greatly.

  4. I like the valuable information you provide in your articles.

    I’ll bookmark your weblog and check again here frequently.
    I’m quite certain I’ll learn lots of new stuff right here! Best of
    luck for the next!

  5. I don’t leave a great deal off remarks, however I read a great deal of comments here Ubiquity Commands as HTML Pages – Responsee to Aza’s Proposal | Building Feedly.

    I do have 2 questions forr you if you tend not to mind. Could itt
    be just me or do a few oof the comments come across like they are left by brain dsad visitors?

    :-P And, if you are writing on additional social sites, I wuld like
    to keep up with you. Would you make a list of all of
    your shared sites like your Facebook page, twitter
    feed, or linkedin profile?

Comments are closed.