npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

modeljs

v2.1.2

Published

A simple javaScript library for creating a Model part of a MVC application from JSON.

Downloads

4

Readme

modeljs

A simple javaScript library for creating a Model part of a MVC application from JSON.

Features

  • Simple easy to use and intuitive library.
  • No dependencies.
  • Can save/load Model to/from JSON with/without model meta data.
  • Can attach custom meta-data to properties that can be persisted with model.
  • Supports models defined by a remote resource with the ability to periodically refresh.
  • remote model has option to use JSONP in the event of CORS issues.
  • Can register on change events with any single property or group of properties.
  • Model change events bubble up.
  • Can define and trigger custom events.
  • Can suppress change event notification.
  • Can batch actions into a transaction.
  • Transaction callbacks can be easily optimized.
  • Can tie validation methods to models and properties.
  • Can flag any property value to not be persisted to JSON.
  • Can retrieve FormattedValues using a custom defined Formatter.
  • Can enable logging to flag incorrect uses of api to the console.
  • Native browser Support for all browsers that support ECMA5 including and tested on IE9, Firefox 4+, Safari 5.1.4+, Chrome 7+, Opera 12+ without a shim library.
  • Works on non-ECMA5 browser with use of a shim library. Specifically tested on IE8 with es5-shim.
  • Compatible with the CommonJS module format and is usable as a Node module.
  • Compatible with AMD module loaders like requirejs.

Browser Support

modeljs works on all browsers that support ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf). It has been manually tested on IE9, Firefox 14+, Safari 5.1.4 and Chrome 21+. To see if it work on a specify browser version of your choice, run the unit tests(test/ModelTest.html). To support older non ECMA5 browsers using a shim library like es5-shim. Modeljs has been successfully tested on IE8 with the es5-shim library.

Getting Started

Clone the repo, git clone git://github.com/dgeorges/modeljs.git, or download the latest release

To use modeljs in your application copy src/model.js to an appropriate location and include it in your HTML like so:

<script type="text/javascript" src="/path/to/model.js"></script>

If your doing server side development in Node, you can import it like so:

var Model = require("/path/to/model.js");

Or using npm install

npm install modeljs
var Model = require("modeljs");

Examples

A couple of example pages have been created to show how to use modeljs. They can be found in the /test/example folder

  • New sandbox enviornment on jsFiddle here.
  • tableWidget.js Shows how a table widget can be created with model js.
  • example.html Shows how to integrate the table widget on your page and is followed by a tutorial of the modeljs api.
  • knockoutExample.html Shows how easy it is to build a binding library on top of modeljs that behaves like the popular knockoutjs library. The example is almost identical to the knockoutjs introduction example.

Documentation

Documentation is generated by YUIdoc and can be viewed by cloning the repo or downloading the source and viewing doc/index.html. For more information visit modeljs's wiki

###Project Status: Stable - v2.0.0 Released (Oct 27 2012).