PHP Classes

File: test/test.js

Recommend this page to a friend!
  Classes of Nikos M.   Importer   test/test.js   Download  
File: test/test.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Importer
Load classes, images, CSS and JavaScript
Author: By
Last change: v.1.1.5

* fix js load(class) when fewer arguments are provided
* in browser script assets ensure execution order
* various edits
Date: 2 years ago
Size: 1,105 bytes
 

Contents

Class file image Download
var Importer = require( '../src/js/Importer.js' ), echo = console.log; echo('Importer.VERSION = ' + Importer.VERSION); echo('Importer.BASE = ' + Importer.BASE); var importer = Importer( __dirname, 'http://_mygit/Importer/test/' ) .register('classes', [ ['Test1', 'Test1', './classes/Test1.js'] ]/*global ctx*/) .register('classes', [ ['Test2', 'Test2', './classes/Test2.js', ['Test1']] ], 'my-ctx') .register('assets', [ ['styles', 'asset1', './assets/asset1.css'] ,['styles', 'asset2', './assets/asset2.css', ['asset1']] ]/*global ctx*/) .register('assets', [ ['styles', 'asset3', ['/* asset 3 */'], ['asset1','asset2']] ], 'my-ctx') .on('import-class-Test2', function( ){ echo('Callback'); echo(arguments); }, 'my-ctx') ; importer.load('Test2', function( Test2 ){ echo(Test2()); }, 'my-ctx'); importer.get('./classes/Test1.js', function( text ){ echo( text ); }); importer.enqueue('styles', 'asset3', 'my-ctx'); echo(importer.assets('styles', 'my-ctx'));