canjs

JS framework providing state management, templates & custom elements. Helps you build the impossible while keeping the common stuff easy.

Github星跟蹤圖

CanJS

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.

主要指標

概覽
名稱與所有者canjs/canjs
主編程語言JavaScript
編程語言JavaScript (語言數: 4)
平台
許可證Other
所有者活动
創建於2012-01-20 17:57:21
推送於2023-08-03 19:56:13
最后一次提交2023-08-03 14:56:13
發布數325
最新版本名稱v6.6.3 (發布於 2023-02-02 23:29:39)
第一版名稱1.0b (發布於 )
用户参与
星數1.9k
關注者數104
派生數420
提交數11.2k
已啟用問題?
問題數2147
打開的問題數299
拉請求數1852
打開的拉請求數13
關閉的拉請求數1503
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?