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 🙏

© 2025 – Pkg Stats / Ryan Hefner

can-23

v1.0.3

Published

Upgrade from CanJS 2.X to CanJS 6 easily!

Downloads

40

Readme

Can-23

Upgrade from CanJS 2.X to CanJS 6 easily!

This repo creates a very close approximation of CanJS 2.3's behavior, but uses CanJS 6's technology. This makes CanJS 2.X code work with CanJS 6. The result is you can incrementally upgrade your legacy CanJS 2.X app to CanJS 6. Replace one legacy control or component at a time, while being able to add new features!

Use

Step 1

Replace imports of can with imports of can-23. For example, replace:

import Control from "can/control/control"

With:

import Control from "can-23/control/control"

Step 2

Import can-23/util/before-remove before any controls instance get created.

Step 3

Run migrations to change view-bindings.

Step: Handle events on controls after teardown

CanJS 2.3 had different event timing than CanJS 6's queues system.

The can-23/control/noop-event-handlers-on-destroyed rewrites control event handlers to check if the control has been destroyed before calling the callback function.

Import it before any Control is instantiated:

import "can-23/control/noop-event-handlers-on-destroyed"

This plugin will warn when a control event handler is called after destroy.

Optional Step: Switch to how CanJS 2.2 passes computes instead of 2.3

CanJS 2.2 would sometimes pass a compute when 2.3 (and 6.0) would pass a value.

To switch to this, set the following:

can.view.Scope._legacyCan22FindingAnObservableOnTheScopeReturnsComputes = true;

Other

  • can.Map.prototype._legacyAttrBehavior is set to true. This means classes are left alone.

Limitations

Control

Can 2's Control's removed events and destroy methods were run before the element was actually removed.

CanJS 6's removed events are run asynchronously after the element was actually removed.

The can-23/util/before-remove module creates a beforeRemove event that acts like Can 2's removed event.

When the can-23/util/before-remove is loaded, Can23's Control will translate removed events to beforeRemove event automatically.

If you want a Can23 Control to use CanJS 6's async removed event, you can specify that as follows:

Control.extend({
  " removed": function(){ ... }
  $useAsyncRemoved: true
})

This can be set globally like:

Control.$useAsyncRemoved = true

However, the same thing can be done by removing the before-remove module.