mirror of
https://github.com/discourse/discourse.git
synced 2025-05-16 22:53:19 +08:00
Add reopenWidget method
This commit is contained in:
parent
dfb633fde3
commit
513f570936
@ -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 || {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user