Giter VIP home page Giter VIP logo

displayjs's Introduction

DisplayJS


A simple framework for building ambitious UI, without thinking about how everything will be displayed.
By the way, you can ⭐️ the project to support it 😊

GitHub release Build Status Github All Releases npm License

Browser support

The browser support table is not 100% accurate. The ⛔ means that I didn't test DisplayJS for that browser.

Chrome logo Firefox logo IE logo Opera logo Safari logo Android Browser Logo
52+ ✅ 52+ ✅ 10+⛔ 40+ ✅ 9+ ✅ 5.2+ ⛔

Getting Started

To use display.js, you'll need to download display.js and add it in your js folder. Or, you can add these line of code in the head or in the body of your page:

// Add DisplayJS
<script src="https://unpkg.com/display.js"></script>

or you can install DisplayJS using npm

$ npm install display.js

Initialize DisplayJS

// Create a var for Display.JS. You don't have to add the $ var, you can change the name.
var $ = new DisplayJS (window);

The full docs can be found here

Support

DisplayJS is a project that required a lot of work and effort. You can show your appreciation by leaving a ⭐️. But you can also contribute in a 'financial' way by giving to my Patreon

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Made a website using the DisplayJS?

Add the built with DisplayJS badge to your README.md

Built with DisplayJS

Feel free to send me an email at [email protected], and I might add your site to an examples section I'm currently working on.

Examples of projects using DisplayJS

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Arthur Guiot - Initial work - @arguiot
  • Nikhil Bhaskar - Added aliases for the $.var() function - @Nikhil22
  • devrafalko - Helped a lot for the $.math() function - @devrafalko
  • Irving Ventura - Fixed a merge issue - @irvingv8
  • Vladimir B. - Fixed the global export warning - @ange007
  • ChenSheng - Fixed $.s() function - @Cslove

See also the list of contributors who participated in this project. If you don't code but you have great ideas, don't hesitate to write your idea in the issue part. If your idea is accepted, I will add you to this list 😊.

Thank You
for support

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright © 2017 Arthur Guiot All Rights Reserved.

displayjs's People

Contributors

adiman9 avatar akccakcctw avatar ange007 avatar arguiot avatar atakangktepe avatar cslove avatar dasamantaraoaditya avatar dependabot-support avatar diptinayan avatar djm158 avatar flordeciruela avatar idanaiziknissim avatar imgbotapp avatar lucasgruwez avatar nikhil22 avatar shreyas-a avatar sibeitokgong avatar vdeventura avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

displayjs's Issues

$.range() mentions for...in for arrays

The $.range() page mentions the following:

This function will be super useful when you're dealing with these kinds of for loop:

for (i in array) {
    ...
}

But the MDN explicitly notes that you should not do this:

Note: for...in should not be used to iterate over an Array where the index order is important.

Because the order of iteration is implementation-dependent, iterating over an array may not visit elements in a consistent order. Therefore it is better to use a for loop with a numeric index (or Array.prototype.forEach() or the for...of loop) when iterating over arrays where the order of access is important.
Array iteration and for...in

More examples, please!

Just stumbled on this today and I can see the benefits of using a framework like this. Would really love to see more examples of how it might apply to real-world situations. Things like:

  • Navigation
  • Personalization
  • Dynamic UI elements (favorites, ratings, etc)
  • Other UI tricks like animations, effects, transitions, etc

Thanks for this, will be watching!

VM838 display.js:331 Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object HTMLBodyElement]' is not a valid selector.

when i try to use $.scrollTop().

$.scrollTop()

