npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-persisted-trigger

v1.0.5

Published

Persisted trigger node – drop‑in replacement for the core Trigger node

Downloads

33

Readme

node-red-contrib-persisted-trigger

A drop-in replacement for Node-RED’s core Trigger node, extended with persistence across restarts and enhanced handling of expired timers.
It provides the same configuration and behavior as the stock Trigger node, plus a few extra options.


Why use this node?

The core Trigger node loses all pending timers and messages whenever Node-RED restarts.
This node stores its state in the selected context store (e.g. localfilesystem) so that:

  • Pending timers survive a Node-RED restart or redeploy.
  • Messages scheduled to fire after a restart will still be delivered at their original expiry time (or flagged if already expired).
  • You control where state is stored via a Context store dropdown.

Key differences from the stock Trigger node

1. Persistence

  • Uses Node-RED context storage to remember pending timers.
  • When restarted:
    • If a timer is still in the future, the message will be delivered at the correct time.
    • If a timer has already expired during downtime, behavior is controlled by the Expired handling option.

2. Expired handling

When a message’s timer expires while Node-RED is offline, you can choose:

  • Discard – Drop the expired message (default, like stock Trigger).
  • Send anyway – Deliver the message immediately on restart.
  • Flag and send – Deliver the message and add:
    • msg.expired = true
    • msg.triggerOriginalExpiry = <unix timestamp>
      Downstream nodes can decide whether to keep or discard it.

3. Context store selection

  • New Context store dropdown lets you pick from configured stores (memory, localfilesystem, or custom).
  • Useful if you want persistence only in some flows, or different retention behaviors.

4. Separate outputs

  • Option: Send second message to separate output
    When enabled, the node has 2 outputs:
    • Output 1 → First message ("send now")
    • Output 2 → Second message ("then send")
  • Note: In Resend every or Wait until reset mode, the second output is disabled (matches stock Trigger behavior).

Node status

The node updates its status text so you can see what’s happening at a glance:

  • Idle – No pending messages.
  • 1 pending / 2 pending / ... – How many timers are active (in all messages mode).
  • reset – A reset message was received and cleared the timer.
  • expired – A persisted message expired during downtime and was discarded/flagged/sent depending on settings.

Other features preserved from stock Trigger

  • Override delay with msg.delay – Replace the configured duration dynamically.
  • Extend delay if new message arrives – Restart the timer if more messages arrive.
  • Handling modes:
    • All messages – One timer for the whole node.
    • Each msg property – Independent timers per msg.topic (or another message property).
  • Typed input selectors for both Send and Then send:
    • existing/original message object
    • latest message
    • string, number, boolean, JSON, buffer, timestamp
    • env variable, flow context, global context
    • nothing

Example use cases

  • Reliable watchdog timers – A reset message can stop the output, even if Node-RED restarts in between.
  • Delayed alerts – Schedule notifications to fire later, without losing them on reboot.
  • Persistence testing – Try with long timers, restart Node-RED mid-way, and confirm outputs still happen.

Installation

npm install node-red-contrib-persisted-trigger

Compatibility

Tested with Node-RED 4.x.

Requires at least one persistent context store configured (e.g. localfilesystem) if you want timers to survive restarts.

Limitations

Certain msg parts are not serializable and cause a circular reference error. Those parts are stripped from the persisted message.
That includes msg.req, msg.res, and msg.socket. When persisting the output of nodes (like HTTP in) that contain these parts, the original message object will contain them, but if the user selects either 'original message object' or 'latest message' under 'then send', the message sent at the end of the timer will NOT contain those message parts.