Skip to content

canjs/canjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

96a1e47 · Aug 3, 2023
Sep 27, 2018
Nov 18, 2019
Aug 3, 2023
Feb 1, 2023
Jun 11, 2020
Feb 3, 2023
Aug 16, 2019
Aug 13, 2012
Aug 27, 2018
Jan 23, 2014
Oct 5, 2016
Nov 15, 2016
Jul 5, 2018
Sep 25, 2017
Feb 3, 2023
Oct 4, 2019
Aug 31, 2016
Aug 6, 2018
May 30, 2018
Feb 1, 2023
Mar 22, 2016
Jun 29, 2018
Oct 23, 2017
Feb 21, 2019
Feb 1, 2023
Apr 10, 2018
Apr 10, 2018
Mar 17, 2016
Aug 5, 2020
Aug 8, 2018
Oct 4, 2019
Aug 27, 2018
Aug 31, 2016
Jun 4, 2019
Sep 23, 2019
May 27, 2015
Feb 3, 2023
Aug 16, 2019
Oct 4, 2019

Repository files navigation

SauceLabs Test Status

Join our Slack Join our Discourse npm version Build Status Greenkeeper badge

CanJS is a collection of client-side JavaScript architectural libraries.

Web Components

CanJS’s StacheElement allows you to create Web Components with observable properties and live-bound templates.

class Counter extends StacheElement {
	static view = `
		Count: <span>{{ this.count }}</span>
		<button on:click="this.increment()">+1</button>
	`;

	static props = {
		count: 0
	};

	increment() {
		this.count++;
	}
}
customElements.define("my-counter", Counter);

Model layer

Components shouldn’t be concerned with how data is fetched, updated, or cached.

CanJS provides the right abstractions for your model code to be cleanly separated from your UI code. Learn more…

Promises in templates

CanJS’s stache templating language can directly read the state and values from Promises.

No need to write any extra code to determine whether a Promise is pending, resolved, or rejected. Learn more…

{{# if(this.promise.isPending) }}
  Loading…
{{/ if }}
{{# if(this.promise.isRejected) }}
  Error: {{ this.promise.reason }}
{{/ if }}
{{# if(this.promise.isResolved) }}
  Result: {{ this.promise.value }}
{{/ if }}

Real-time list updating

After data is created, updated, or destroyed, CanJS automatically updates your lists for you.

Filtering and sorting are preserved, so you don’t have to manually update your lists or fetch the same data again. Learn more…

Getting Started

Ready to get started? See the Setting Up CanJS, API Docs and Guides pages.

Support / Contributing

Before you make an issue, please read our Contributing guide.

You can find the core team on Slack.

Release History

See Releases.

License

MIT License.