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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wcardinal/wcardinal

v1.0.3

Published

Winter Cardinal client-side libraries

Downloads

193

Readme

Winter Cardinal is a library for real-time web applications build on top of the Spring framework. It is designed for making single-page applications stable against unintended network/server failures. The controller class and its fields defined on a server will be synchronized with clones on browsers in real time. Also enables us to call methods defined on the controller class from browsers.

// Java
import org.wcardinal.controller.annotation.Controller;
import org.wcardinal.controller.annotation.Callable;

@Controller
class MyController {
	@Autowired
	SLong field;

	@Callable
	String hello( String name ){
		return "Hello, "+name;
	}
}
<!-- HTML -->
<script src="./my-controller"></script>
<script>
myController.field.get();      // Gets a field value
myController.field.set( 128 ); // Changes a field value

// Calls `hello( String )` method
myController.hello( 'John' ).then(( result ) => {
	console.log( result ); // Prints 'Hello, John'
});
</script>

Installation

Gradle

dependencies {
	compile 'com.github.winter-cardinal:winter-cardinal:latest.release'
}

Client-side libraries are packed in this JAR as a WebJars. Please find the wcardinal.min.js in the directory META-INF/resources/webjars/wcardinal/${version}/. WebJars can be loaded from browsers as follows:

<script src="webjars/wcardinal/wcardinal.min.js"></script>

Please note that the ${version} part is omitted.

NPM

The client-side libraries are also available as a NPM package.

npm i @wcardinal/wcardinal

Please note that the NPM package has no default exports.

import * as wcardinal from '@wcardinal/wcardinal';

CDN

<script src="https://cdn.jsdelivr.net/npm/@wcardinal/wcardinal/dist/wcardinal.min.js"></script>
<script src="./my-controller"></script>

All the classes are in window.wcardinal in this case. Note that the wcardinal.min.js must be loaded before loading your controller as shown above.

Documentation

Browser support

Supports the latest version of Chrome, Firefox, Edge and Safari. IE9 and later are supported on Windows.

How to build

The following commands are for building Winter Cardinal itself. For most users, you do not need to do this.

JS for release

npm run build

JS for development

npm run watch:ts

and then in an another terminal

npm run watch:rollup

Java API document

./gradlew compileJavaApiDocument

JS API document

npm run build:api

Cheatsheet

./gradlew compileCheatsheet

Publishing

JARs to Sonatype

In ~/.gradle/gradle.properties, add

signing.keyId=<SIGNING-KEYID>
signing.password=<SIGNING-PASSWORD>
signing.secretKeyRingFile=<SIGNING-SECRETRINGFILE>

ossrhUsername=<OSSRH-USERNAME>
ossrhPassword=<OSSRH-PASSWORD>
ossrhName=<OSSRH-NAME>
ossrhEMail=<OSSRH-EMAIL>

and then execute

./gradlew publishToSonatype
./gradlew closeAndReleaseRepository

Or close and release via Nexus repository manager.

NPM

npm publish

License

Apache License Version 2.0