Add reopenWidget method

This commit is contained in:
James Kiesel 2017-01-17 00:39:23 +13:00
parent dfb633fde3
commit 513f570936
1 changed files with 11 additions and 0 deletions

View File

@ -125,6 +125,17 @@ export function createWidget(name, opts) {
return result;
}
export function reopenWidget(name, opts) {
let existing = _registry[name]
if (!existing) {
console.error(`Could not find widget ${name} in registry`);
return
}
Object.keys(opts).forEach(k => existing.prototype[k] = opts[k])
return existing
}
export default class Widget {
constructor(attrs, register, opts) {
opts = opts || {};