MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Added getHeader function

    Scheduled Pinned Locked Moved Development
    1 Posts 1 Posters 1.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MichMichM Offline
      MichMich Admin
      last edited by paviro

      Per request, I’ve added a getHeader() method to the module api. This allows you to modify the header of the module from within the module itself.

      Note: that this method will only be called if the user has set a default header. If not no header will be shown and you won’t be able to update it.

      Note: if you module’s users run an old version of MagicMirror (a version without this change), this method will not be called. No errors should be thrown. So it’s safe to use …

      If you want to use the user’s set header in this method, just reference the this.data.header variable.

      Example code:

      getHeader: function() {
          return this.data.header + '  append string';
      }
      

      More info:

      • Documentation: https://github.com/MichMich/MagicMirror/tree/develop/modules#getheader
      • Commit: https://github.com/MichMich/MagicMirror/commit/b2a7d3584bad2752d59d2325c581f5018e875306

      Please let me know if this feature works for you …

      1 Reply Last reply Reply Quote 3
      • 1 / 1
      • First post
        Last post
      Enjoying MagicMirror? Please consider a donation!
      MagicMirror created by Michael Teeuw.
      Forum managed by Sam, technical setup by Karsten.
      This forum is using NodeBB as its core | Contributors
      Contact | Privacy Policy