@wildebeest/component
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -15,3 +15,2 @@ import { ComponentBinder } from "./ComponentBinder"; | ||
autoBind(element: HTMLElement): Map<string, Array<Component>>; | ||
bindToElement(element: any, component: Component): void; | ||
} |
@@ -30,8 +30,2 @@ "use strict"; | ||
}; | ||
ComponentBindService.prototype.bindToElement = function (element, component) { | ||
if (!element.wbComponents) { | ||
element.wbComponents = []; | ||
} | ||
element.wbComponents.push(component); | ||
}; | ||
ComponentBindService = __decorate([ | ||
@@ -38,0 +32,0 @@ inversify_1.injectable() |
@@ -5,2 +5,3 @@ "use strict"; | ||
var common_1 = require("@wildebeest/common"); | ||
var ElementService_1 = require("./ElementService"); | ||
var ComponentModule = (function () { | ||
@@ -24,2 +25,3 @@ function ComponentModule() { | ||
container.bind(ComponentBindService_1.ComponentBindService).toSelf().inSingletonScope(); | ||
container.bind(ElementService_1.ElementService).toSelf().inSingletonScope(); | ||
}; | ||
@@ -26,0 +28,0 @@ ComponentModule.prototype.boot = function (container) { }; |
@@ -6,1 +6,2 @@ export { ComponentModule } from './ComponentModule'; | ||
export { ComponentBindService } from './ComponentBindService'; | ||
export { ElementService } from './ElementService'; |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.ComponentBindService = ComponentBindService_1.ComponentBindService; | ||
var ElementService_1 = require("./ElementService"); | ||
exports.ElementService = ElementService_1.ElementService; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@wildebeest/component", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Components", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -29,10 +29,2 @@ import { injectable } from "inversify"; | ||
} | ||
public bindToElement(element: any, component: Component): void | ||
{ | ||
if (!element.wbComponents) { | ||
element.wbComponents = []; | ||
} | ||
element.wbComponents.push(component); | ||
} | ||
} |
@@ -7,2 +7,3 @@ import { Module } from "@wildebeest/js-modules"; | ||
import { CommonModule } from "@wildebeest/common"; | ||
import { ElementService } from "./ElementService"; | ||
@@ -29,2 +30,3 @@ export class ComponentModule implements Module | ||
container.bind<ComponentBindService>(ComponentBindService).toSelf().inSingletonScope(); | ||
container.bind<ElementService>(ElementService).toSelf().inSingletonScope(); | ||
} | ||
@@ -31,0 +33,0 @@ |
@@ -5,2 +5,3 @@ export { ComponentModule } from './ComponentModule'; | ||
export { ComponentBinder } from './ComponentBinder'; | ||
export { ComponentBindService } from './ComponentBindService'; | ||
export { ComponentBindService } from './ComponentBindService'; | ||
export { ElementService } from './ElementService'; |
@@ -65,16 +65,2 @@ import 'ts-jest'; | ||
expect(components.get('test').length).toEqual(1); | ||
}); | ||
test("binding HTML element to component", () => { | ||
componentBindService.addBinder('test', { | ||
selector: '.test', | ||
binder: new TestComponentBinder(emitterService) | ||
}); | ||
let element: any = domService.create('<div class="test"></div>'); | ||
let component: Component = new TestComponent(element, emitterService.createEmitter()); | ||
bindService.bindToElement(element, component); | ||
expect(element.wbComponents).toBeDefined(); | ||
expect(element.wbComponents.length).toEqual(1); | ||
}); |
@@ -5,2 +5,3 @@ import 'ts-jest'; | ||
import { ComponentBindService } from '../src/ComponentBindService'; | ||
import { ElementService } from '../src/ElementService'; | ||
@@ -14,2 +15,3 @@ let app: Application = new Application(); | ||
expect(app.getContainer().get(ComponentBindService)).toBeInstanceOf(ComponentBindService); | ||
expect(app.getContainer().get(ElementService)).toBeInstanceOf(ElementService); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22264
36
397