This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable } from "data/observable"; | |
export abstract class ObservableBase extends Observable { | |
constructor() { super(); } | |
public getPropertyName<PropertyName extends keyof this>(propertyName: PropertyName) { return propertyName; } | |
} | |
export function getProperty<T extends Observable, PropertyName extends keyof T>(observable: T, propertyName: PropertyName) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Crypto from "crypto-js"; | |
function tryExecute<T>(func: () => T, error: string) { | |
try { return func(); } catch { throw error; } | |
} | |
export function encrypt(key: string, plainText: string): string { | |
if (!key) { throw "key is required (encrypt)"; } | |
if (!plainText) { throw "plainText is required (encrypt)"; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const path = require('path'); | |
const Webpack = require('webpack'); | |
const { AureliaPlugin } = require('aurelia-webpack-plugin'); | |
const resolve = filePath => path.resolve(__dirname, filePath); | |
module.exports = { | |
entry: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'toastr/build/toastr.css'; | |
import * as toastr from 'toastr'; | |
toastr.options = { | |
closeButton: false, | |
debug: false, | |
newestOnTop: false, | |
progressBar: false, | |
positionClass: 'toast-bottom-full-width', | |
preventDuplicates: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class EventDispatcher { | |
public static dispatch(element: Element, eventName: string, args?: any): boolean { | |
let customEvent: CustomEvent; | |
if ((window as any).CustomEvent) { | |
customEvent = new CustomEvent(eventName, { | |
detail: { args: args }, | |
bubbles: true | |
}); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Threading.Tasks; | |
namespace MyNameSpace | |
{ | |
public sealed class NotifiableTask<TResult> : INotifyPropertyChanged | |
{ | |
public NotifiableTask(Task<TResult> task) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { autoinject, customAttribute } from 'aurelia-framework'; | |
@autoinject() | |
@customAttribute('dp-toggle-drawer') | |
export class ToggleDrawerCustomAttribute { | |
private element: Element; | |
constructor(element: Element) { | |
this.element = element; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { autoinject, customAttribute } from 'aurelia-framework'; | |
const MdlControls = { | |
'button': { type: 'MaterialButton', classes: ['mdl-button', 'mdl-js-button'], rippleEffectSupport: true }, | |
'textfield': { type: 'MaterialTextfield', classes: ['mdl-textfield', 'mdl-js-textfield'], rippleEffectSupport: false }, | |
'layout': { type: 'MaterialLayout', classes: ['mdl-layout', 'mdl-js-layout'], rippleEffectSupport: false }, | |
'menu': { type: 'MaterialMenu', classes: ['mdl-menu', 'mdl-js-menu'], rippleEffectSupport: true }, | |
'data-table': { type: 'MaterialDataTable', classes: ['mdl-data-table', 'mdl-js-data-table'], rippleEffectSupport: true }, | |
'tabs': { type: 'MaterialTabs', classes: ['mdl-tabs', 'mdl-js-tabs'], rippleEffectSupport: true }, | |
'slider': { type: 'MaterialSlider', classes: ['mdl-slider', 'mdl-js-slider'], rippleEffectSupport: false }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DelegateCommand<T> : ICommand | |
{ | |
private readonly Predicate<T> _canExecute; | |
private readonly Action<T> _execute; | |
public DelegateCommand(Action<T> execute) : this(execute, x => true) | |
{ } | |
public DelegateCommand(Action<T> execute, Predicate<T> canExecute) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel; | |
namespace ViewModels | |
{ | |
public interface IObservableObject : INotifyPropertyChanged | |
{ | |
void RaisePropertyChanged(string propertyName); | |
} | |
public class ObservableObject : IObservableObject |
OlderNewer