반응형
길 찾아가는 자바스크립트
https://qiao.github.io/PathFinding.js/visual/?utm_campaign=%EA%B0%9C%EB%B0%9C%EC%9E%90%EC%8A%A4%EB%9F%BD%EB%8B%A4&utm_medium=social&utm_source=gaerae.com
반응형
반응형
반응형
반응형

자바스크립트 개발자 포럼

https://jsdev.kr

...
반응형
반응형

[javascript] VUE.js - https://kr.vuejs.org


GitHub : https://github.com/vuejs/vue


A progressive, incrementally-adoptable JavaScript framework for building UI on the web. 


Vue.js가 무엇인가요?

Vue(/vjuː/ 로 발음, view 와 발음이 같습니다.)는 사용자 인터페이스를 만들기 위한 진보적인 프레임워크 입니다. 다른 단일형 프레임워크와 달리 Vue는 점진적으로 채택할 수 있도록 설계하였습니다. 핵심 라이브러리는 뷰 레이어만 초점을 맞추어 다른 라이브러리나 기존 프로젝트와의 통합이 매우 쉽습니다. 그리고 Vue는 현대적 도구  지원하는 라이브러리와 함께 사용한다면 정교한 단일 페이지 응용프로그램을 완벽하게 지원할 수 있습니다.

숙련된 프론트엔드 개발자이고 Vue를 다른 라이브러리/프레임워크와 비교하고 싶다면 다른 프레임워크와의 비교를 확인하십시오.




Vue.js를 시험해 볼 수 있는 가장 쉬운 방법은 JSFiddle Hello World 예제를 사용하는 것입니다. 다른 탭에서 자유롭게 열어 본 후 몇 가지 기본 예제를 따라가십시오. 또는 단순히 index.html 파일을 만들고 Vue를 다음과 같이 포함할 수 있습니다.




반응형에 대해 깊이 알아보기

우리는 대부분의 기본적인 내용을 다루었습니다. 이제 깊이 알아 볼 때 입니다! Vue의 가장 두드러진 특징 중 하나는 눈을 어지럽히지 않는 반응형 시스템 입니다. 모델은 단순한 JavaScript 객체 입니다. 수정하면 뷰가 갱신됩니다. 이것은 상태 관리를 매우 간단하고 직관적으로 만듭니다. 이를 이해하는 것은 매우 중요합니다. 이 섹션에서는 Vue의 반응 시스템에 대한 하위 수준의 세부 정보를 살펴 보겠습니다.

<

변경 내용을 추적하는 방법  https://kr.vuejs.org/v2/guide/reactivity.html

일반 JavaScript 객체를 data 옵션으로 Vue 인스턴스에 전달하면 Object.defineProperty를 이용해 Vue는 모든 속성을 거쳐 getter / setter 변환합니다. 이것은 ES5 전용이며 하위 버전에 없는 기능이기 때문에 Vue가 IE8 이하를 지원하지 않습니다.

getter / setter 는 사용자에게는 보이지 않으나 속성에 액세스 하거나 수정할 때 Vue가 종속성 추적 및 변경 알림을 수행할 수 있습니다. 한가지 주의 사항은 변환된 데이터 객체가 기록될 때 브라우저가 getter / setter 형식을 다르게 처리하므로 친숙한 인터페이스를 사용하기 위해vue-devtools를 설치하는 것이 좋습니다.

모든 컴포넌트 인스턴스에는 해당 watcher 인스턴스가 있으며, 이 인스턴스는 컴포넌트가 종속적으로 렌더링되는 동안 “수정”된 모든 속성을 기록합니다. 나중에 종속적인 setter가 트리거 되면 watcher에 알리고 컴포넌트가 다시 렌더링 됩니다.



...

반응형
반응형

남은 시간 카운터 - 자바 스크립트

 

 

 

 

 

 

 

 

 

 

 

 

 

.

반응형
반응형


<br><br>
*** 시작페이지로 지정하기 ***
<br><br>

<script type="text/javascript" src="/common/js/jquery-latest_header.js"></script>
<div id="homepage-link">
    <a href="javascript:addashomepage()"> Make this your homepage  </a>
    <span id="homepagePopup">
        <section class="text">
        </section>
        <br /><a href="javascript:void(0);" class="close">close</a>
    </span>
        Set as your home page
