Giter Club home page Giter Club logo

depender.js's Introduction

depender.js

Tiny simplified load-order resolver for JS.

Helps you to divide coffee-script sources before --join into separate parts and runs them in valid order.

  • No dependency resolving.
  • No automatic-script-tag-creation.
  • No XHR.
  • Not a package manager.

Api

namespace("string-dot-separated-path") - requests or creates namespace for given path. Namespace parts are simply objects.

define(["string-dot-separated-path", "string-dot-separated-path", ...], callback-function) - run callback when all paths can be resolved.

Usage in coffescript

m1.coffee

define [
	"mypackage.module_2.A"
], ->
	console.log("run it as #2")

	module_2 = namespace "mypackage.module_2"
	root = namespace "mypackage.module_1"

	class root.B extends module_2.A

m2.coffee

define [
	"mypackage.module_1.B"
], ->
	console.log("run it as #3")		

	module_1 = namespace "mypackage.module_1"
	root = namespace "mypackage.module_2"

	class root.C extends module_1.B

define [
	# actually this will be executed immediately. 
	# I've put this empty define just to fit global convention
], ->
	console.log("run it as #1")

	root = namespace "mypackage.module_2"
	class root.A

result

window:
	mypackage:
		module_1:
			B extends A
		module_2:
			A
			C extends B

depender.js's People

Contributors

evgenus avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.