Created
January 19, 2017 03:47
-
-
Save Zaggen/ff37906d13b9ce48b5452bc051a136a5 to your computer and use it in GitHub Desktop.
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
declare const _: _.LoDashStatic | |
import {template} from '../helpers/index' | |
interface BackBoneComponent { | |
el?: string, | |
template?: string | Function, | |
events?: any, | |
subComponents?: any[], | |
[key: string]: any | |
} | |
// TODO: Modify type definitions to use Backbone.View instead of any | |
export function component(definition: BackBoneComponent) { | |
return function decorator(constructor: any) { | |
if(typeof definition.template === 'string'){ | |
definition.template = template(<string> definition.template) | |
} | |
_.extend((constructor as any).prototype, {subComponents: []}, definition) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment