Skip to content

Commit

Permalink
Merge pull request #4 from damoebius/feature/all_promize
Browse files Browse the repository at this point in the history
Feature/all promize
  • Loading branch information
damoebius authored Oct 24, 2017
2 parents 8c143fd + b4857b1 commit 8534775
Show file tree
Hide file tree
Showing 17 changed files with 4,247 additions and 359 deletions.
89 changes: 72 additions & 17 deletions Main.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package ;

import js.html.Image;
import org.tamina.net.AssetCompositeLoader;
import org.tamina.net.AssetsSequenceLoader;
import org.tamina.net.AssetURL;
import org.tamina.html.component.HTMLComponentEvent.HTMLComponentEventType;
import org.tamina.html.component.HTMLComponent;
import test.html.view.TestComponent;
import js.Error;
import haxe.MimeType;
import haxe.HTTPMethod;
import js.Browser;
import org.tamina.utils.UID;
import org.tamina.utils.ObjectUtils;
Expand All @@ -24,35 +31,38 @@ import org.tamina.i18n.LocalizationManager;
import org.tamina.i18n.ITranslation;
import org.tamina.html.component.HTMLApplication;

import org.tamina.net.BaseRequest;


/**
* Tamina Haxe Library
*
* @module Tamina
* @main
*/

typedef MainEvent=Event<String>;
typedef MainEvent = Event<String>;

@:expose class Main extends HTMLApplication{
@:expose class Main extends HTMLApplication {

private static var _instance:Main;


public function new():Void {
public function new( ):Void {
super();
}

public static function init(translations:Array<ITranslation>):Void{
public static function init( translations:Array<ITranslation> ):Void {
LocalizationManager.instance.setTranslations(translations);
_instance.loadComponents();
}

public static function main():Void {
public static function main( ):Void {
_instance = new Main();
_instance.build();
}

public function build():Void{
public function build( ):Void {
BitmapData.getMimeType('');
ColorMatrix.BANDW_MATRIX.length;
new EventDispatcher<String>();
Expand All @@ -61,24 +71,69 @@ typedef MainEvent=Event<String>;
QuickLogger.debug("");
new XMLLoader();
new AssetLoader();
ClassUtils.expose(null,'');
ClassUtils.expose(null, '');
ColorUtils.invert('#FFFFFF');
DateUtils.toFrenchString(Date.now());
HTMLUtils.getElementById(Browser.document.body,'test');
NumberUtils.toFixed(0,0);
ObjectUtils.merge({},{});
HTMLUtils.getElementById(Browser.document.body, 'test');
NumberUtils.toFixed(0, 0);
ObjectUtils.merge({}, {});
UID.getUID();
var url = new URL("http://test.com");
var url = new URL("https://cdn.heidi.tech/partners/6/designs/1844052/249990b2-51f5-4d3a-89d6-5796ee87d402.png");
trace(url.scheme);
var l = new ImageLoader();
l.load(url);
HTMLApplication.createInstance(HTMLComponent);
/*var myComponent:TestComponent = HTMLComponent.createInstance(TestComponent);
l.load(url).then(function(image:Image){
Browser.document.body.appendChild(image);
}).catchError(function(error:Error){
trace(error.message);
});

var xmlLoader = new XMLLoader();
xmlLoader.load(new URL("https://raw.githubusercontent.com/bryanlittlefield/Magento-local.xml-Template/master/local.xml")).then(function(value){trace(value);}).catchError(function(value){trace(value);});

var assetLoader = new AssetLoader();
assetLoader.load(new AssetURL("toto.js")).then(function(value){trace(value);}).catchError(function(value){trace(value.message);});

var assetListLoader = new AssetsSequenceLoader();
assetListLoader.load([new AssetURL("https://code.jquery.com/jquery-3.2.1.slim.min.js"),new AssetURL("https://code.createjs.com/easeljs-0.8.2.min.js")]).then(function(value){trace(value);}).catchError(function(value){trace(value);});

var compositeLoader = new AssetCompositeLoader();

var myComponent:TestComponent = HTMLApplication.createInstance(TestComponent);
myComponent.addEventListener(HTMLComponentEventType.CREATION_COMPLETE, myComponent_creationCompleteHandler);
QL.info("log");*/
Browser.document.body.appendChild(myComponent);
L.warn("log");
var request = new GetAlbumsRequest();
request.setHeaders(new GetAlbumsRequestHeader("fr_FR", "F7CF4DD5-ECBF-4CD6-9E7D-29C513C17401"));
request.send().then(function( response:GetAlbumsRequestResponse ) {
trace(response.ResponseHeader);
}).catchError(function( error:Error ) {
trace(error.message);
});
}

private function myComponent_creationCompleteHandler(evt:js.html.Event):Void{
private function myComponent_creationCompleteHandler( evt:js.html.Event ):Void {
trace('hophophop');
}
}

class GetAlbumsRequest extends org.tamina.net.BaseRequest<GetAlbumsRequestHeader, GetAlbumsRequestResponse> {
public function new( ) {
super("http://api.heidi.tech/Api.svc/GetAlbums", HTTPMethod.POST, MimeType.JSON);
}


}

class GetAlbumsRequestHeader {
public var Locale:String;
public var Token:String;

public function new( locale:String, token:String ) {
Locale = locale;
Token = token;
}
}

class GetAlbumsRequestResponse {
public var ResponseHeader:Dynamic;
}
6 changes: 6 additions & 0 deletions build.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Autogenerated build.hxml

# org.tamina.net.BaseRequest (js:org.tamina.net.baserequest.js)
-main Main
-cp .
-js main.js
Loading

0 comments on commit 8534775

Please sign in to comment.