Catalog npm
PACKAGE EXPLORERView in registry

3m5-coco

npm

a simple MVC Framework

3m5cocohandlebarsmvc
Versions collected64
Direct dependencies21From release 0.3.0
Last observed20 Oct, 19:48 UTC

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.

Versions 64

Collected releases
VersionPublishedDirect dependenciesOpen version
0.3.0Registry latest16 May 201921
0.2.029 Jun 201724
0.1.8831 Mar 201724
0.1.875 Jan 201724
0.1.8623 Nov 201624
0.1.8522 Jul 201624
0.1.8414 Jul 201624
0.1.8329 Jun 201624
0.1.8229 Jun 201624
0.1.8128 Jun 201620
0.1.809 Jun 201620
0.1.799 Jun 201620
0.1.788 Jun 201620
0.1.778 Jun 201620
0.1.7621 Mar 201621
0.1.7517 Mar 201621
0.1.742 Mar 201621
0.1.7312 Feb 201620
0.1.723 Dec 201520
0.1.715 Nov 201520

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

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