Catalog npm
Back to packageRELEASE DETAILS

0.0.93

npm

3m5-coco

a simple MVC Framework

cocohandlebarsmvc3m5
Published19 Jun 2015
Direct dependencies11
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 11

Native requirements
11 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
browserify
Environment
{
  "local_name": "browserify",
  "alias": false,
  "peer_metadata": null
}
^9.0.8runtime
domain
Environment
{
  "local_name": "domain",
  "alias": false,
  "peer_metadata": null
}
0.0.1runtime
es6ify
Environment
{
  "local_name": "es6ify",
  "alias": false,
  "peer_metadata": null
}
^1.6.0runtime
gulp
Environment
{
  "local_name": "gulp",
  "alias": false,
  "peer_metadata": null
}
^3.8.11runtime
gulp-clean
Environment
{
  "local_name": "gulp-clean",
  "alias": false,
  "peer_metadata": null
}
^0.3.1runtime
gulp-concat
Environment
{
  "local_name": "gulp-concat",
  "alias": false,
  "peer_metadata": null
}
^2.5.2runtime
gulp-streamify
Environment
{
  "local_name": "gulp-streamify",
  "alias": false,
  "peer_metadata": null
}
0.0.5runtime
gulp-tap
Environment
{
  "local_name": "gulp-tap",
  "alias": false,
  "peer_metadata": null
}
^0.1.3runtime
gulp-util
Environment
{
  "local_name": "gulp-util",
  "alias": false,
  "peer_metadata": null
}
^3.0.4runtime
handlebars
Environment
{
  "local_name": "handlebars",
  "alias": false,
  "peer_metadata": null
}
^3.0.2runtime
hbsfy
Environment
{
  "local_name": "hbsfy",
  "alias": false,
  "peer_metadata": null
}
^2.2.1runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "785d231751d3570570203288871f97abe3b61b69",
  "tarball": "https://registry.npmjs.org/3m5-coco/-/3m5-coco-0.0.93.tgz",
  "integrity": "sha512-hUpU/Os0YyPwrHY1OKucYKtNM1MydlkmZ6ms6jtITQl8mTPuDVUb6ENrd8hk++PfMV3udMHHhzO+xSlmLxtesQ==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQCaUWBMC0NED+/Pe1nFzp5ZKHYShFOQ7MW1CUFNRLobIwIhANnz/hKrfKjYFje8tvYoOyD6QAkuX9lAYGgurA1Krqms"
    }
  ]
}

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:df2466933db8da8a101f525fe0ed74cda90bd3b8ee2a7b767ed56f4ff884bfaa

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 →