first chunk of interfaces that are valid via dart analyzer

This commit is contained in:
Misko Hevery
2014-09-19 16:38:37 -07:00
committed by Tobias Bosch
parent 29c20f7a50
commit 8afa421d75
40 changed files with 462 additions and 9 deletions

View File

@ -0,0 +1,12 @@
/**
* This is a special facade used to bootstrap JS automatically.
* (In contrast to door wheere the user needs to explicitly call into angular.)
* This file is appened to AngularJS and needs to be written in ES5.
*/
(function(window, document) {
document.addEventListener('DOMContentLoaded', bootstrap, false);
function bootstrap() {
// TODO(misko): load application factory from the module system.
applicationFactory().run();
}
})(window, document);

View File

@ -0,0 +1,6 @@
name: facade
environment:
sdk: '>=1.4.0'
dependencies:
dev_dependencies:
unittest: '>=0.10.1 <0.12.0'

View File

@ -0,0 +1,20 @@
library facade.collection;
import 'dart:collection' show HashMap;
export 'dart:collection' show Map;
export 'dart:core' show List;
class MapWrapper {
static HashMap create() => new HashMap();
static get(m, k) => m[k];
static void set(m, k, v){ m[k] = v; }
static contains(m, k) => m.containsKey(k);
}
class ListWrapper {
static List clone(List l) => new List.from(l);
static List create() => new List();
static get(m, k) => m[k];
static void set(m, k, v) { m[k] = v; }
static contains(m, k) => m.containsKey(k);
}

View File

@ -0,0 +1,15 @@
export var List = window.Array;
export var Map = window.Map;
export class MapWrapper {
static create():HashMap { return new HashMap(); }
static get(m, k) { return m[k]; }
static set(m, k, v) { m[k] = v; }
static contains(m, k) { return m.containsKey(k); }
}
export class ListWrapper {
static create():List { return new List(); }
static get(m, k) { return m[k]; }
static set(m, k, v) { m[k] = v; }
}

View File

@ -0,0 +1,20 @@
library angular.core.facade.dom;
import 'dart:html';
export 'dart:html' show DocumentFragment, Node, Element, TemplateElement;
class DOM {
static query(selector) {
return document.query(selector);
}
static on(element, event, callback) {
element.addEventListener(event, callback);
}
static getInnerHTML(el) {
return el.innerHtml;
}
static setInnerHTML(el, value) {
el.innerHtml = value;
}
}

View File

@ -0,0 +1,19 @@
export var DocumentFragment = window.DocumentFragment;
export var Node = window.Node;
export var Element = window.HTMLElement;
export var TemplateElement = window.HTMLTemplateElement;
export class DOM {
static query(selector) {
return document.querySelector(selector);
}
static on(el, evt, listener) {
el.addEventListener(evt, listener, false);
}
static getInnerHTML(el) {
return el.innerHTML;
}
static setInnerHTML(el, value) {
el.innerHTML = value;
}
}

View File

@ -0,0 +1,4 @@
library angular.core.facade.async;
export 'dart:async' show Future;
export 'dart:core' show Type;

View File

@ -0,0 +1,2 @@
export var Future = Promise;
export var Type = Function;

13
modules/facade/test.dart Normal file
View File

@ -0,0 +1,13 @@
import 'dart:core' as core;
import 'dart:collection';
class Map {
new() => null;
ping() => core.print('map');
}
main() {
new Map().ping();
}