23:29:45.660 VM838 display.js:331 Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '[object HTMLBodyElement]' is not a valid selector.
    at DisplayJS.select (http://localhost:8000/node_modules/display.js/dist/display.js:331:52)
    at DisplayJS.s (http://localhost:8000/node_modules/display.js/dist/display.js:343:16)
    at DisplayJS.scrollTop (http://localhost:8000/node_modules/display.js/dist/display.js:393:14)
    at <anonymous>:1:3

Hacktoberfest

Hacktoberfest is here, and DisplayJS is a perfect repo for it 😊.

TodoMVC and dbmon demo

It would be good to have a TodoMVC and dbmon implementation in DisplayJS to see how Displayjs plays and performs in an app.

infinite loop inside of live()

https://codepen.io/guyjacks/pen/eRwadE

This is probably more of a javascript issue than an issue with DJS, but I can't figure out how to prevent an infinite loop from occurring when I update the variable that I'm watching.

I don't see the difference between my example and the dog example in the docs.

I love this little framework... Cheers!

jQuery conflict

Displayjs is awesome. But it doesn't seem to play nice with jQuery. Especially jQuery GET and POST.

$.live() may be has some problems.

I don't know hou to descripe in English...

使用dog初始化,然后使用 $.var(true) 进行绑定。
但是当我修改dog中的变量的值的时候,视图并没有立即刷新,当我第二次修改才会刷新。

Translate by Google:

Use dog to initialize, and then use $ .var (true) for binding. But when I modify the value of the variable in dog, the view does not immediately refresh, when my second change will refresh.

Maybe the gif can let you know what i said.

live-problem github

Here is the code:

<p>My dog's name is <span var="name"></span></p>
<p>It is <span var="age"></span> years old now!</p>

&

var dog = {
    name: 'doge',
    age: 12
}
var $ = new DisplayJS(dog)
$.var(!0)

i hope you can understand what i mean.

Load Help

can displayJS do

$( "#b" ).load( "article.html #target" );

load target on id/class?

How use displayJS in objects or class

Tell me please what I do not correctly (use example3)?

<script>
var $ = new DisplayJS( window );

var obj = {};
obj.set = function( )
{
    var list = $.range(5);
    var average = $.average( list );
    var median = $.median( list );
   ....
    $.var( );
};

obj.set( );
</script>

_035

Or it is necessary to use?:

let data = {
  list: '',
  average: '',
  median: ''
}

const $ = new DisplayJS( data );

But how uses displayJS in classes and many objects?

Typos in landing page

First of all I would like to say thanks for this awesome framework 👏. I've found typos in landing page and fixed them. I'll open a pr for fix these typos.

Self read elements in $.on, $.html and other

It would be good if elements were read out by a call of $ .on(), $ .html() and others.
As now it very much spoils a code.

$.html($.s(".todo-list"), localStorage.getItem("todos"));
$.all($.s(".toggle"), function(el) {});

a wrong word

It's not important,but is adjascent a wrong word in $.after() &amp; $.before()?

Uncaught TypeError: Cannot redefine property: chrome

when i try to use $.var(true) , it crashed.

var $ = new DisplayJS(window)
$.var(true)
Uncaught TypeError: Cannot redefine property: chrome
    at Function.defineProperty (<anonymous>)
    at Object.watch (display.js:759)
    at Object.watchAll (display.js:778)
    at DisplayJS.live (display.js:782)
    at DisplayJS._var (display.js:47)

Errors on display.js.org

When using an adblocker extension in Chrome (Adblock plus in my case) seems to break the display.js.org site.
Seems to be from the video that is embedded and the code served from google to do with ads on the video.

The Core language wiki has strange code example

In the The Core language page, there is a code example:

// create DisplayJS instance
var $ = new DisplayJS(window)

var lines = [
	"First line",
	"Second line",
	"Third line"
]
var text = $.select(".text")

for (let i in lines) {
	$.append(text, lines.indexOf(i) + " " + i + "<br>")
}

What is the intention with using lines.indexOf(i)? It always returns -1, as the index is never in the list of lines. Maybe it wanted to be lines[i]?

Separation of the project code

I think it would be more convenient to carry out some functionality in "plugins".
For example to "Math".
It concerns both "src", and a "dist" directories.

$.empty() is not work very well

$.empty() can't empty the content which I insert by $.after() & $.before()
html
<div class="testEl">I'll have before and after HTML when DisplayJS will do its work</div>
js
$.after($.select(".testEl"), "<h1>Hello, I'm the after HTML</h1>"); $.empty($.select(".testEl"))

Need an example app

Hello

Unless I'm missing something, the given examples are too light for me to understand what a real app would look like.
Do you have any example of application created with DisplayJS?

Pascal

$.load() how to load a html page?

test.html:

<p class="status">Loading</p>
<div class="load"></div>

js:

const $ = new DisplayJS(window)
$.load('.load', './_load.html', function(){
  $.html('.status', 'Loaded')
})

_load.html:

<div class="load">
    <h3>Load Success!!!!</h3>
    <p>Here is from load.html!!!!!</p>
</div>

but test.html will not load the _load.html

There is a $.select() question when i use display.es6.js

i wanted to use $.s() function to select DOM node

html
but report errors: Uncaught RangeError: Maximum call stack size exceeded
error

so i checked your display.es6.js source code found that there is a question in "isElement()"function and "select()" function.
iselement
select

so i deleted the "el = this.s(el);" in "isElement()" function and it works!

fix
work

Could you check the source code?

bloat

Dude,
you have a great idea for binding state between the UI and Controller. You should strip down your api to it's core driving principal of just that, binding state. You have packaged up alot of non-sense bloat that developers dont need or care about. There is .load(), .live(), .custom(), .ajax().....and on and on.

Truth is, this is an awesome idea for an api, not a framework.

$.component is not useful.

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
    at new component (display.js:541)
    at DisplayJS.component (display.js:550)
    at 

Not work $.dynamic() on first change

Not work (p show - '00'):

<p var="time"></p>

var data = { time: '00' };
var $ = new DisplayJS( data );

 $.dynamic( function( )
{
    const time = new Date();
    data.time = time.getHours();
} );

 $.var( true );

Work (p show - current time) :

<p var="time"></p>

var data = { time: '00' };
var $ = new DisplayJS( data );

 $.dynamic( function( )
{
    const time = new Date();
    data.time = time.getHours() + ':' + time.getMinutes() + ':' + time.getSeconds();
} );

 $.var( true );

Rather a question,

Do you plan to add a few concise laconic
Additions - cycles, conditions choose, routes?

repeat function with updating data

Hi, cool library

I am trying to use the repeat function with an array that I get from a request, I would like to update this array every 500ms

But calling repeat again will further extend all items inside the block. So one option is to set innerHtml to "" but this will clear the template as well and brick repeat.... am I missing something here ? or is this not possible yet ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.