0.1.0 • Published 3 years ago

immutable-core-component v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

immutable-core-component

Immutable Core Component provides the server side functionality for Immutable App Component. Together they provide a framework for dynamic UI components that integrate with the Immutable App ecosystem.

When using Immutable App, Immutable Core Components will be instantiated automatically from the files in the component directory. The examples here use Immutable Core Component directly. See the Immutable App Component documentation for usage examples with an app.

Server configuration options

var component = new ImmutableCoreComponent({
    name: 'foo',
    server: {
        get: function (args) {}
        new: function (args) {},
        set: function (args) {},
    },
})

This example will create a new Immutable Core module named fooComponent with get, new and set methods.

The arguments for server will be taken from the foo.server.js file when used with Immutable App Component.

Client configuration options

var component = new ImmutableCoreComponent({
    client: {
        binds: { 'element-id', 'data.property' },
        minify: true,
        placeholders: { foo: 'foo', 'foo.bar', 'bar' },
        preRender: function (args) { .... }
    }
})

The arguments for client will be taken from the foo.client.js file when used with Immutable App Component.

nametypedescription
bindsobjectmap of ids and data properties to bind
minifybooleanminify js sent to client
placeholdersobjectmap of data properties and placeholder values
refreshIntervalintegertime in ms between refresh of client data
----------------------------------------------------------------------------
preBindfunctionhook that executes before bind
preGetfunctionhook that executes before get
preRefreshfunctionhook that executes before refresh
preRenderfunctionhook that executes before render
preSetfunctionhook that executes before set
postBindfunctionhook that executes after bind
postGetfunctionhook that executes after get
postRefreshfunctionhook that executes after refresh
postRenderfunctionhook that executes after render
postSetfunctionhook that executes after set

General configuration options

var component = new ImmutableCoreComponent({
    css: '.foo { display: block }',
    helpers: { bar: function () {...} },
    js: 'console.log("foo")',
    partials: { bam: 'Goodbye {{foo}}' },
    template: 'Hello {{foo}}',
})

When using Immutable App Component:

  • the css property comes from foo.css
  • the helpers object is populated from the helpers directory
  • the js property comes from foo.js
  • the partials object is populated from the partials directory
  • the template property comes from foo.hbs
nametypedescription
cssstringcss to include on page - will be wrapped in
helpersobjectmap of handlebars helper names and functions
jsstringjs to include - will be wrapped in anonymous function
partialsobjectmap of handlebars partials names and template strings
templatestringmain handlebars template string
0.1.0

3 years ago

0.0.45

5 years ago

0.0.44

5 years ago

0.0.43

6 years ago

0.0.42

6 years ago

0.0.41

6 years ago

0.0.40

6 years ago

0.0.39

6 years ago

0.0.38

6 years ago

0.0.37

6 years ago

0.0.36

6 years ago

0.0.35

6 years ago

0.0.34

6 years ago

0.0.33

6 years ago

0.0.32

6 years ago

0.0.31

6 years ago

0.0.30

6 years ago

0.0.29

6 years ago

0.0.28

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago