GithubHelp home page GithubHelp logo

gelatin.js's Introduction

Gelatin.js

Gelatin.js is a framework built ontop of mootools to help you create web apps.

Gelatin is heavily inspired by other frameworks such as Backbone.js, SprouteCore and Ember.js

Some of the features in Gelatin:

  • getters and setters
  • Observerable properties
  • Bindings
  • Computed properties
  • Models
  • Data store
  • Data transport methods ie REST

Getters and setters

Gelatin has two functions that you should always use when interacting with properties, Gelatin.get & Gelatin.set. They do what you would expect and return and set properties on objects:

// Return the person objects name
Gelatin.get(person, 'name');

// Set the person objects name
Gelatin.set(person, 'name', 'Mark');

The reason for this is that Gelatin uses observers and bindings to keep your application in sync. So using set allows Gelatin to know which property you are setting and if it needs to alert any observers of the change. The get method enabled Gelatin to call computed properties correctly.

Observerable properties

You can observer any property for changes in its value by using observers:

var person = {
	name: 'Mark'
};

Gelatin.addObserver(person, 'name', function (key, newValue, oldValue) {
	// Your observer code...
});

Observers will only trigger when the new value differs from the previous.

You can also observer the entire object for any property changes by using the * property name:

Gelatin.addObserver(person, '*', function () {});

Models

Gelatin.js includes a model class for defining your data structures.

Building Gealtin

Gelatin uses node with the amazing grunt.js (https://github.com/cowboy/grunt) to build the project.

So just install grunt.js from NPM:

npm install grunt -g

And then from the root of the project directory:

grunt build

This will create a versioned file in the dist folder as well as a minified version.

gelatin.js's People

Stargazers

Mark Gerrard avatar

Watchers

Mark Gerrard avatar James Cloos avatar Rob Chandler avatar

gelatin.js's Issues

Store and Model

Store

The store needs to have the following:

  • createRecord
  • deleteRecord
  • updateRecord

It needs to call into an adapter that will have a api for working with models and telling the store that they have updated.

Model

  • Update attributes
  • Event hooks for postSave preSave etc

Router

Create a router class that can define routes:

var userRoute = function (params) {
  // Setup our route stuff here params should have a property id
};

var routes = {
  '/users/:id': userRoute,
  '/projects': {
    on: projectsRoute,
    ':id': projectRoute
  }
};

new Gelatin.Router(routes);

The router should fire events when routes have matched.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.