Skip to content
/ MiniMe Public

MiniMe was born out of a necessity to keep my jquery code more organised.

Notifications You must be signed in to change notification settings

AliceIW/MiniMe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

MiniMe Js

MiniMe was born out of a necessity to keep my jquery code more organised.

Configuration

The configurations are always executed first, you can put the events here that are not bound to a specific controller. (I strongly suggest using a proper controller, but if you have to work with lots of legacy code)

Definition

app.configuration(function(){
    //Code that needs to be executed when you initialise MiniMe
});

Controllers

Controllers should always be as slim as possible, only the logic should be defined here.

Definition

app.controller('MyNewController',function(constructParams){
    //Your Controller Function
});

Reserved Functions

AddEvent This will add a new event and bind it to the controller scope.

this.addEvent(element,event,function(){
    
});

Using controllers in the frontend

<div class="some-div" data-controller="myController" data-controller-params="{\"json\":true}">

</div>

data-controller |String| Which controller will manage all the events inside the div. data-controller-params |Json| Optional. Additional parameters that can be passed to the controller

Services

I love services, all the servicey stuff and the heavy stuff should be put in here.

Definition

app.service('MyNewService',function(){
      return function (constructParam1,constructParam2) {
            this.log = function (logExample) {
                console.log(logExample);
            }
        };
},Resolve);

Or

app.service('MyNewService',function(){
      return {
            log:function(){
               console.log(logExample);
            }
         ;}
});

Resolve: |Boolean| by default set to true it will tell MiniMe if you want to execute the return function on initialisation.

Retrieving a service

app.get()

    app.get(ServiceName,args...)

Initialising Minime

Just call at the end, after all the definitions

    app.run(debug)

Debug |Boolean| If you need to debug MiniMe.

Built-in Services

Debug Service

It's a wrapper class for the console command. Use the Brackets to highlight the text inside (it will become bold and blue).

    app.get('Debug').log("This is my {Text}",{a:1,b:2});

Todo

  • Add TemplateHelper
  • Write Better Docs
  • Write Better Example

About

MiniMe was born out of a necessity to keep my jquery code more organised.

Resources

Stars

Watchers

Forks

Packages

No packages published