diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 21:46:22 -0500 |
commit | a065e04d529da1d847b5062a12c46d916408bf32 (patch) | |
tree | fe0f8bcec1ff39a3c499a2708222dcf15224ff70 /files/ko/webapi | |
parent | 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 (diff) | |
download | translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.gz translated-content-a065e04d529da1d847b5062a12c46d916408bf32.tar.bz2 translated-content-a065e04d529da1d847b5062a12c46d916408bf32.zip |
update based on https://github.com/mdn/yari/issues/2028
Diffstat (limited to 'files/ko/webapi')
-rw-r--r-- | files/ko/webapi/alarm/index.html | 181 | ||||
-rw-r--r-- | files/ko/webapi/contacts/index.html | 210 | ||||
-rw-r--r-- | files/ko/webapi/idle/index.html | 66 | ||||
-rw-r--r-- | files/ko/webapi/power_management/index.html | 102 | ||||
-rw-r--r-- | files/ko/webapi/simple_push/index.html | 92 | ||||
-rw-r--r-- | files/ko/webapi/time_and_clock/index.html | 29 | ||||
-rw-r--r-- | files/ko/webapi/webfm_api/index.html | 132 | ||||
-rw-r--r-- | files/ko/webapi/websms/index.html | 85 | ||||
-rw-r--r-- | files/ko/webapi/websms/introduction_to_mobile_message_api/introduction_to_websms/index.html | 23 |
9 files changed, 0 insertions, 920 deletions
diff --git a/files/ko/webapi/alarm/index.html b/files/ko/webapi/alarm/index.html deleted file mode 100644 index 16c18d9bce..0000000000 --- a/files/ko/webapi/alarm/index.html +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: Alarm API -slug: WebAPI/Alarm -translation_of: Archive/B2G_OS/API/Alarm_API ---- -<p>{{ SeeCompatTable() }}</p> -<h2 id="개요">개요</h2> -<p>Alarm API는 스케줄 알림, 또는 어플리케이션이 동작할 특정 시간을 설정한다. 알람 같은 어플리케이션 -시계, 달력, 자동 업데이트 등-은 특정 시간의 동작을 활성화해주는 <span style="line-height: inherit;">Alarm API가 필요하다.</span></p> -<p>알람은 시스템 메시지 API를 통해 어플리케이션으로 전달된다. 알람 메시지에 허가된 어플리케이션은 알람을 사용할 수 있다.</p> -<p>알람은 {{domxref("MozAlarmsManager")}} 인터페이스의 인스턴스 객체인 <span style="line-height: inherit;">{{domxref("window.navigator.mozAlarms")}} 로 설정한다.</span></p> -<p> </p> -<h2 id="example" name="example">알람 일정 설정하기 </h2> -<p>알람을 사용할 때는 시간 설정 부터 시작한다. 표준 시간대(타임존) 기준으로 두가지의 알람이 있지만 공통적으로 {{domxref("MozAlarmsManager.add")}} 메소드를 사용한다.</p> -<div class="note"> - <p><strong>Note:</strong> 알람이 특정 어플리케이션에 타겟팅 되지 않았다면 시스템은 알람을 기다리는 모든 어플리케이션에 신호를 전달할 것이다.</p> -</div> -<h3 id="표준_시간대를_무시하는_알람">표준 시간대를 무시하는 알람</h3> -<p>이 알람은 기기의 로컬 시간대에 맞춰 전송된다. 사용자가 시간대를 변경하면, 알람은 새로운 시간대에 맞춰 전송될 것이다. 예를 들면, 파리의 사용자가 CET <span style="line-height: inherit;">(</span><em>Central European Time</em><span style="line-height: inherit;">) 기준으로 오후 12시에 알람을 설정하다가 샌프란시스코로 이동하면 PDT </span><span style="line-height: inherit;">(</span><em>Pacific Daylight Time</em><span style="line-height: inherit;">) 기준의 오후 12시에 알람을 받는다.</span></p> -<pre class="brush: js">// 알람 일정 -var myDate = new Date("May 15, 2012 16:20:00"); - -// 알람이 울릴 때 사용할 임의의 데이터 - -var data = { - foo: "bar" -} - -// 표준시간대를 무시하도록 "ignoreTimezone" 설정 -var request = navigator.mozAlarms.add(myDate, "ignoreTimezone", data); - -request.onsuccess = function () { - console.log("The alarm has been scheduled"); -}; - -request.onerror = function () { - console.log("An error occurred: " + this.error.name); -}; -</pre> -<h3 id="표준_시간대_기준의_알람">표준 시간대 기준의 알람</h3> -<p>이 알람은 알람 일정을 정한 당시의 표준 시간에 맞춰 알람 신호가 전송된다. 사용자가 시간대를 변경하더라도 표준 시간대에 맞춰 알람이 울릴 것이다. 예를 들면, 파리의 사용자가 CET 기준 오후 12시에 설정하고 샌프란시스코로 이동한다면 PDT 기준 오전 3시에 알람이 울릴 것이다.</p> -<pre class="brush: js">// 알람 일정 -var myDate = new Date("May 15, 2012 16:20:00"); - -// 알람이 울릴 때 사용할 임의의 데이터 -var data = { - foo: "bar" -} - -// 표준 시간대를 반영한 알람을 사용하도록 "honorTimezone" 설정 -var request = navigator.mozAlarms.add(myDate, "honorTimezone", data); - -request.onsuccess = function () { - console.log("The alarm has been scheduled"); -}; - -request.onerror = function () { - console.log("An error occurred: " + this.error.name); -}; -</pre> -<h2 id="알람_관리">알람 관리 </h2> -<p>알람을 한번 생성하면 계속 관리할 수 있다.</p> -<p>{{domxref("MozAlarmsManager.getAll")}} 메소드는 현재 설정된 모든 알람 리스트를 반환한다. 이 리스트는 {{Anch("mozAlarm")}} 객체의 배열이다.</p> -<h3 id="mozAlarm">mozAlarm</h3> -<p>{{page("/en-US/docs/Web/API/MozAlarmsManager.getAll","mozAlarm")}}</p> -<pre class="brush: js">var request = navigator.mozAlarms.getAll(); - -request.onsuccess = function () { - this.result.forEach(function (alarm) { - console.log('Id: ' + alarm.id); - console.log('date: ' + alarm.date); - console.log('respectTimezone: ' + alarm.respectTimezone); - console.log('data: ' + JSON.stringify(alarm.data)); - }); -}; - -request.onerror = function () { - console.log("An error occurred: " + this.error.name); -}; -</pre> -<p>{{domxref("MozAlarmsManager.remove")}} : 알람 설정 해제</p> -<pre class="brush: js">var alarmId; - -// 알람 설정 & request 변수에 알람 id 저장 -var request = navigator.mozAlarms.add(new Date("May 15, 2012 16:20:00"), "honorTimezone"); - -request.onsuccess = function () { - alarmId = this.result.id; -} - -// ... - -// 알람 해제 -if (alarmId) { - navigator.mozAlarms.remove(alarmId); -} -</pre> -<h2 id="알람_다루기">알람 다루기 </h2> -<p>시스템이 알람 신호를 전송할 때는 모든 어플리케이션에서 받아 쓸 수 있다. 어플리케이션에서 알람을 사용하려면 알람 핸들러의 권한을 추가해야 한다. 이는, 시스템 메시징 API의 두 단계를 거치면 된다.: </p> -<p>1, <a href="/en-US/docs/Apps/Manifest#messages" title="/en-US/docs/Apps/Manifest#messages">application manifest</a> 의 message property에 <code>alarm property를 추가하고 알람 신호를 받아서 사용할 콜백 함수가 등록된 문서의 URL 경로를 입력한다.</code></p> -<pre class="brush: js">"messages": [ - { "alarm": "/index.html" } -]</pre> -<p>2. 어플리케이션에 <code>alarm</code> message에 대한 콜백 함수를 추가한다. {{domxref("window.navigator.mozSetMessageHandler","navigator.mozSetMessageHandler")}} 메소드를 사용한다. 이 콜백 함수는 알람 관련 데이터가 포함된 {{Anch("mozAlarm")}} 객체에 접근할 수 있다.</p> -<pre class="brush: js">navigator.mozSetMessageHandler("alarm", function (mozAlarm) { - alert("alarm fired: " + JSON.stringify(mozAlarm.data)); -}); -</pre> -<p>어플리케이션이 시스템 레벨에서 아직 동작하지 않은 알람의 유무를 파악하고 싶다면 {{domxref("window.navigator.mozHasPendingMessage","navigator.mozHasPendingMessage")}} 메소드의 value를 "<code>alarm"으로 설정하면 된다.</code></p> -<pre class="brush: js">navigator.mozHasPendingMessage("alarm"); -</pre> -<h2 id="명세">명세 </h2> -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('Alarm API')}}</td> - <td>{{Spec2('Alarm API')}}</td> - <td>Initial specification.</td> - </tr> - </tbody> -</table> -<h2 id="브라우저_호환">브라우저 호환</h2> -<p>{{ CompatibilityTable() }}</p> -<div id="compat-desktop"> - <table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Chrome</th> - <th>Firefox (Gecko)</th> - <th>Internet Explorer</th> - <th>Opera</th> - <th>Safari</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{ CompatUnknown()}}</td> - <td>{{CompatGeckoDesktop("16")}} {{ property_prefix("moz") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - </tbody> - </table> -</div> -<div id="compat-mobile"> - <table class="compat-table"> - <tbody> - <tr> - <th>Feature</th> - <th>Android</th> - <th>Chrome for Android</th> - <th>Firefox Mobile (Gecko)</th> - <th>IE Mobile</th> - <th>Opera Mobile</th> - <th>Safari Mobile</th> - </tr> - <tr> - <td>Basic support</td> - <td>{{ CompatUnknown() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{CompatGeckoMobile("10")}} {{ property_prefix("moz") }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - <td>{{ CompatNo() }}</td> - </tr> - </tbody> - </table> -</div> -<h2 id="관련">관련 </h2> -<ul> - <li>{{domxref("window.navigator.mozAlarms","navigator.mozAlarms")}}</li> - <li>{{domxref("MozAlarmsManager")}}</li> - <li>{{domxref("window.navigator.mozSetMessageHandler")}}</li> -</ul> diff --git a/files/ko/webapi/contacts/index.html b/files/ko/webapi/contacts/index.html deleted file mode 100644 index 277b5fb146..0000000000 --- a/files/ko/webapi/contacts/index.html +++ /dev/null @@ -1,210 +0,0 @@ ---- -title: Contacts -slug: WebAPI/Contacts -translation_of: Archive/B2G_OS/API/Contacts_API ---- -<section class="Quick_links" id="Quick_Links"> -<ol> - <li><strong><a href="/en-US/docs/Web/API/Contacts_API">Contacts API</a></strong></li> - <li data-default-state="open"><a href="#"><strong>Interfaces</strong></a> - <ol> - <li><a href="/en-US/docs/Web/API/ContactManager"><code>ContactManager</code></a></li> - <li><a href="/en-US/docs/Web/API/MozContact"><code>MozContact</code></a></li> - <li><a href="/en-US/docs/Web/API/MozContactChangeEvent"><code>MozContactChangeEvent</code></a></li> - </ol> - </li> - <li data-default-state="open"><a href="#"><strong>Properties</strong></a> - <ol> - <li><a href="/en-US/docs/Web/API/Navigator/mozContacts"><code>Navigator.mozContacts</code></a></li> - </ol> - </li> - <li data-default-state="open"><a href="#"><strong>Events</strong></a> - <ol> - <li><a href="/en-US/docs/Web/Events/success"><code>success</code></a></li> - <li><a href="/en-US/docs/Web/Events/error"><code>error</code></a></li> - <li><a href="/en-US/docs/Web/Events/contactchange"><code>contactchange</code></a></li> - </ol> - </li> -</ol> -</section> - -<div class="overheadIndicator nonStandard nonStandardHeader"> -<p><strong>Non-standard</strong><br> - This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.</p> -</div> - -<div class="warning"> -<p style="text-align: center;">This API is available on <a href="/en-US/docs/Mozilla/Firefox_OS">Firefox OS</a> for <a href="/en-US/docs/Mozilla/Firefox_OS/Security/Application_security#App_Types">privileged or certified applications</a> only.</p> -</div> - -<h2 id="요약">요약</h2> - -<p>주소록 API는 사용자 시스템의 주소록을 관리할 수 있는 간단한 인터페이스를 제공합니다. 주소록 API의 전형적인 사용 예는 주소록을 관리하는 어플리케이션을 제작하는 일입니다.</p> - -<div class="note"> -<p><strong>주의:</strong> 사용자의 연락처와 같은 개인 정보는 민감한 자료이기 때문에 권한 앱이나 인증입만이 이 API에 직접 접근할 수 있습니다. 다른 어플리케이션은 <a href="/ko/docs/WebAPI/Web_Activities" title="/ko/docs/WebAPI/Web_Activities">Web Activities</a>를 사용해서 연락처에 접근하는 작업을 수행하게 하는 일을 권장합니다.</p> -</div> - -<h2 id="연락처_관리">연락처 관리</h2> - -<p>시스템의 주소록에 저장된 연락처는 {{domxref("window.navigator.mozContacts","navigator.mozContacts")}} 속성을 통해서 접근할 수 있습니다. 이 속성은 {{domxref("ContactManager")}} 인터페이스의 인스턴스입니다.</p> - -<h3 id="연락처_추가">연락처 추가</h3> - -<p>시스템의 주소록에 새로운 항목을 추가하는 일은 두가지 단계를 거칩니다:</p> - -<ol> - <li>필요한 속성이 담긴 새로운 {{domxref("mozContact")}} 객체와 필드 인스턴스를 만듭니다. {{domxref("mozContact")}} 인터페이스는 추가할 연락처의 모든 가능한 속성을 정의하고 있습니다. 이 속성들은 대부분 아래에 나온 예외를 제외하고 vCard 4.0 명세의 내용과 거의 비슷합니다: - <ul> - <li>vCard N 속성은 다음 5개의 속성으로 나눠졌습니다: {{domxref("mozContact.familyName","familyName")}}, {{domxref("mozContact.givenName","givenName")}}, {{domxref("mozContact.additionalName","additionalName")}}, {{domxref("mozContact.honorificPrefix","honorificPrefix")}}, {{domxref("mozContact.honorificSuffix","honorificSuffix")}}</li> - <li>vCard FN 속성은 {{domxref("mozContact.name","name")}}으로 이름이 변경되었습니다.</li> - <li>vCard GENDER 속성은 다음 2개의 속성으로 나눠졌습니다: {{domxref("mozContact.sex","sex")}}, {{domxref("mozContact.genderIdentity","genderIdentity")}}</li> - </ul> - </li> - <li>연락처 객체를 첫번째 파라메터로 해서 {{domxref("ContactManager.save()")}} 메서드를 사용합니다. 이 메서드는 {{domxref("DOMRequest")}}를 반환해서 성공 여부를 확인할 수 있게 해줍니다.</li> -</ol> - -<pre class="brush: js">var person = new mozContact(); -person.givenName = ["John"]; -person.familyName = ["Doe"]; -person.nickName = ["No kidding"]; - -var saving = navigator.mozContacts.save(person); - -saving.onsuccess = function() { - console.log('new contact saved'); - // This update the person as it is stored - // It includes its internal unique ID - // Note that saving.result is null here -}; - -saving.onerror = function(err) { - console.error(err); -}; -</pre> - -<h3 id="연락처_찾기">연락처 찾기</h3> - -<p>시스템의 주소록에서 연락처를 가져오는 두개의 메서드가 있습니다:</p> - -<ul> - <li>특정 목록을 가져오기 위해서는 {{domxref("ContactManager.find()")}}를 사용합니다.</li> - <li>모든 연락처를 가져오기 위해서는 {{domxref("ContactManager.getAll()")}}를 사용합니다.</li> -</ul> - -<p>두 메서드는 필터와 정렬 옵션을 정의하는 객체를 파라메터로 사용합니다. {{domxref("ContactManager.getAll")}}은 정렬 옵션만을 사용합니다. 이 옵션은 다음과 같습니다:</p> - -<ul> - <li><code>sortBy</code>: 검색 결과가 정렬될 필드를 나타내는 문자열입니다. 현재는 givenName과 familyName 만 지원합니다.</li> - <li><code>sortOrder</code>: 결과의 정렬 순서를 나타내는 문자열입니다. <code>descending</code>과 <code>ascending</code>을 사용할 수 있습니다.</li> -</ul> - -<p>필터 옵션은 다음과 같습니다:</p> - -<ul> - <li><code>filterBy</code>: 필터가 적용될 필드를 나타내는 문자열의 배열입니다.</li> - <li><code>filterValue</code>: 대조할 값을 나타냅니다.</li> - <li><code>filterOp</code>: 사용할 필터 비교 연산입니다. 가능한 값으로는 equals, startsWith, match가 있습니다. 후자는 특정 전화번호를 나타냅니다.</li> - <li><code>filterLimit</code>: {{domxref("ContactManager.find()","find")}} 메서드로 가져올 연락처의 갯수입니다.</li> -</ul> - -<p>{{domxref("ContactManager.find","find")}}는 {{domxref("DOMRequest")}} 객체를 반환하고 {{domxref("ContactManager.getAll","getAll")}}는 {{domxref("DOMCursor")}} 객체를 반환해서 검색의 성공 실패 여부를 확인할 수 있습니다.</p> - -<p>검색이 성공적으로 완료되면 검색 결과는 {{domxref("DOMRequest.result")}} 속성을 통해서 사용할 수 있고 {{domxref("ContactManager.find","find")}}의 경우에는 {{domxref("mozContact")}} 객체의 배열이, {{domxref("ContactManager.getAll","getAll")}}의 경우에는 하나의 {{domxref("mozContact")}} 객체가 반환됩니다. {{domxref("ContactManager.getAll","getAll")}}에서 다음 결과를 사용하려면 커서의 <code>continue()</code> 메서드를 사용합니다.</p> - -<pre class="brush: js">var options = { - filterValue : "John", - filterBy : ["givenName","name","nickName"], - filterOp : "contains", - filterLimit : 1, - sortBy : "familyName" - sortOrder : "ascending" -} - -var search = navigator.mozContacts.find(options); - -search.onsuccess = function() { - if (search.result.length === 1) { - var person = search.result[0]; - console.log("Found:" + person.givenName[0] + " " + person.familyName[0]); - } else { - console.log("Sorry, there is no such contact.") - } -} - -search.onerror = function() { - console.warn("Uh! Something goes wrong, no result found!"); -} - -var allContacts = navigator.mozContacts.getAll({sortBy: "familyName", sortOrder: "descending"}); - -allContacts.onsuccess = function(event) { - var cursor = event.target; - if (cursor.result) { - console.log("Found: " + cursor.result.givenName[0] + " " + cursor.result.familyName[0]); - cursor.continue(); - } else { - console.log("No more contacts"); - } -} - -allContacts.onerror = function() { - console.warn("Something went terribly wrong! :("); -} -</pre> - -<h3 id="연락처_수정">연락처 수정</h3> - -<p>{{domxref("ContactManager.find()","find()")}}나 {{domxref("ContactManager.getAll()","getAll()")}}(또는 새 연락처를 {{domxref("ContactManager.save()","save()")}}로 성공적으로 저장한 후)로 연락처를 가져오면 이 연락처에는 몇가지 메타데이터가 붙습니다:</p> - -<ul> - <li>{{domxref("mozContact.id")}}로 사용할 수 있는 유일한 ID 값</li> - <li>마지막으로 연락처가 수정된 시각을 나타내는 {{domxref("mozContact.updated")}}의 <a href="/ko/docs/JavaScript/Reference/Global_Objects/Date" title="/ko/docs/JavaScript/Reference/Global_Objects/Date">Date</a> 객체</li> -</ul> - -<p>연락처를 수정하기 위해서는 속성값을 변경한 다음에 {{domxref("ContactManager.save()","save()")}} 메서드를 사용해서 저장하면 됩니다.</p> - -<div class="note"> -<p><strong>주의:</strong> 연락처가 추가되거나 수정, 삭제되면 {{event("contactchange")}} 이벤트가 발생하고 이를 통해 시스템 주소록의 변경사항을 추적할 수 있습니다. 이 이벤트는 {{domxref("ContactManager.oncontactchange")}} 속성을 이용해서 다룰 수 있습니다.</p> -</div> - -<h3 id="연락처_삭제">연락처 삭제</h3> - -<p>{{domxref("ContactManager.remove()")}} 메서드를 사용해서 간단하게 전달된 {{domxref("mozContact")}} 객체를 삭제할 수 있습니다.</p> - -<p>특수한 경우에는 모든 연락처 정보를 삭제할 수도 있습니다. {{domxref("ContactManager.clear()")}}를 사용하면 됩니다. 이 메서드를 사용할 때에는 특히 주의해야 합니다. 다시 되돌릴 수 있는 방법이 없습니다.</p> - -<h2 id="Specifications" name="Specifications">명세</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{ SpecName('Contacts', '', 'Contacts Manager API') }}</td> - <td>{{ Spec2('Contacts') }}</td> - <td>First Working Draft (unstable)</td> - </tr> - <tr> - <td><a href="http://tools.ietf.org/html/rfc6350" title="http://tools.ietf.org/html/rfc6350">vCard Format Specification</a></td> - <td>RFC</td> - <td><code>RFC6350</code></td> - </tr> - </tbody> -</table> - -<h2 id="브라우저_호환성">브라우저 호환성</h2> - -<h2 id="참고_자료">참고 자료</h2> - -<ul> - <li>{{domxref("window.navigator.mozContacts","navigator.mozContacts")}}</li> - <li>{{domxref("mozContact")}}</li> - <li>{{domxref("ContactManager")}}</li> - <li>{{domxref("MozContactChangeEvent")}}</li> -</ul> diff --git a/files/ko/webapi/idle/index.html b/files/ko/webapi/idle/index.html deleted file mode 100644 index eeb10abccf..0000000000 --- a/files/ko/webapi/idle/index.html +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: Idle API -slug: WebAPI/Idle -translation_of: Archive/B2G_OS/API/Idle_API ---- -<div> - {{non-standard_header}} {{B2GOnlyHeader2('certified')}}</div> -<h2 id="Summary">Summary</h2> -<p>Idle API 는 사용자가 유휴상태(idle) 상태가 되었음을 앱에 알려주는데 사용됩니다.</p> -<p>이것은 사용자가 자신의 디바이스에 아무것도 하지 않을 때에 앱이 동작을 취할 수 있게 해줍니다. 가장 많이 사용하는 경우는 배터리를 아끼기 위한 것으로 이 경우 보통 <a href="/en-US/docs/WebAPI/Power_Management">Power Management API</a> 와 함께 사용됩니다.</p> -<h2 id="유휴_상태의_사용자_관찰하기">유휴 상태의 사용자 관찰하기</h2> -<p>시스템이 유휴상태일 때 어플리케이션으로 부터 알림을 받기 위해서는 <strong>idle observer</strong>에 꼭 등록을 하여야 한다. idle observer는 세가지 특성을 가지고 있는 오브젝트이다:</p> -<ul> - <li><code>time</code>은 사용자의 마지막 동작 이후부터 유휴 상태라고 여길때까지의 시간(초)을 정의한다.</li> - <li><code>onidle</code>은 사용자가 유휴 상태라고 여겨질 때 함수를 호출한다.</li> - <li><code>onactive</code>는 사용자가 유휴 상태였다가 활성화 되었을 때 함수를 호출한다.</li> -</ul> -<h3 id="예제_사용자가_반응이_없을때_화면을_어둡게_하기">예제: 사용자가 반응이 없을때 화면을 어둡게 하기</h3> -<p>이 예제에서, 10초 동안 사용자의 반응이 없을 때 유휴 관찰자(=idle observer)는 화면을 50% 밝기로 어둡게 한다 그리고 다시 사용자의 반응이 나타나면 100% 밝기로 돌려 놓는다. 두번째 유휴 관찰자 는 15초 동안 사용자 반응이 없을때 화면을 꺼 버린다.</p> -<pre class="brush: js">// NOTE: mozPower is part of the Power Management API - -var fadeLight = { - time: 10, // Ten seconds - - onidle: function () { - // The user does not seem active, let's dim the screen down - navigator.mozPower.screenBrightness = 0.5; - }, - - onactive: function () { - // Ok, the user is back, let's brighten the screen up - navigator.mozPower.screenBrightness = 1; - } -} - -var screenOff = { - time: 15, // fifteen seconds - - onidle: function () { - // Ok, the user had his chance but he's really idle, let's turn the screen off - navigator.mozPower.screenEnabled = false; - }, - - onactive: function () { - // Ok, the user is back, let's turn the screen on - navigator.mozPower.screenEnabled = true; - } -} - -// Register the idle observers - -navigator.addIdleObserver(fadeLight); -navigator.addIdleObserver(screenOff); -</pre> -<p>이 코드에는 <code>fadeLight</code> 와 <code>screenOff 라는 두 유휴 관찰자를 정의한뒤</code>, <span style="line-height: inherit;">시스템에 등록하기 위하여 각각 </span><span style="line-height: inherit;">{{domxref("window.navigator.addIdleObserver","navigator.addIdleObserver()")}} 를 한번씩 호출한다. 어플리케이션은 필요한 만큼에 유휴 관찰자를 등록할 수 있다.</span></p> -<p>만약 어플리케이션에서 사용자의 반응이 없어지는지 더이상 관찰이 필요 없는 경우, 아래 예제 코드의 예처럼 유휴 관찰자를{{domxref("window.navigator.removeIdleObserver","navigator.removeIdleObserver()")}} 메서드를 통해 제거할 수 있다.</p> -<pre class="brush:js">navigator.removeIdleObserver(fadeLight); -navigator.removeIdleObserver(screenOff); -</pre> -<h2 id="Specification">Specification</h2> -<p>Not part of any specification yet; however, this API will be discussed at W3C as part of the <a href="http://www.w3.org/2012/sysapps/" rel="external">System Applications Working Group</a>.</p> -<h2 id="See_also">See also</h2> -<ul> - <li>{{domxref("window.navigator.addIdleObserver","navigator.addIdleObserver()")}}</li> - <li>{{domxref("window.navigator.removeIdleObserver","navigator.removeIdleObserver()")}}</li> -</ul> diff --git a/files/ko/webapi/power_management/index.html b/files/ko/webapi/power_management/index.html deleted file mode 100644 index b96447b466..0000000000 --- a/files/ko/webapi/power_management/index.html +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Power Management -slug: WebAPI/Power_Management -translation_of: Archive/B2G_OS/API/Power_Management_API ---- -<p>{{ non-standard_header() }}</p> -<p>{{ B2GOnlyHeader2('certified') }}</p> -<h2 id="요약">요약</h2> -<p>전력 관리 API는 기기의 전력 소모를 관리하는 도구를 제공합니다.</p> -<h2 id="전력_관리">전력 관리</h2> -<p>전력 관리는 과도한 연산이나 화면을 다시그리는 등과 같은 실제 전력과는 조금 다릅니다. 이 모든 것이 다 전력 관리에 들어가게 됩니다. 하지만 전력 관리 API는 직접적인 전력 소모(화면, CPU 등)에 보다 집중합니다. 전력 관리에 대한 주요 인터페이스는 {{domxref("PowerManager")}} 인터페이스의 인스턴스인 {{domxref("window.navigator.mozPower","navigator.mozPower")}}를 통해서 접근합니다.</p> -<h3 id="기본_전력_처리">기본 전력 처리</h3> -<p>{{domxref("PowerManager")}} 인터페이스는 기본 전력 처리 인터페이스를 제공합니다.</p> -<h4 id="전역_전력_처리">전역 전력 처리</h4> -<p>{{domxref("PowerManager.powerOff()","powerOff()")}} 메서드를 사용해서 아주 쉽게 기기의 전원을 끌 수 있고 {{domxref("PowerManager.reboot()","reboot()")}} 메서드를 통해서는 재부팅도 할 수 있습니다.</p> -<pre class="brush: js">navigator.mozPower.powerOff();</pre> -<h4 id="화면_전력_처리">화면 전력 처리</h4> -<p>화면은 읽기/쓰기 속성인 {{domxref("PowerManager.screenEnabled","screenEnabled")}}를 이용해서 켜고 끌 수 있습니다. 또한 화면의 밝기도 변경할 수 있습니다. 읽기/쓰기 속성인 {{domxref("PowerManager.screenBrightness","screenBrightness")}}를 이용해서 변경할 수 있고 0(아주 어두움)에서 1(최대 밝기)까지의 값을 이용해서 화면의 백라이트 밝기를 설정할 수 있습니다.</p> -<pre class="brush: js">// It doesn't make sense to change the brightness if the screen is off -if (navigator.mozPower.screenEnabled) { - navigator.mozPower.screenBrightness = 0.5; -}</pre> -<h4 id="CPU_전력_처리">CPU 전력 처리</h4> -<p>CPU를 직접 끄는 일은 가능하지 않지만 화면이 꺼져 있을 때에는 CPU가 꺼져도 되는지 아닌지를 알릴 수 있습니다. 이는 {{domxref("PowerManager.cpuSleepAllowed","cpuSleepAllowed")}}를 이용해서 설정할 수 있습니다. 이는 기기의 CPU가 화면이 꺼지거나(<code>true</code>) 켜져 있을(<code>false</code>) 때 잠자기 모드로 들어갈 수 있는지를 결정합니다; 화면이 켜져있다면 정지모드로 들어가지 않게 합니다.</p> -<h3 id="향상된_전력_처리">향상된 전력 처리</h3> -<p>전력 관리는 전력을 다루는 어플리케이션이 다른 어플리케이션의 요청에 대해 알림을 받을 수 있다면 더 잘 다뤄질 수 있습니다. 예를 들어서 사용자가 동영상을 보고 있다면 몇 초 후에 화면을 자동으로 끄지 않는 것이 더 좋을 수 있습니다.</p> -<h4 id="잠금_해제_요청">잠금 해제 요청</h4> -<p>어떤 어플리케이션이든 잠금 해체를 요청할 수 있습니다. 잠금 해제는 기기의 자원이 꺼지지 않도록 요청하는 방법입니다. 잠금 해체는 {{domxref("window.navigator.requestWakeLock","navigator.requestWakeLock()")}} 메서드를 통해서 요청됩니다.</p> -<p>잠금 해제는 다양한 이유로 사용할 수 없게 되는 특정 자원에 대한 요청입니다. 예를 들어서 모바일 기기의 전력 관리 기능은 전력 소모를 줄이기 위해서 어느정도 사용을 안하고 있으면 화면을 끕니다. 그 자원을 사용하는 어플리케이션은 자원이 꺼지기 전에 자원의 잠금 상태를 확인합니다. 예를 들어서 페이지는 화면 보호기가 나타나거나 화면이 꺼지는 것을 막기 위해서 <code>screen</code>에 대한 잠금을 막을 수 있습니다.</p> -<p>기본 설정으로 Firefox OS는 <code>screen</code>과 <code>cpu</code>, <code>wifi</code> 자원에 대한 잠금 허용을 합니다. 하지만 자원을 다루는 어떤 어플리케이션도 자원의 이름을 설정하고 잠금에 대한 정책을 정할 수 있습니다. 예를 들어서 자원 관리 기능은 현재 보이지 않는 어플리케이션이 <code>screen</code>에 대한 설정한 잠금 해제를 무시할 수 있습니다.</p> -<pre class="brush: js">var lock = navigator.requestWakeLock('screen');</pre> -<p>{{domxref("window.navigator.requestWakeLock","requestWakeLock")}} 메서드는 잠금을 할 자원의 이름을 나타내는 <code>topic</code> 속성을 가지고 있는 객체를 반환합니다. <code>unlock()</code> 메서드는 잠금을 수동으로 반환하는데 사용합니다. 어플리케이션이 종료(대기 상태가 아닌 실제 종료)된다면 자동으로 모든 잠금 요청이 해제됩니다.</p> -<h4 id="잠금_해제_다루기">잠금 해제 다루기</h4> -<p>잠금을 관리할 수 있는 인증된 애플리케이션은 잠금 상태가 변경되게 되면 알림을 받습니다. 실제로 전력을 관리하고자 하는 모든 애플리케이션은 <code>screen</code>과 <code>cpu</code>의 잠금 상태를 추적하고 있어야 합니다. 이는 {{domxref("PowerManager.addWakeLockListener()")}} 메서드를 통해 이루어집니다({{domxref("PowerManager.removeWakeLockListener()","")}} 메서드를 이용해서 잠금 요청에 대한 추적을 멈출 수 있습니다).</p> -<p>{{domxref("PowerManager.addWakeLockListener()","addWakeLockListener")}} 메서드에는 두개의 파라메터를 전달 받는 콜백함수를 전달해야 합니다: 첫번째 문자열은 다룰 자원(여기서는 <code>screen</code>이나 <code>cpu</code>)을 나타내고 두번째 문자열은 잠금 상태를 나타냅니다.</p> -<p>잠김은 세가지 상태가 있습니다:</p> -<dl> - <dt> - <code>unlocked</code></dt> - <dd> - 주어진 자원에 대해 잠금 해제를 할 수 없습니다.</dd> - <dt> - <code>locked-foreground</code></dt> - <dd> - 최소한 하나의 어플리케이션이 잠금 해제를 제어 할 수 있고 그 어플리케이션은 보이는 상태입니다..</dd> - <dt> - <code>locked-background</code></dt> - <dd> - 최소한 하나의 어플리케이션이 잠금 해제를 제어하지만 모든 애플리케이션이 보이지 않는 상태입니다.</dd> -</dl> -<pre class="brush: js">// This is used to keep track of the last change on the lock state -var screenTimeout; - -// A reference to the Power Manager -var power = window.navigator.mozPower; - -// Here are the actions to handle based on the lock state -var powerAction = { - - // If there is no lock at all, we will suspend the device: - // * Turn the screen off - // * Allow the cpu to shut down - unlocked: function suspendDevice() { - power.cpuSleepAllowed = true; - power.screenEnabled = false; - }, - - // If there is a lock but the applications requesting it - // are all in the background, we just turn the screen off - 'locked-background': function shutOffOnlyScreen() { - power.cpuSleepAllowed = false; - power.screenEnabled = false; - }, - - // At last, if there is an active application that requests a lock, - // actually there is nothing to do. That's the whole point. -} - -function screenLockListener(topic, state) { - // If the lock is not about the screen, there is nothing to do. - if ('screen' !== topic) return; - - // Each time the lock changes state, we stop any pending power management operations - window.clearTimeout(screenTimeout); - - // If there is an action defined for the given state - if (powerAction[state]) { - // We delay that action by 3s - screenTimeout = window.setTimeout(powerAction[state], 3000); - } -} - -// We make sure our power management application is listening for any change on locks. -power.addWakeLockListener(screenLockListener);</pre> -<h2 id="Specification" name="Specification">명세</h2> -<p>관련된 명세가 없습니다.</p> -<h2 id="관련_내용">관련 내용</h2> -<ul> - <li>{{ domxref("window.navigator.mozPower","navigator.mozPower") }}</li> - <li>{{ domxref("PowerManager") }}</li> - <li>{{ domxref("window.navigator.requestWakeLock()","navigator.requestWakeLock()") }}</li> -</ul> diff --git a/files/ko/webapi/simple_push/index.html b/files/ko/webapi/simple_push/index.html deleted file mode 100644 index 0ff0fe3602..0000000000 --- a/files/ko/webapi/simple_push/index.html +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: Simple Push -slug: WebAPI/Simple_Push -translation_of: Archive/B2G_OS/API/Simple_Push_API ---- -<p>{{ draft() }}{{ SeeCompatTable() }}</p> -<p><a href="https://wiki.mozilla.org/WebAPI/SimplePush" title="https://wiki.mozilla.org/WebAPI/SimplePush">Simple Push API</a>, 다른 이름으로 푸시 알림 API는 알림을 받으면 앱이 깨어나는 기능을 제공한다. 앱은 서버와 공유할 수 있는 URI를 요청할 수 있는데, 다시 말해 앱에 전달될 버전 번호를 보낼 수 있다는 뜻이다. 이 기능은 동기화 메카니즘으로 사용될 수도 있고, 서드 파티 서버에서 최신 데이터를 가져오기 위해 쓸 수도 있다.</p> -<p>심플푸시 API는 {{domxref("PushManager")}} 객체인 <code>push 속성을 가지고</code> {{domxref("window.navigator")}} 객체를 확장하고, 푸시 상태를 감지하기 위해 받을 수 있는 새 이벤트를 더한다.</p> -<h2 id="예제">예제</h2> -<p>이 예제는 푸시의 전체 설정을 다룬다. 다음 단계를 따라하자.</p> -<ol> - <li>앱의 매니페스트 파일에 <code>push</code>를 허용하는 상태로 더한다.</li> - <li>endpoint를 요청하기 위해 <code>push.register()</code>를 호출한다.</li> - <li>endpoint를 서버에 보낸다.</li> - <li>앱 내부의 푸시 알림을 위한 메시지 핸들러를 더한다.</li> - <li>서버에서 알림을 보낸다..</li> -</ol> -<h3 id="매니페스트_파일_변경">매니페스트 파일 변경</h3> -<p>매니페스트 파일에서 두 가지를 수정한다.</p> -<ol> - <li><a href="/docs/Web/Apps/Manifest#messages" title="https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest?redirectlocale=en-US&redirectslug=Apps%2FManifest#messages"><code>messages</code> field</a> - <code>push와</code> <code>push-register</code> 메시지를 더한다.</li> - <li><a href="/docs/Web/Apps/Manifest#permissions" title="https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest?redirectlocale=en-US&redirectslug=Apps%2FManifest#permissions"><code>permissions</code> field</a> - 푸시 알림을 받기 원하는 앱에 더한다.</li> -</ol> -<pre><span class="s2">"messages"</span><span class="o">:</span> <span class="cp">[</span> - <span class="p">{</span> <span class="s2">"push"</span><span class="p">:</span> <span class="s2">"/index.html"</span><span class="p">},</span> - <span class="p">{</span> <span class="s2">"push-register"</span><span class="p">:</span> <span class="s2">"/index.html"</span><span class="p">}</span> -<span class="cp">]</span><span class="o">,</span> -<span class="s2">"permissions"</span><span class="o">:</span> <span class="p">{</span> - <span class="s2">"push"</span><span class="o">:</span> <span class="err">{ - </span>"description": "Required for be updated with new goals in soccer matchs",<span class="err"> -</span><span class="p"> }</span> -<span class="err">}</span></pre> -<h3 id="endpoint_요청을_위한_domxref(PushManager.register)_호출">endpoint 요청을 위한 {{domxref("PushManager.register")}} 호출</h3> -<p>이 코드는 endpoint를 요청할 시간인지 결정할 때 호출해야 한다. 예를 들어 사용자가 로그인 할 때나 축구 경기를 관전하기 시작할 때를 들 수 있다.</p> -<pre><span class="k">if</span> <span class="p">(</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">push</span><span class="p">)</span> <span class="p">{</span> - <span class="kd">var</span> <span class="nx">req</span> <span class="o">=</span> <span class="nx">navigator</span><span class="p">.</span><span class="nx">push</span><span class="p">.</span><span class="nx">register</span><span class="p">();</span> - - <span class="nx">req</span><span class="p">.</span><span class="brush: js">onsuccess</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span> - <span class="kd">var</span> <span class="nx">endpoint</span> <span class="o">=</span> <span class="nx">req</span><span class="p">.</span><span class="nx">result</span><span class="p">;</span> - <span class="nx">debug</span><span class="p">(</span><span class="s2">"New endpoint: "</span> <span class="o">+</span> <span class="nx">endpoint</span> <span class="p">);</span> - <span class="p">}</span> - - <span class="nx">req</span><span class="p">.</span><span class="nx">onerror</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span> - <span class="nx">debug</span><span class="p">(</span><span class="s2">"Error getting a new endpoint: "</span> <span class="o">+</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">e</span><span class="p">));</span> - <span class="p">}</span> -<span class="p">}</span> <span class="k">else</span> <span class="p">{</span> - <span class="c1">// No push on the DOM</span> -<span class="p">}</span></pre> -<h3 id="endpoint를_서버에_보내기">endpoint를 서버에 보내기</h3> -<p>endpoint를 갖게 되면, 어플리케이션 서버에 보내야 한다. 한 가지 방법만 있는 건 아닌데, 선호하는 방법으로 할 수 있으므로, 예를 들어 이메일을 보내거나 <code>POST</code>, <code>PUT</code>이나 <code>GET</code> 방식을 사용할 수도 있다. 추천하는 방법은 어플리케이션에서 사용자 데이터와 함께 endpoint를 저장하는 방식으로, 쿠키, 사용자 이름같이 endpoint와 사용자 쌍을 식별하는데 사용할 수 있다면 무엇이든 좋다.</p> -<p>하지만 서버에 보낸다면, 다음의 좋은 사례를 따르기를 권한다.</p> -<ol> - <li>XMLHttpRequest로 보낸다.</li> - <li>항상 HTTPS를 사용한다. 누군가 endpoint를 가로채면, 앱에 알림을 보낼 수 있다.</li> - <li>쿠키와 같이, endpoint에 사용자(또는 어플리케이션 설치)와 맞춰볼 수 있는 무언가를 사용한다.</li> -</ol> -<h3 id="메시지_핸들러_더하기">메시지 핸들러 더하기</h3> -<p>endpoint를 설정하면, 앱이 푸시 메시지를 들을 준비가 된다. <code>index.html</code> 파일이나 <code>main.js 스크립트에 등록할 수 있는데</code>, 스크립트만 있다면 특정<code> push-message.html 파일이 될 수도 있다.</code> 이 방식은 <code>push 메시지를 받고 앱이 종료하는 경우 유용한데,</code>HTML/자바스크립트 코드의 작은 부분만 로드한 상태로 앱이 완전히 열릴지 혹은 백그라운드에서 어떤 작업을 할지 결정할 수 있기 때문이다.</p> -<pre><span class="k">if</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">mozSetMessageHandler</span><span class="p">)</span> <span class="p">{</span> - <span class="nb">window</span><span class="p">.</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">mozSetMessageHandler</span><span class="p">(</span><span class="s1">'push'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span> - <span class="nx">debug</span><span class="p">(</span><span class="s1">'My endpoint is '</span> <span class="o">+</span> <span class="nx">e</span><span class="p">.</span><span class="nx">pushEndpoint</span><span class="p">);</span> - <span class="nx">debug</span><span class="p">(</span><span class="s1">'My new version is '</span> <span class="o">+</span> <span class="nx">e</span><span class="p">.</span><span class="nx">version</span><span class="p">);</span> - <span class="c1">//Remember that you can handle here if you have more than</span> - <span class="c1">//one pushEndpoint</span> - <span class="k">if</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">pushEndpoint</span> <span class="o">===</span> <span class="nx">emailEndpoint</span><span class="p">)</span> <span class="p">{</span> - <span class="nx">emailHandler</span><span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">version</span><span class="p">);</span> - <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">pushEndpoint</span> <span class="o">===</span> <span class="nx">imEndpoint</span><span class="p">)</span> <span class="p">{</span> - <span class="nx">imHandler</span><span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">version</span><span class="p">);</span> - <span class="p">}</span> - <span class="p">});</span> -<span class="p">}</span> <span class="k">else</span> <span class="p">{</span> - <span class="c1">// No message handler</span> -<span class="p">}</span></pre> -<h3 id="알림_보내기">알림 보내기</h3> -<p>서버에 <code>endpoint</code>를 가지면, 알림을 보내는 작업은 body에 <code>version=<version></code>를 가지고 endpoint에 <code>HTTP PUT</code> 요청을 보내는 일만큼 쉽다. 다음과 같이 URL을 갖는 endpoint를 가정하자.</p> -<p><code>https://push.src.openwebdevice.com/v1/notify/abcdef01234567890abcdefabcdef01234567890abcdef</code></p> -<p>그리고 버전은 5이다.</p> -<p><code>version=5</code></p> -<p>컬로 다음 명령을 내리자.</p> -<p><code>curl -X PUT -d "version=5" https://push.src.openwebdevice.com/v1/notify/abcdef01234567890abcdefabcdef01234567890abcdef</code></p> -<p>서버가 올바르게 동작하면, <code>200 Status (OK)</code>와 <code>{}</code>인 body를 응답으로 받게 된다. 그렇지 않으면, 오류를 설명하는 유효한 JSON 객체를 받게 된다.</p> -<p>버전은 정수이고 증가한다는 점을 기억하자. 어플리케이션은 새로운 버전이 서버나 단말기에 저장된 버전보다 낮으면 알림을 <em>받지 않는다</em>.</p> -<h2 id="Specifications">Specifications</h2> -<p>{{page("/en-US/docs/Web/API/PushManager","Specifications")}}</p> -<h2 id="Browser_compatibility">Browser compatibility</h2> -<p>{{page("/en-US/docs/Web/API/PushManager","Browser_compatibility")}}</p> -<h2 id="See_also">See also</h2> -<ul> - <li>{{domxref("PushManager")}}</li> - <li>{{domxref("window.navigator.push","navigator.push")}}</li> - <li><a href="https://github.com/frsela/pushJSlibrary" title="https://github.com/frsela/pushJSlibrary">pushJSLibrary, a push shim for browsers that do not implement the API</a></li> -</ul> diff --git a/files/ko/webapi/time_and_clock/index.html b/files/ko/webapi/time_and_clock/index.html deleted file mode 100644 index 808dbc7ffc..0000000000 --- a/files/ko/webapi/time_and_clock/index.html +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: 시간과 시계 -slug: WebAPI/Time_and_Clock -translation_of: Archive/B2G_OS/API/Time_and_Clock_API ---- -<p>{{ non-standard_header() }}</p> -<p>{{ B2GOnlyHeader2('certified') }}</p> -<h2 id="요약">요약</h2> -<p>Time/Clock API로 시스템 시간을 쉽게 바꿀 수 있습니다.</p> -<h2 id="개요">개요</h2> -<p><span style="line-height: inherit;">이 API는 {{domxref("window.navigator.mozTime","navigator.mozTime")}} </span><span style="line-height: inherit;">을 통해 리턴되는, {{domxref("MozTimeManager")}} </span><span style="line-height: inherit;">객체를 통해 접근할 수 있습니다. 해당 객체는 하나의 {{domxref("MozTimeManager.set()","set()")}} </span><span style="line-height: inherit;">메서드를 가지고 있습니다.</span></p> -<p><span style="line-height: inherit;">{{domxref("MozTimeManager.set()","set()")}} 메서드는 시스템 시간을 변경하는데 이용됩니다. 파라미터로는 숫자(=Number) 객체 또는 Date 객체가 사용됩니다. 만약 숫자 객체가 사용된다면 해당 숫자는 UTC 1970년 1월 1일 부터의 밀리초를 의미합니다.</span></p> -<p>시간이 변경될 때마다 이벤트가 발생하게 됩니다. 이 이벤트는 window 객체에서 {{domxref("EventTarget.addEventListener","addEventListener")}} 메서드 를 통해(이벤트명은 {{event("moztimechange")}}) 처리하거나, 또는 {{domxref("window.onmoztimechange")}} 속성에 이벤트 핸들러를 연결함으로써 처리할 수 있습니다.</p> -<div class="note"> - <p><strong>주:</strong> 기기의 시간대는 <a href="https://developer.mozilla.org/en-US/docs/WebAPI/Settings" title="https://developer.mozilla.org/en-US/docs/WebAPI/Settings">Settings API</a>로 바꿔야 합니다.</p> -</div> -<h2 id="예시">예시</h2> -<pre class="brush: js">function setTime(time) { - navigator.mozTime.set(time); -} - -window.addEventListener('moztimechange', function () { - console.log('시간이 바뀜'); -}); - -setTime(new Date()); -</pre> -<h2 id="표준">표준</h2> -<p>어느 표준에도 들어있지 않음</p> diff --git a/files/ko/webapi/webfm_api/index.html b/files/ko/webapi/webfm_api/index.html deleted file mode 100644 index 4dcda50760..0000000000 --- a/files/ko/webapi/webfm_api/index.html +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: WebFM API -slug: WebAPI/WebFM_API -translation_of: Archive/B2G_OS/API/WebFM_API ---- -<p>{{ non-standard_header() }}</p> -<p>{{ B2GOnlyHeader2('installed') }}</p> -<h2 id="요약">요약</h2> -<p>WebFM API를 이용하면 FM 라디오를 사용할 수 있습니다. 라디오를 켜고, 끄거나 라디오 방송국을 변경 할 수 있습니다. {{domxref("FMRadio")}} 객체의 {{domxref("window.navigator.mozFMRadio","navigator.mozFMRadio")}} 속성을 통해 사용할 수 있습니다.</p> -<h2 id="라디오_켜기끄기">라디오 켜기/끄기</h2> -<p>기본적으로 {{domxref("FMRadio.enable()")}} 메소드로 라디오를 켜고, {{domxref("FMRadio.disable()")}} 메소드로 라디오를 끌 수 있습니다.</p> -<p>라디오를 켜기 전에 안테나 사용 가능 여부를 체크하는 것이 좋습니다(안테나가 없으면 내장된 라디오가 신호를 받을 수 없습니다). {{domxref("FMRadio.antennaAvailable")}} 속성으로 안테나 사용 가능 여부를 확인할 수 있습니다. 모바일 기기에서는 헤드폰 케이블이 안테나 역할을 하는데, 헤드폰 케이블 연결 상태에 따라 안테나 사용 여부가 변경되면 {{event("antennaavailablechange")}} 이벤트가 발생됩니다.<br> - <br> - 라디오를 켜기 위해서 주파수 번호(MHz 단위)를 {{domxref("FMRadio.enable()")}} 메소드에 넘겨 실행합니다.</p> -<pre class="brush: js">// The frequency of the radio station -// to listen express in MHz -var frequency = 99.1; -var radio = navigator.mozFMRadio; - -if (radio.antennaAvailable) { - radio.enable(frenquency); -} else { - alert("You need to plug your headphone"); -} - -radio.addEventListener('antennaavailablechange', function () { - if (radio.antennaAvailable) { - radio.enable(frenquency); - } else { - radio.disable(); - } -}) -</pre> -<div class="note"> - <p><strong>Note:</strong> The audio is output through the <code>normal</code> audio channel available on the device.</p> -</div> -<h2 id="주파수_변경하기">주파수 변경하기</h2> -<p>주파수는 직접 또는 자동으로 변경할 수 있습니다. 현재 내장 라디오의 주파수는 {{domxref("FMRadio.frequency")}} 속성으로 알 수 있으며 해당 속성 값은 MHz 단위의 숫자로 표현합니다.</p> -<h3 id="직접_변경하기">직접 변경하기</h3> -<p>{{domxref("FMRadio.setFrequency()")}} 메소드는 새로운 주파수를 할당할 때 사용합니다. 설정할 수 있는 주파수는 제한적입니다. 메소드 호출 후 성공 또는 실패 상황을 제어하는 {{domxref("DOMRequest")}} 객체를 반환합니다. 주파수는 다음의 요구사항을 만족해야 합니다.:</p> -<ul> - <li>주파수는 {{domxref("FMRadio.frequencyLowerBound")}}와 {{domxref("FMRadio.frequencyUpperBound")}}에 정의된 범위 내에 있어야 합니다. 이 범위를 벗어나면 에러가 반환됩니다.</li> - <li>주파수는 {{domxref("FMRadio.channelWidth")}}에 정의된 값만큼 이동해야 합니다. 그렇지 않으면 주파수는 반올림됩니다. 예를 들어 100MHz가 정상적인 주파수이고 {{domxref("FMRadio.channelWidth","channelWidth")}}가 0.2로 설정된 경우, 100.15 주파수로 설정하더라도 주파수는 100.2로 할당됩니다.</li> -</ul> -<pre class="brush: js">var change = radio.setFrequency(frequency); - -change.onerror = function () { - var min = radio.frequencyLowerBound; - var max = radio.frequencyUpperBound; - console.warn('The frequency must be within the range [' + min + ',' + max + ']'); -} - -change.onsuccess = function () { - console.log('The frequency has been set to ' + radio.frequency); -} -</pre> -<h3 id="자동으로_찾기">자동으로 찾기</h3> -<p>WebFM API를 사용하면 편리하게 라디오 채널을 검색할 수 있습니다. {{domxref("FMRadio.seekUp()")}}(현재 주파수보다 높은 채널 찾기) {{domxref("FMRadio.seekDown()")}} 메소드를 사용합니다. 현재 주파수보다 높거나, 낮은 주파수의 라디오 채널을 찾을 때 사용합니다. 이 메소드들은 호출 후에 성공/실패를 제어할 수 있는 {{domxref("DOMRequest")}} 객체를 반환합니다.<br> - <br> - 이 메소드들은 {{domxref("FMRadio.frequencyLowerBound","frequencyLowerBound")}}나 {{domxref("FMRadio.frequencyUpperBound","frequencyUpperBound")}} 값에 도달할 때까지 반복적으로 더 높거나, 낮은 주파수를 찾습니다. 새로운 라디오 채널을 찾으면 {{event("frequencychange")}} 이벤트가 발생되고 현재 주파수로 변경됩니다.<br> - <br> - 동시에 두 메소드를 실행할 수 없으며(동시에 상위/하위 채널을 찾을 수 없습니다) 동시에 실행할 경우 에러가 반환됩니다. 더 이상 찾을 필요가 없을 때 {{domxref("FMRadio.cancelSeek()")}} 메소드를 호출합니다. 이 메소드 역시 {{domxref("DOMRequest")}} 객체를 반환합니다.</p> -<pre class="brush: js">var radio = navigator.mozFMRadio; -var seeking = false; -var UP = document.querySelector("button.up"); -var DOWN = document.querySelector("button.down"); - -// When the frequency change, the seek -// functions automatically stop to seek. -radio.onfrequencychange = function () { - seeking = false; -} - -function seek(direction) { - var cancel, search; - - // If the radio is already seeking - // we will cancel the current search. - if (seeking) { - var cancel = radio.cancelSeek(); - cancel.onsuccess = function () { - seeking = false; - - // Once the radio no longer seek, - // we can try to seek as expected - seek(direction); - } - - // Let's seek up - } else if (direction === 'up') { - // Just to be sure that the radio is turned on - if (!radio.enabled) { - radio.enable(radio.frequencyLowerBound); - } - search = radio.seekUp(); - - // Let's seek up - } else if (direction === 'down' { - // Just to be sure that the radio is turned on - if (!radio.enabled) { - radio.enable(radio.frequencyUpperBound); - } - search = radio.seekDown(); - } - - if (search) { - search.onsuccess = function () { - // Ok, we are seeking now. - seeking = true; - }; - search.onerror = function () { - // Something goes wrong... ok, let's try again. - seek(direction); - } - } -} - -UP.addEventListener('click', function () { - seek('up'); -}); - -DOWN.addEventListener('click', function () { - seek('down'); -}); -</pre> -<h2 id="표준">표준</h2> -<p>Not part of any specification.</p> -<h2 id="참고자료">참고자료</h2> -<ul> - <li>{{domxref("FMRadio")}}</li> - <li><a href="https://github.com/mozilla-b2g/gaia/tree/master/apps/fm" title="https://github.com/mozilla-b2g/gaia/tree/master/apps/fm">The FM app on Gaïa</a></li> -</ul> diff --git a/files/ko/webapi/websms/index.html b/files/ko/webapi/websms/index.html deleted file mode 100644 index 9f91f8ff00..0000000000 --- a/files/ko/webapi/websms/index.html +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: WebSMS -slug: WebAPI/WebSMS -tags: - - Non-standard -translation_of: Archive/B2G_OS/API/Mobile_Messaging_API ---- -<p>{{DefaultAPISidebar("Mobile Messaging API")}}</p> - -<div class="blockIndicator nonStandard"> -<p><strong>Non-standard</strong><br> - This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.</p> -</div> - -<div class="blockIndicator warning"> -<p style="text-align: center;">This API is available on <a href="/en-US/docs/Mozilla/Firefox_OS">Firefox OS</a> for <a href="/en-US/docs/Mozilla/Firefox_OS/Security/Application_security#App_Types">internal applications</a> only.</p> -</div> - -<h2 id="요약">요약</h2> - -<p>WebSMS는 웹 콘텐츠에서 단문 메시지 서비스 (SMS) 또는 멀티미디어 메시지 서비스 (MMS)의 메시지들을 만들고, 보내고, 받을수 있도록 해주는 API 입니다.</p> - -<p>이 API는 {{ domxref("MozSmsManager") }} 객체를 반환하는 {{ domxref("window.navigator.mozSms") }} 또는 {{ domxref("MozMobileMessageManager") }} 객체를 반환하는 {{ domxref("window.navigator.mozMobileMessage") }} 를 사용하여 이용 가능합니다. 자세한 내용은 아래의 인터페이스 전체 목록을 통해 보실 수 있습니다.</p> - -<h2 id="DOM_인터페이스">DOM 인터페이스</h2> - -<h3 id="SMS_인터페이스">SMS 인터페이스</h3> - -<ul> - <li>{{ domxref("window.navigator.mozSms") }}</li> - <li>{{ domxref("MozSmsManager") }}</li> - <li>{{ domxref("MozSmsMessage") }}</li> - <li>{{ domxref("MozSmsEvent") }}</li> - <li>{{ domxref("MozSmsFilter") }}</li> - <li>{{ domxref("MozSmsSegmentInfo") }}</li> -</ul> - -<h3 id="MMS_SMS_인터페이스">MMS, SMS 인터페이스</h3> - -<ul> - <li>{{ domxref("window.navigator.mozMobileMessage") }}</li> - <li>{{ domxref("MozMobileMessageManager")}}</li> - <li>{{ domxref("MozMmsMessage") }}</li> - <li>{{ domxref("MozMmsEvent") }}</li> - <li>{{ domxref("MozMobileMessageThread") }}</li> -</ul> - -<h2 id="예제_코드와_소개">예제 코드와 소개</h2> - -<ul> - <li><a href="/ko/WebAPI/WebSMS/Introduction_to_WebSMS" title="ko/WebAPI/WebSMS/Introduction_to_WebSMS">WebSMS 소개</a></li> -</ul> - -<h2 id="명세">명세</h2> - -<p>이 API는 비 표준 스펙의 구현체입니다. 하지만 W3C의 <a href="http://www.w3.org/2012/sysapps/" title="http://www.w3.org/2012/sysapps/">System Application Working Group</a>에서 논의되고 있습니다.</p> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('Messaging')}}</td> - <td>{{Spec2('Messaging')}}</td> - <td>Editor Draft (WIP).</td> - </tr> - </tbody> -</table> - -<h2 id="설정_이용_가능한_환경">설정 & 이용 가능한 환경</h2> - -<div id="compat-mobile"> </div> - -<ul> - <li>WebSMS는 기본적으로 비활성화 되어있습니다. <code>dom.sms.enabled 설정을 true로 지정하여야 활성화됩니다.</code></li> - <li>WebSMS API를 사용하도록 허가된 호스트명들의 화이트 리스트(콤마로 구분)는 반드시 <code>dom.sms.whitelist 설정에 명시되어야 합니다. 이 문자열은 기본적으로 빈 문자열입니다.</code></li> - <li>WebSMS는 오직 Firefox OS (B2G) 에 인증된 앱에서만 이용 가능합니다.</li> - <li>MMS는 Firefox OS 1.1 부터 이용 가능합니다.고 자료</li> - <li><a class="link-https" href="https://wiki.mozilla.org/WebAPI/WebSMS" title="https://wiki.mozilla.org/WebAPI/WebSMS">WebSMS API</a> (설계 문서)</li> -</ul> diff --git a/files/ko/webapi/websms/introduction_to_mobile_message_api/introduction_to_websms/index.html b/files/ko/webapi/websms/introduction_to_mobile_message_api/introduction_to_websms/index.html deleted file mode 100644 index 723f12561a..0000000000 --- a/files/ko/webapi/websms/introduction_to_mobile_message_api/introduction_to_websms/index.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: WebSMS 소개 -slug: WebAPI/WebSMS/Introduction_to_Mobile_Message_API/Introduction_to_WebSMS -translation_of: Archive/B2G_OS/API/Mobile_Messaging_API/Introduction_to_Mobile_Message_API ---- -<p>휴대전화의 핵심 기능 중 하나는 SMS 메시지 전송과 수신이다. 이 기능은 <a class="link-https" href="https://wiki.mozilla.org/WebAPI/WebSMS">WebSMS API</a>를 사용하여 구현 가능하다. 다음은 구현 방법 예제이다.</p> -<pre class="brush: js">// SMS object -var sms = navigator.mozSms; - -// Send a message -sms.send("123456789", "Hello world!"); - -// Receive a message -sms.onreceived = function (event) { - // Read message - console.log(event.message); -}; -</pre> -<h2 id="참조_문서">참조 문서</h2> -<ul> - <li><a href="/en/API/WebSMS" title="WebSMS">WebSMS</a></li> - <li><a class="link-https" href="https://wiki.mozilla.org/WebAPI/WebSMS">WebSMS API</a> (설계 문서)</li> -</ul> |