</div>





 
 <script type="text/javascript">

     /* Add as home page script - Dave Goodman goodmangraphics.co.uk */
     function addashomepage() {

         // makes jQuery differentiate between Chrome and Safari - thanks to Vikrant Chaudhary
         $.browser.chrome = $.browser.webkit && !!window.chrome;
         $.browser.safari = $.browser.webkit && !window.chrome;

         if ($.browser.msie) { // IE
             if ($.browser.msie && parseInt($.browser.version, 10) < 8) { // IE is v7 or lower - use ye olde homepage code
                 document.body.style.behavior = 'url(#default#homepage)';
                 document.body.setHomePage(window.location.href);
             } else { // IE v8 or higher
                 var homesettext = "<p><strong>Internet Explorer</strong><br /><br />To set your homepage in Internet Explorer 6 or later on Microsoft Windows:</p><ol><li>Select <strong>Tools |&nbsp;Internet Options</strong>.</li><li>On the &quot;General&quot; tab, in the &quot;Home page&quot; text box, type: <em>http://www.garagewire.co.uk/&nbsp; </em></li></ol><p><strong>Note: </strong>The &quot;Home page&quot; box can contain multiple URLs. If you want Garage Wire to be the first tab when your browser opens, make sure<em> http://garagewire.co.uk/ </em>is the first URL in this box.</p><ol start='3'><li>Click <strong>Apply</strong></li><li>Click<strong> OK</strong>.</li></ol>";
             };

         } else if ($.browser.safari) { // safari
             var homesettext = "<p><strong>Safari</strong><br /><br />To set your homepage in Safari 1 or later for Mac OS X or Microsoft Windows:</p><ol><li>Select <strong>Edit | </strong> <strong>Preferences</strong> or click the cog icon in the upper-right and select <strong>Preferences</strong>. The &quot;Preferences&quot; window appears.</li><li>Select the <strong>General</strong> tab.</li><li>Enter <em>http://www.garagewire.co.uk/ </em>in the&quot;Homepage&quot; text box.<em> </em></li><li>Click <strong>Close</strong>.</li></ol>";

         } else if ($.browser.webkit) { // chrome
             var homesettext = "<p><strong>Chrome</strong><br /><br />To set your homepage in Chrome 18 or later for Mac OS X or Microsoft Windows:</p><ol><li>Sign in to Chrome if you have not already done so.</li><li>Select the&nbsp;Customize and control Google Chrome icon (the icon with three bars to the right of the URL&nbsp;box).</li><li>Select <strong>Settings</strong>.</li><li>Under &quot;On startup&quot;, select the <strong>Open a specific page or set of pages</strong> button.</li><li>Click <strong>Set Pages</strong>.</li><li>Enter <em>http://www.garagewire.co.uk/ </em>in the field provided.<em> </em></li><li>Click <strong>OK</strong> to save your settings.</li></ol>";

         } else if ($.browser.mozilla) { // firefox
             var homesettext = "<p><strong>Mozilla Firefox</strong><br /><br />To set your homepage in Mozilla Firefox 16 or later on Microsoft Windows or Mac OS X:</p><ol><li>Select <strong>Firefox |</strong> <strong>Options</strong>. The <strong>Options</strong> dialog box appears.</li><li>Click the <strong>General</strong><em> </em>tab if not already selected.</li><li>Choose <strong>Show my home page</strong> in the drop-down to the right of &quot;When Firefox starts:&quot;.</li><li>Enter <em>http://www.garagewire.co.uk/</em> in the &quot;Home Page&quot; text box.</li><li>Click <strong>OK</strong>.</li></ol>";

         } else if ($.browser.opera) { // opera
             var homesettext = "<p><strong>Opera</strong><br /><br />To set your homepage in Opera on Microsoft Windows:</p><ol><li>Navigate to and click on the 'Preferences' link from the drop-down menu at the top of the Opera browser. The Preferences box will open. Select the 'General' tab.</li><li>Click on 'Set current page as home page'.</li><li>Click <strong>OK</strong>.</li></ol>To set your homepage in Opera on Mac OS X:</p><ol><li>Click on the top menu option 'Opera,' and then click on the 'Preferences' option. The Preferences box will open with the General tab already selected.</li><li>click 'Use Current.' Then utilize the drop-down menu to choose the desired navigation option.</li><li>Click <strong>OK</strong>.</li></ol>";

         } else { // unknown browser
             var homesettext = "<p><strong>Unknown browser type</strong><br /><br />To set your homepage please refer to your browser's help</a>";
         };

         if (homesettext) {
             $("#homepagePopup .text").html(homesettext);
             $("#homepagePopup").fadeIn();
             //alert(homesettext);
         };

     };

     jQuery(document).ready(function ($) {

         $("#homepagePopup .close").click(function (event) {
             $("#homepagePopup").fadeOut();
         });

         $("#bookmarkPopup .close").click(function (event) {
             $("#bookmarkPopup").fadeOut();
         });

     });
 
