Skip to content

1.0.0-beta.91

Latest
Compare
Choose a tag to compare
@lahmatiy lahmatiy released this 25 Nov 02:59
  • Changes related to Model#context:
    • Added context to Model options, allowing the model's context to be set and accessible from the beginning (available during setup and in extensions)
    • Added Model#setContext(context, replace) method, which extends the current context with the provided value or replaces it if replace is true
    • Added context event to Model, with prevContext and nextContext parameters, triggered when the context changes
    • Changed Model#context to be an accessor property, where the setter calls Model#setContext(value, true)
    • 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
  • Updated struct view to define the setStructViewAnnotations action when using the new setup() method, allowing custom annotations to be specified across all struct views
  • Updated embed option of App to accept a config
  • Added EmbedApp#publicApi.notify(name, details) method for sending notifications
  • Introduced onNotify(name, details) option in the embed extension to define a callback for handling notification messages from the embed host
  • Added 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
  • Changed ViewModel initialization to minimize unnecessary renders
  • Marked ViewModel#renderPage(), ViewModel#renderSidebar(), and ViewModel#renderPage() as private methods, as they are not intended for direct invocation anymore
  • Fixed ViewModel#setPageParams() to normalize the hash by ensuring it starts with #, preventing unnecessary events; for example, passing #page and page into the method will now consistently result in #page being stored in ViewModel#pageHash
  • Redesigned logging API, the changes allow to see the correct loaction of logging method call instead of a location inside of the Model#log() method:
    • Added Logger class to utils
    • Changed Model#logger to hold a Logger instance
    • Removed Model#logLevel, use Model#logger.logLevel for getting or setting the log level
    • Deprecated Model#log() method, which do nothing but display an error:
      • Use Model#logger[level](...args) instead of Model#log('level', ...args)
      • Use Model#logger[level].group(message, fn | array) or Model#logger[level].groupCollapsed(message, fn | array) instead of Model#logger({ level, message, collapsed: fn | array })