Catalog npm
Back to packageRELEASE DETAILS

0.1.5

npm

3m5-coco

a simple MVC Framework

3m5cocohandlebarsmvc
Published17 Sept 2015
Direct dependencies17
Transitive dependenciesNot calculated

README

Current package documentation

3m5-coco

a simple JavaScript MVC Framework developed by 3m5. Media GmbH npm version

What is 3m5-coco?

  • based on dejavu class model

  • use handlebars template engine

  • use jQuery for DOM-manipulation

  • use ES6 standard - transpiled by babel --> ES5 standard published to npm

  • compatible to browserify and webpack

installation

this framework is a npm module, use

npm install 3m5-coco

Sample application.js

This file will give you a taste of how to use Coco.JS

/**
 * @author (c) Andreas Wiedenfeld <andreas.wiedenfeld@3m5.de>
 * updated at 16.09.2015
 */
/** @namespace **/

var Coco = require("3m5-coco");

var TestCollection = require("./test/testCollection");
var TestView2 = require("./test/testView2");

var CocoApplication = dejavu.Class.declare({

    initialize() {
        console.log("CocoTestApp initialized, look at available Coco-Classes: ", Coco);
                
        Coco.Translator.addEventListener(Coco.TranslatorEvent.CHANGE_LOCALE, (event) => {
          console.info("locale changed " + event.locale);
        });
                    
        Coco.Translator.loadMessagesFromObject({
          title:  {
            1: "bla-de",
            2: "blub"
          },
          title2: "Hallo %0%"
        }, "de");
    
        Coco.Translator.loadMessagesFromObject({
          title:  {
            1: "bla-en",
            2: "blub-en"
          },
          title2: "Hallo %0%"
        }, "en");
    
        Coco.Translator.setLocale("de");
        console.log("i18n example (de): " + Coco.Translator.get("title.1"));
        console.log("i18n example with replacement: " + Coco.Translator.get("title2", ["Tom"]));
    
        //change locale
        Coco.Translator.setLocale("en");
        console.log("i18n example (en): " + Coco.Translator.get("title.1"));

        var innerModel = new Coco.Model({id:123, label:"innerModel", properts: "myInnerProperty"});
        var innerCollection = new TestCollection([{id:1, label:11}, {id:2, label:22}]);
        var testModel = new Coco.Model({id:12, label:"myLabel", property: innerModel, properties: innerCollection});

        innerCollection.add(innerModel);
        console.log(testModel.getAttributes());

        //initialize a simple router
        new Coco.Router('.routerView', {
            dashboard: {
                path: '/',
                view: require("./test/testView"),
                model: testModel
            },
            imprint: {
                path: '/testView2',
                view: TestView2
            }
        }, '/');
    }

});

$(document).ready(() => {
    new CocoApplication();
});

Coco.config = {
    baseUrl: "baseURL",              //server context path
    router: {
        loaderDelay: 300        // When views are swapped by Router, this time adjusts when the loading class
    },
    restService: {              //restService configuration
        path: null,             //restService path
        cacheGet: 600,          //cache time for GET Requests of same url in seconds
        cachePost: null         //cache time for GET Requests of same url in seconds
    }
};

Documentation

https://www.3m5.de/coco/

I hate the way you did

If something doesn't suit you, please submit a pull request that lets this framework be more flexible than it currently is.

License

Coco is under ISC-License

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 17

Native requirements
17 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
handlebars
Environment
{
  "local_name": "handlebars",
  "alias": false,
  "peer_metadata": null
}
^3.0.2runtime
babel
Environment
{
  "local_name": "babel",
  "alias": false,
  "peer_metadata": null
}
^5.6.2development
browserify
Environment
{
  "local_name": "browserify",
  "alias": false,
  "peer_metadata": null
}
^9.0.8development
domain
Environment
{
  "local_name": "domain",
  "alias": false,
  "peer_metadata": null
}
0.0.1development
es6ify
Environment
{
  "local_name": "es6ify",
  "alias": false,
  "peer_metadata": null
}
^1.6.0development
gulp
Environment
{
  "local_name": "gulp",
  "alias": false,
  "peer_metadata": null
}
^3.9.0development
gulp-babel
Environment
{
  "local_name": "gulp-babel",
  "alias": false,
  "peer_metadata": null
}
^5.2.1development
gulp-clean
Environment
{
  "local_name": "gulp-clean",
  "alias": false,
  "peer_metadata": null
}
^0.3.1development
gulp-concat
Environment
{
  "local_name": "gulp-concat",
  "alias": false,
  "peer_metadata": null
}
^2.5.2development
gulp-shell
Environment
{
  "local_name": "gulp-shell",
  "alias": false,
  "peer_metadata": null
}
^0.4.3development
gulp-streamify
Environment
{
  "local_name": "gulp-streamify",
  "alias": false,
  "peer_metadata": null
}
0.0.5development
gulp-tap
Environment
{
  "local_name": "gulp-tap",
  "alias": false,
  "peer_metadata": null
}
^0.1.3development
gulp-util
Environment
{
  "local_name": "gulp-util",
  "alias": false,
  "peer_metadata": null
}
^3.0.4development
gulp-webserver
Environment
{
  "local_name": "gulp-webserver",
  "alias": false,
  "peer_metadata": null
}
^0.9.1development
hbsfy
Environment
{
  "local_name": "hbsfy",
  "alias": false,
  "peer_metadata": null
}
^2.2.1development
mocha
Environment
{
  "local_name": "mocha",
  "alias": false,
  "peer_metadata": null
}
^2.2.5development
run-sequence
Environment
{
  "local_name": "run-sequence",
  "alias": false,
  "peer_metadata": null
}
^1.1.2development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "ecf156b38f380c712cf2600cd606fd7b136bebe4",
  "tarball": "https://registry.npmjs.org/3m5-coco/-/3m5-coco-0.1.5.tgz",
  "integrity": "sha512-wxe0Ft9otBpw2BornWL6FKhXQxLxjmG7hcIYfmxykinq2dbhjG9Furc+n5WDWVsexTKe94q7NbojpfmoLGC9dw==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIFBv1IOnEnrl5dp+nYV8BrKqw408//QnzZv9AeVLEUawAiEAruGqsp9XD0iVuzxKB2ea0tE0UVUWpIrqQFpdd6FYsCQ="
    }
  ]
}

Repository

PENDING
3m5/coco

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:48 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:e1ece9b8e57d76d9edb9481547395aa4f9ea533e2ad200021bda4f2bccf9efba

Other collected versions

0.3.016 May0.2.029 Jun0.1.8831 Mar0.1.875 Jan0.1.8623 Nov0.1.8522 JulView all collected versions →