</script>







<style>
#homepagePopup {
    position: absolute;
    float: left;
    text-align: left;
    padding: 15px;
    background: #000;
    color: #fff;
    font-size: 1.2em;
    line-height: 1.2em;
    border: #ccc 2px solid;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    top:0;
    left:20px;
    z-index: 100;
    -moz-box-shadow: 0 0 15px #888;
    -webkit-box-shadow: 0 0 15px#888;
    box-shadow: 0 0 15px #888;
    display: none;
}
 
#homepagePopup ol li {
    list-style: decimal;
    padding: 4px 0 4px 0px;
    margin-left: 20px;
}

</style>

반응형
반응형

QUnit: A JavaScript Unit Testing framework.

 

QUnit을 이용한 Javascript 단위테스트http://www.nextree.co.kr/p2256/ 

 

What is QUnit?

QUnit is a powerful, easy-to-use JavaScript unit testing framework. It's used by the jQuery, jQuery UI and jQuery Mobile projects and is capable of testing any generic JavaScript code, including itself!

Getting Started

A minimal QUnit test setup:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.15.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="//code.jquery.com/qunit/qunit-1.15.0.js"></script>
<script src="tests.js"></script>
</body>
</html>

The contents of tests.js:

1
2
3
QUnit.test( "hello test", function( assert ) {
assert.ok( 1 == "1", "Passed!" );
});

The result:

Browser Support

QUnit supports the same browsers as jQuery 1.x.

That's IE6+ and Current - 1 for Chrome, Firefox, Safari and Opera.

 ======================================================================

 

jQuery Mockjax: Ajax request mocking

http://github.com/appendto/jquery-mockjax/

jQuery Mockjax provides request/response mocking for ajax requests with jQuery and provides all standard behaviors in the request/response flow.

You may report any issues you may find in the github issue tracking.

jQuery Version Support

The current version of Mockjax has been tested with jQuery 1.3.2 through 2.0.0 with QUnit unit tests, residing in /test.

Browsers Tested

Internet Explorer 6-9, Firefox 3.6 and stable, Safari 5.x, Chrome stable, Opera 9.6-latest.

 

 

반응형
반응형

역활별 자바스크립트

 

 역활

라이브러리 명 

 모듈화 지원

 - Backbone.js 

 비동기 로드 지원

 - RequireJS

 MVC(Model - View - Controller)

 - AngularJS

 - knockoutJS

 End-to-End framework

 - Meteor(http://www.meteor.com) on Node.js

 - Derby(http://derbyjs.com) on Node.js

 

- 자바스크립트 MVC는 서버 사이드에서처럼 브라우저 단에서도 데이터와 뷰, 로직 처리를 분리해 개발 및 확장, 유지보수성을 높이고 최저 품질을 높이기 위한 방법을 지원하자는 취지에서 개발됨.

 

- End-to-End 프레임워크는 Node.js 진영에서 지원되는 프레임워크로 서버에서 브라우저까지 모두 자바스크립트로 개발 할 수 있도록 돼 있다. 서버에 설치부터 필요함.

 

- AngularJS, KnockoutJS는 Data Binding을 지원한다. Data Binding이란 자바스크립트의 객체 값으로 HTML의 태그와 양방향 통신을 해서 일치시켜 주는 작업을 지원하는 것을 말한다. 별도 HTML태그를 컨트롤 할 필요없이 자바스크립트 객체값만 변경시키면 UI는 저절로 변경이 된다. 그렇다고 아무것도 안하는 것은 아니다.

 

* 라이브러리를 익혀 나가는 순서.

1. Backbone으로 모듈화 및 기본적인 MVC 의 개념을 익힌다.

2. RequireJS로 비동기적으로 js를 불러와 네트워크 트래픽을 분산시키는 기법을 익힌다.

3. Backbone + Require 또는  AngularJS + RequireJS(KnockoutJS + RequireJS) 의 조합으로 MVC르 ㄹ좀더 심화시킨다. (AngularJS는 구글에서, KnockoutJS는 MS에서 지원하고 있다. )

 

angular , require backbone 

 

.

반응형

+ Recent posts