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.

    SocketNotification not working?

    Scheduled Pinned Locked Moved Development
    5 Posts 3 Posters 456 Views 3 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.
    • T Offline
      tjat
      last edited by

      This post is deleted!
      S M 3 Replies Last reply Reply Quote 0
      • S Away
        sdetweil @tjat
        last edited by

        @tjat said in SocketNotification not working?:

        this.sendSocketNotification

        what does the ‘this’ point to ? to module helper instance or something else?

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          tjat @sdetweil
          last edited by

          @sdetweil - It’s within the main module we’re I’m creating the calendar event. I’m following the same syntax being used above, which is working. I’ll also caveat that I’m not really experienced with this stuff so likely am doing something dumb. Am I losing the “this” reference somehow? Appreciate the help

          
                this.sendSocketNotification("ADD_CALENDAR_EVENT", payload);
                this.message = "Adding event...";
                this.messageType = "info";
                this.updateDom();
                this.closeForm();
            },
          
            notificationReceived: function(notification, payload, sender) {
                // TODO: Handle notifications
            },
          
            socketNotificationReceived: function(notification, payload) {
            if (notification === "EVENT_ADD_SUCCESS_MAIN") {
              console.log ("Sending event to calendar");
              this.showMessage('Event added!', 'success');
              if (payload) {
                this.sendNotification("EVENT_ADD_SUCCESS", payload);
              } else {
                this.sendNotification("EVENT_ADD_SUCCESS");
              }
            } else if (notification === 'EVENT_ADD_FAILED') {
              this.showMessage('Event not added', 'error');
              if (payload) {
                this.sendNotification("EVENT_ADD_FAILED", payload);
              } else {
                this.sendNotification("EVENT_ADD_FAILED");
              }
            }
          },
          
          1 Reply Last reply Reply Quote 0
          • M Offline
            MMRIZE @tjat
            last edited by

            @tjat
            Could you share the whole code in Git Hub?

            1 Reply Last reply Reply Quote 0
            • M Offline
              MMRIZE @tjat
              last edited by MMRIZE

              @tjat
              If your calendar object is defined in a named function, this will indicate the function itself. However in that case, sendSocketNotification would cause an undefined function error.

              1 Reply Last reply Reply Quote 0
              • 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