Skip to content

Instantly share code, notes, and snippets.

@kixxauth
Created May 6, 2011 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kixxauth/959469 to your computer and use it in GitHub Desktop.
Save kixxauth/959469 to your computer and use it in GitHub Desktop.
Data structure for Royal Node
/**
* DAG node
* --------
*/
var tabbar =
[
{ name: "tabname",
title: "Title",
thumbnail: "Icon",
resource_type: "list, movie, image, ...",
// ... custom properties ...
getResource: function() { /* return a sub resource if there is one */ },
},
// ...
]
@kixxauth
Copy link
Author

kixxauth commented May 6, 2011

So yeah, this is looking more and more like a DAG. I really like the idea of using functions to recurse down into the tree.

I think we should take the directed graph idea a step further and just have one datatype. The only property an instance of this datatype MUST have is the resource_type property, and the only method it MUST have is the getResource() method. Everything else is optional meta data, and the template engine can be built to intelligently know what to do based on the resource_type property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment