• NVM (Node Version Manager)

    Node.js의 버전은 너무 다양하다. 시간이 흐르고 흘러 어느덧 Node.js(이하 Node)의 LTS가 8.10.0이 되었고, 9.8.0까지 나왔다. 새로운 버전이 계속 릴리즈되면서 그 사이에 진행되었던 프로젝트들은 다양한 버전을 통해 개발되었고, 이를 위해 Node의 버전을 변경하며 해당 프로젝트를 확인해야하는 상황이 생기게 되었다. 이런 고생을 줄여줄 아주 고마운 도구가 있어 소개하려 한다. NVM ? Node...

  • 비동기 (asynchronous)

    Promise 콜백 내에서 어떤 작업(예: 비동기 작업)을 수행하는 경우 모든 것이 순조롭게 작동하면 resolve가 호출되고 그렇지 않으면 reject가 호출된다 var promise = new Promise(function(resolve, reject) { // do something if (/* 잘 동작했다면 */) { resolve("성공"); } else { reject(Error("실패")); } }); promise.then(function(result) { console.log(result); // "성공" }, function(err) {...

  • Seleinum Webdriver 예제

    지난 포스팅에서 Selenium 자체에 대한 소개를 하였고, 이번 포스팅에서는 실제로 어떻게 사용할 수 있는지 설명하겠다 테스트 환경 Java Node.js Vendor별 driver Browser Component Chrome chromedriver(.exe) Internet Explorer IEDriverServer.exe Edge MicrosoftWebDriver.msi Firefox geckodriver(.exe) Safari safaridriver 테스팅할 브라우저의 driver는 위 표에서 각각 다운로드 받으면 된다 safaridriver는 OS X El Capitan 및 macOS...

  • 상속 in Class

    클래스 (Class) Object Oriented (OO) 작동위임 (Behavior Delegation) Ojects Linking to Other Objects (OLOO) 클래스 Object Oriented (OO) prototype을 이용한 클래스 상속 function Widget(width, height) { this.width = width || 50; this.height = height || 50; this.$elem = null; } Widget.prototype.render = function($where) { if (this.$elem) { this.$elem.css({ width: this.width...

  • Seleinum Webdriver

    Selenium is a browser automation library. Most often used for testing web-applications, Selenium may be used for any task that requires automating interaction with the browser. 직접 사람이 브라우저에서 조작을 하는 것이 아닌, 작성된 테스트 명령에 의해 브라우저에서 자동으로 조작이 이루어지게 한다 Selenium Projects Logo Desc Selenium IDE Selenium Remote...

  • 상속 (Inheritance)

    프로토타입 상속 자바스크립트 객체 간의 관계는 복사되는게 아니라 위임 연결이 맺어진 것 전형적인 프로토타입 스타일 코드 function Foo(name) { this.name = name; } Foo.prototype.myName = function() { return this.name; } function Bar(name, label) { Foo.call(this, name); this.label = label; } Bar.prototype = Object.create(Foo.prototype); // 'Bar.prototype'를 'Foo.prototype'에 연결한다. Bar.prototype.myLabel = funciton()...

  • Karma

    Karma란 Karma에 따르면 다음과 같이 설명을 한다. A simple tool that allows you to execute JavaScript code in multiple real browsers. The main purpose of Karma is to make your test-driven development easy, fast, and fun. 여러 브라우저 환경에서 JS를 실행시켜 주어, TDD를 편하고 빠르게 그리고 재밌게(뭐가 재밌는지는 모르겟지만) 할...

  • 프로토타입 (Prototype)

    [[Prototype]] 명세에 따르면 자바스크립트 객체는 [[Prototype]]이라는 내부 프로퍼티가 있고 다른 객체를 참조하는 단순 레퍼런스로 사용한다. var anotherObject = { a: 2 }; // 'anotherObject'에 연결된 객체를 생성한다. var myObject = Object.create(anotherObject); myObject.a // 2; myObject는 anotherObject와 [[Prototype]]이 링크됐다. myObject.a란 프로퍼티는 없지만 anoterhObject에서 2라는 값을 대신 찾아 프로퍼티 접근의 결과값으로 반환한다....