GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mindgruve/initr: A JavaScript dependency loader and initializer.

BranchesTags
Open more actions menu

Latest commit

 

History

22 Commits
22 Commits

Folders and files

NameName
Last commit message
Last commit date
dist
dist
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.jshintrc
.jshintrc
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE-MIT
LICENSE-MIT
 
 
README.md
README.md
 
 
package.json
package.json
 
 

Repository files navigation

Initr

What is it?

Initr is a query based javascript loader. Initr modules are loaded onto the page website based on the existence of the selectors.

How do I use it?

You need require.js to use Initr.

Installation

You can get it from http://github.com/mindgruve/initr. Put initr.js anywhere in your JavaScript source (for example, /vendor/initr.js), and include it with require('vendor/initr') or something similar

Configure

Create a requirejs module that returns an initr config object. Initr configs look like this:

//initr/config.js
define({
    //Initr loops through this array. If the selector has matches on the current page, then src is loaded by Initr
    modules: [
        // MODULE: Form UI
        {
            name: 'form-ui',
            selector: 'form',
            src: ['initr/form-ui']
        }
	]
});

An initr module has to be built a certain way. See below for an example.

//initr/form-ui.js
define(['vendor/initr/module', 'jquery'], function (Module, $) {
	function FormUi(config, $els, initr) {
        Module.apply(this, [config, $els, initr]);
        this.init();
    }
	FormUi.prototype = new Module();
    FormUi.prototype.constructor = FormUi;
	FormUi.prototype.init = function () {
		//Initialize your custom logic
	};
	return FormUi;
});

Once you have an initr module and a config you can create an initr instance and use them.

//main.js
require(['vendor/initr', 'initr/config'], function (Initr, config) {
	var initr = new Initr();
	initr.load(config.modules);
});

Done!


Some day we will have better documentation. For now. Nope.

About

A JavaScript dependency loader and initializer.

Resources

Readme
MIT license
Activity
Custom properties

Stars

0 stars

Watchers

3 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.