web-launch-kit 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ko.md CHANGED
@@ -24,6 +24,7 @@ npm install web-launch-kit
24
24
  | 멤버 | 시그니처 | 설명 |
25
25
  | --- | --- | --- |
26
26
  | `LaunchKit.version` | `string` | 설치된 패키지 버전 |
27
+ | `LaunchKit.debug` | `boolean` (get/set) | 각 실행 시도 전에 `debugger`로 정지. 기본값 `false` |
27
28
  | `LaunchKit.SettingType` | `enum` | 설정 화면: `General`, `Network`, `Display`, `Appearance`, `Accessibility`, `Battery`, `Datetime`, `Language`, `Accounts`, `Storage` |
28
29
  | `LaunchKit.app(options?)` | `Promise<AppOpenedBy>` | 가능한 최선의 경로로 앱을 실행하고, 어떤 경로로 열렸는지 반환 |
29
30
  | `LaunchKit.telephone(options?)` | `Promise<void>` | 전화 앱 열기 (`tel:`) |
@@ -259,6 +260,24 @@ await LaunchKit.map({ directions: { destination: 'Seoul Station', origin: [37.56
259
260
  경로는 Google Maps 폴백을 쓰고, Windows도 지도 앱이 단종되어 `bingmaps:`가 대개 웹 폴백으로
260
261
  넘어갑니다.
261
262
 
263
+ ## 콘솔에서 테스트하기
264
+
265
+ DevTools 콘솔에서 실행 메서드를 호출하면 페이지에 포커스도, 사용자 activation도 없는
266
+ 상태가 됩니다. 둘 다 프로그램으로는 되돌릴 수 없어서 시도가 실패하고 앱 전환 감지도 볼 것이
267
+ 없습니다. 같은 호출을 클릭 핸들러 안에서 하면 정상 동작합니다.
268
+
269
+ `debug`를 켜면 화면 이동 직전에 정지합니다. 재개 버튼을 누르면 포커스와 activation이
270
+ 돌아와서 콘솔에서도 실제 탭과 동일하게 동작합니다.
271
+
272
+ ```js
273
+ LaunchKit.debug = true
274
+
275
+ await LaunchKit.app({ ios: { scheme: 'myapp://profile/42' } })
276
+ ```
277
+
278
+ 그 외에는 꺼두세요. 모든 실행 메서드가 같은 지점을 지나므로 `telephone`, `message`,
279
+ `mail`, `map`에서도 후보마다 한 번씩 정지합니다.
280
+
262
281
  ## 시스템 설정
263
282
 
264
283
  ```js
package/README.md CHANGED
@@ -25,6 +25,7 @@ The bundle is self-contained (OS/locale detection is inlined) — no peer script
25
25
  | Member | Signature | Description |
26
26
  | --- | --- | --- |
27
27
  | `LaunchKit.version` | `string` | The installed package version |
28
+ | `LaunchKit.debug` | `boolean` (get/set) | Pause on a `debugger` before each launch attempt; defaults to `false` |
28
29
  | `LaunchKit.SettingType` | `enum` | Setting panes: `General`, `Network`, `Display`, `Appearance`, `Accessibility`, `Battery`, `Datetime`, `Language`, `Accounts`, `Storage` |
29
30
  | `LaunchKit.app(options?)` | `Promise<AppOpenedBy>` | Launch an app via the best available route; resolves with which route opened it |
30
31
  | `LaunchKit.telephone(options?)` | `Promise<void>` | Open the dialer (`tel:`) |
@@ -262,6 +263,24 @@ handlers other than Google Maps misread the labelled form as a search. Android's
262
263
  fallback there, and on Windows the discontinued Maps app means `bingmaps:` usually
263
264
  defers to the web fallback too.
264
265
 
266
+ ## Testing from the console
267
+
268
+ Calling a launch method from the DevTools console leaves the page without focus and without
269
+ user activation. Neither can be restored programmatically, so the attempt fails and
270
+ app-switch detection has nothing to observe — the same call from a click handler works fine.
271
+
272
+ Set `debug` to pause before the navigation. Pressing resume hands focus and activation back,
273
+ so the console behaves like a real tap.
274
+
275
+ ```js
276
+ LaunchKit.debug = true
277
+
278
+ await LaunchKit.app({ ios: { scheme: 'myapp://profile/42' } })
279
+ ```
280
+
281
+ Leave it off otherwise — every launch method routes through the same place, so it would
282
+ pause on `telephone`, `message`, `mail`, and `map` too, once per candidate.
283
+
265
284
  ## System settings
266
285
 
267
286
  ```js
package/dist/index.d.ts CHANGED
@@ -89,6 +89,8 @@ interface LaunchKitUtils {
89
89
  interface LaunchKitInstance {
90
90
  readonly version: string;
91
91
  readonly SettingType: typeof SettingType;
92
+ get debug(): boolean;
93
+ set debug(value: boolean);
92
94
  readonly utils: LaunchKitUtils;
93
95
  app(options?: AppOpenOptions): Promise<AppOpenedBy>;
94
96
  telephone(options?: TelephoneOptions): Promise<void>;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version$3 = "0.0.4";
5
+ var version$3 = "0.0.5";
6
6
  var packageJSON$3 = {
7
7
  version: version$3};
8
8
 
@@ -262,7 +262,7 @@ function parseWebview() {
262
262
  return true;
263
263
  if (/\belectron\//i.test(currentUserAgent))
264
264
  return true;
265
- if (/(?:iphone|ipad|ipod)/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
265
+ if (/iphone|ipad|ipod/i.test(currentUserAgent) && /applewebkit/i.test(currentUserAgent) && /safari/i.test(currentUserAgent) === false)
266
266
  return true;
267
267
  return parseInAppBrowser() !== null;
268
268
  }
@@ -492,7 +492,7 @@ function getGlobal$2() {
492
492
  return {};
493
493
  }
494
494
 
495
- var version$1 = "0.0.1";
495
+ var version$1 = "0.0.3";
496
496
  var packageJSON$1 = {
497
497
  version: version$1};
498
498
 
@@ -942,8 +942,6 @@ var GLOBAL$4 = getGlobal$2();
942
942
  var LISTENER_STORE = [];
943
943
  var NOOP = function () {
944
944
  };
945
- // Records live on the target itself, so they are collected with it and lookups only scan
946
- // that target's own listeners. Targets that reject the expando fall back to LISTENER_STORE.
947
945
  var STORE_KEY = '__webEventKitListeners__';
948
946
  function resolveBucket(target, create) {
949
947
  var holder = target;
@@ -1001,9 +999,6 @@ function invokeCallback(callback, target, event) {
1001
999
  if (typeof callback === 'object' && callback !== null && typeof callback.handleEvent === 'function')
1002
1000
  return callback.handleEvent(event);
1003
1001
  }
1004
- // The same Event object is handed to every listener, so any property this kit overrides has
1005
- // to be put back before the next one runs — otherwise a `pointerdown` listener would observe
1006
- // the `touchstart` type and synthetic touches written by a listener registered before it.
1007
1002
  function patchEventProperty(event, property, value, patches) {
1008
1003
  var holder = event;
1009
1004
  var had = false;
@@ -1169,8 +1164,6 @@ var EventKit = {
1169
1164
  return NOOP;
1170
1165
  var normalized = normalizeListenerOptions(options);
1171
1166
  var existing = findListenerRecord(target, type, callback, normalized.capture);
1172
- // Native `addEventListener` ignores a duplicate registration, so hand back a releaser
1173
- // that does nothing rather than one that would detach the first caller's listener.
1174
1167
  if (typeof existing !== 'undefined')
1175
1168
  return NOOP;
1176
1169
  if (typeof normalized.signal !== 'undefined' && normalized.signal.aborted)
@@ -1200,8 +1193,6 @@ var EventKit = {
1200
1193
  record.onAbort = function () {
1201
1194
  releaseListenerRecord(record);
1202
1195
  };
1203
- // Engines without listener-options coerce `{once: true}` to capture, which would then
1204
- // fail to match on removal; releaseListenerRecord detaches this anyway.
1205
1196
  record.signal.addEventListener('abort', record.onAbort, false);
1206
1197
  }
1207
1198
  return function () {
@@ -1906,6 +1897,7 @@ var DEFAULT_TIMEOUT = 750;
1906
1897
  var GLOBAL = getGlobal$1();
1907
1898
  var NAVIGATOR = GLOBAL.navigator;
1908
1899
  var CLEANUP_INPUT_ELEMENT = null;
1900
+ var DEBUG = false;
1909
1901
  function createTypeGuard(tag) {
1910
1902
  return function (value) {
1911
1903
  return Object.prototype.toString.call(value) === '[object ' + tag + ']';
@@ -2179,7 +2171,8 @@ function openURL(tried, url, timeout) {
2179
2171
  }
2180
2172
  }
2181
2173
  return new Promise(function (resolve, reject) {
2182
- debugger;
2174
+ if (DEBUG)
2175
+ debugger;
2183
2176
  var timeoutId;
2184
2177
  var resolved = false;
2185
2178
  function cleanup() {
@@ -2803,6 +2796,12 @@ function walk(directory, basePath) {
2803
2796
  var LaunchKit = {
2804
2797
  SettingType: exports.SettingType,
2805
2798
  version: packageJSON$3.version,
2799
+ get debug() {
2800
+ return DEBUG;
2801
+ },
2802
+ set debug(value) {
2803
+ DEBUG = value === true;
2804
+ },
2806
2805
  utils: {
2807
2806
  get canOpenIntent() {
2808
2807
  return canOpenIntent();