Skip to content

Commit

Permalink
Add Model#legacyPrepare
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Nov 25, 2024
1 parent 019d8b8 commit f0e87d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Changed `ViewModel#setData()` to no longer accept a `context` argument or change the context
- Changed `ViewModel#setDataProgress()` to no longer change the context, despite accepting `context` argument
- Updated `ViewModel` to trigger a render when the `context` event is fired
- Added `Model#legacyPrepare` readonly property to indicate whether the legacy `prepare` method is used or the new `setup()` method
- Added the `EmbedApp#publicApi.setLocationSync()` method to simplify sync between the embed app and the host location, preventing potential pitfalls
- Added `ViewModel#enforceScheduledRenders()` to immediately execute scheduled renders
- Changed `ViewModel#scheduleRender()` to use `setTimeout()` instead of `Promise.resolve()` to ensure proper processing of event loop tasks, eliminating unnecessary renders
Expand Down
3 changes: 3 additions & 0 deletions src/main/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ export class Model<
// Data & context
//

get legacyPrepare() {
return this.#legacyPrepare;
}
setPrepare(fn: PrepareFunction) {
if (typeof fn !== 'function') {
throw new Error('An argument should be a function');
Expand Down

0 comments on commit f0e87d9

Please sign in to comment.