mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-19 14:04:28 +00:00
fix: ResourceConsumer cant observer data change
This commit is contained in:
parent
2d5b1becc7
commit
251b5c496e
@ -1,4 +1,4 @@
|
|||||||
import { autorun, obx } from '@ali/lowcode-editor-core';
|
import { autorun, makeObservable, obx } from '@ali/lowcode-editor-core';
|
||||||
import { BuiltinSimulatorHost } from './host';
|
import { BuiltinSimulatorHost } from './host';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer';
|
import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer';
|
||||||
@ -29,6 +29,7 @@ export default class ResourceConsumer<T = any> {
|
|||||||
private _consuming?: () => void;
|
private _consuming?: () => void;
|
||||||
|
|
||||||
constructor(provider: () => T, private consumer?: RendererConsumer<T>) {
|
constructor(provider: () => T, private consumer?: RendererConsumer<T>) {
|
||||||
|
makeObservable(this);
|
||||||
this._providing = autorun(() => {
|
this._providing = autorun(() => {
|
||||||
this._data = provider();
|
this._data = provider();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user