mirror of
https://github.com/flarum/framework.git
synced 2025-01-23 04:49:46 +08:00
df385b7df2
<Alert foo="bar"/> instead of Alert.component({foo: 'bar'})
18 lines
372 B
JavaScript
18 lines
372 B
JavaScript
import Component from '../Component';
|
|
|
|
export default function patchMithril(global) {
|
|
const mo = global.m;
|
|
|
|
const m = function(comp, ...args) {
|
|
if (comp.prototype && comp.prototype instanceof Component) {
|
|
return comp.component(...args);
|
|
}
|
|
|
|
return mo.apply(this, arguments);
|
|
}
|
|
|
|
Object.keys(mo).forEach(key => m[key] = mo[key]);
|
|
|
|
global.m = m;
|
|
}
|