mirror of
https://github.com/bitwarden/browser
synced 2026-01-04 09:33:27 +00:00
Setup Webpack & TypeScript (#316)
* TypeScript and WebPack. * Minor cleanup. * Add background.js as entry point to webpack. * Use downloaded fonts for better performance. Remove google-fonts-webpack-plugin. * Add the remaining entry points and setup notification bar. * Update readme for webpack. * Convert CipherItems to TypeScript to demonstrate how a component looks in TS. * Fix edge requirering a custom angular version. * Rewrite gulp tasks for packaging releases. * Re-add the webpack gulp plugin. * Remove unessesary line in analytics.
This commit is contained in:
committed by
Kyle Spearrin
parent
e57f3fe5f0
commit
59754cd530
30
src/popup/app/components/cipher-items.component.ts
Normal file
30
src/popup/app/components/cipher-items.component.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as template from './cipher-items.component.html';
|
||||
|
||||
class CipherItemsController implements ng.IController {
|
||||
onSelected: Function;
|
||||
onView: Function;
|
||||
|
||||
constructor(private i18nService: any) {
|
||||
|
||||
}
|
||||
|
||||
public view(cipher: any) {
|
||||
return this.onView()(cipher);
|
||||
}
|
||||
|
||||
public select(cipher: any) {
|
||||
return this.onSelected()(cipher);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const CipherItemsComponent = {
|
||||
bindings: {
|
||||
ciphers: '<',
|
||||
selectionTitle: '<',
|
||||
onView: '&',
|
||||
onSelected: '&'
|
||||
},
|
||||
template: template,
|
||||
controller: CipherItemsController
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
angular
|
||||
.module('bit.components')
|
||||
|
||||
.component('cipherItems', {
|
||||
bindings: {
|
||||
ciphers: '<',
|
||||
selectionTitle: '<',
|
||||
onView: '&',
|
||||
onSelected: '&'
|
||||
},
|
||||
templateUrl: 'app/components/views/cipherItems.html',
|
||||
controller: function (i18nService) {
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.$onInit = function () {
|
||||
ctrl.i18n = i18nService;
|
||||
|
||||
ctrl.view = function (cipher) {
|
||||
ctrl.onView()(cipher);
|
||||
};
|
||||
|
||||
ctrl.select = function (cipher) {
|
||||
ctrl.onSelected()(cipher);
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
7
src/popup/app/components/components.module.ts
Normal file
7
src/popup/app/components/components.module.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as angular from 'angular';
|
||||
import { CipherItemsComponent } from './cipher-items.component';
|
||||
|
||||
export default angular
|
||||
.module('bit.components', [])
|
||||
.component('cipherItems', CipherItemsComponent)
|
||||
.name;
|
||||
Reference in New Issue
Block a user