Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
core npm packgage for Alpha Simprin applicaitons
CoffeeScript JavaScript Ruby
tree: 7fa015463c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples/todo
lib
test
.gitignore
Readme.md
autotest.watchr
package.json

Readme.md

Alpha Simprini incorporates Pathology and Taxi.

Alpha Simprini

PUBLIC DOMAIN LICENSE ( IT'S IN THE PUBLIC DOMAIN )

From Lower Earth Orbit, it's Alpha Simprini

Alpha Simprini is a browser application framework. It is a terrible awful mish-mash of ideas from Backbone and SproutCore/Ember.js

Modular (or something)

Alpha Simprini uses Pathology and Taxi to power the underlying Object model and event/databinding systems.

Also present are jwerty, jQuery, underscore, ShareJS, rangy and fleck

Tests are written in nodeunit.

Views

No Templating Language

Alpha Simprini doesn't use a templating language. Your DOM is generated by code. The opinion behind this is that a templating language (even so-called 'logicless' templates) really want to be Classes with methods deep within their hearts. Except they don't end up doing a very good job of approximating the experience.

( You could certainly build a templating language on top of the Alpha Simprini dom generation and data-binding api. But why? )

Declarative Data Binding

Declare your data as it will live in the DOM. Ordered list? Selection models? Relationships? Simple fields?

MyApp.ThingyView = AS.View.extend
  content: ->
    @h1 "This is the thingy view!"
    @p "This thing is ", @thingy.description, "."
    @ul ->
      @bind @thingy.children, (child) ->
        @li -> @bind(child.name).attr

When the data changes, the DOM will be updated to reflect those changes automatically. All event handlers are cleaned up as objects are removed too.

Models

Domain Modeling

Model your domain with fields, and relationships: hasMany, hasOne, belongsTo.

CookBook.Recipe = AS.Model.extend()
CookBook.Recipe.field "minutesToPrepare", type: Number
CookBook.Recipe.field "veggeratian", type: Boolean
CookBook.Recipe.field "title"

CookBook.Ingredient = AS.Model.extend()
CookBook.Ingredient.field "name"
CookBook.Ingredient.field "quantity", type: Number
CookBook.Ingredient.belongsTo "recipe"

CookBook.Recipe.hasMany "ingredients", 
  model: -> MyApp.Ingredient
  inverse: "recipe"

Real Time Collaboration

Alpha Simprini ships with support for real-time collaboration with ShareJS

1) Configure the connection between Alpha Simprini and ShareJS

# The default ShareJsURL looks like this:
AS.ShareJsURL = "http://#{window?.location.host or 'localhost'}/sjs"
# Set it as neccessary for your server configuration.

2) Mixin ShareJS support

Editor.Document = AS.Model.extend()
AS.Model.Share.extend(Editor.Document)

3) Load your document by ID

document = Editor.Document.open("documentid")

At this point you can use the model as usual. You don't have to wait for the object to properly connect to the ShareJS server. Any chanegs you make to the object will be properly applied when the connection is made.

Application

In your application initialize function construct your models and views.

Todo = AS.Namespace.new("Todo")
Todo.Application = AS.Application.extend
  initialize: ->
    @list = Todo.Models.List.open(@params.list_id)
    @list_view = @view Todo.Views.List, list: @list
    @append @list_view

Now you're off to the races

Serving Assets/Packages

This is mostly terrible and will be replaced with a bpm based solution

AlphaSimprini currently uses module_loader to server node modules and provide an implementation of 'require' in the browser.

module_loader requires a node server and can be set-up like this:

pathname = require("path")
ModuleLoader = require("../lib/module_loader")

# see https://github.com/collin/module_loader for complete
# configuration options (including specifying your own http server)
new ModuleLoader 
  module_root: pathname.resolve("./node_modules")
  packages: ["underscore", "underscore.string", "project"]

To include your project, you must specify a package.json and install that package. If your project was called 'project' you could use npm like so in development.

npm link project && npm link

Then in your application:

<script src="//localhost:2334/node_modules.js"></script>
<script> 
  require("project").boot()
</script>
Something went wrong with that request. Please try again.