@gachlab/capacitor-keep-awake-plugin 1.1.0 → 2.0.1

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.
@@ -1,4 +1 @@
1
- import type { KeepAwakePlugin } from './definitions';
2
- declare const KeepAwake: KeepAwakePlugin;
3
- export * from './definitions';
4
- export { KeepAwake };
1
+ export interface KeepAwakePlugin { dontAllowSleep(): Promise<{ isAllowdSleep: boolean }>; allowSleep(): Promise<{ isAllowdSleep: boolean }>; } declare const KeepAwake: KeepAwakePlugin; export { KeepAwake };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,8 @@
1
- import { registerPlugin } from '@capacitor/core';
2
- const KeepAwake = registerPlugin('KeepAwake', {
3
- web: () => import('./web').then(m => new m.KeepAwakeWeb()),
1
+ import { registerPlugin as p } from "@capacitor/core";
2
+ const t = p("KeepAwake", {
3
+ web: () => import("../web-CFH8HkZO.mjs").then((e) => new e.KeepAwakeWeb())
4
4
  });
5
- export * from './definitions';
6
- export { KeepAwake };
7
- //# sourceMappingURL=index.js.map
5
+ export {
6
+ t as KeepAwake
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,SAAS,GAAG,cAAc,CAAkB,WAAW,EAAE;IAC7D,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;CAC3D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nconst KeepAwake = registerPlugin<KeepAwakePlugin>('KeepAwake', {\n web: () => import('./web').then(m => new m.KeepAwakeWeb()),\n});\n\nexport * from './definitions';\nexport { KeepAwake };\n"]}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nconst KeepAwake = registerPlugin<KeepAwakePlugin>('KeepAwake', {\n web: () => import('./web').then(m => new m.KeepAwakeWeb()),\n});\n\nexport * from './definitions';\nexport { KeepAwake };\n"],"names":["KeepAwake","registerPlugin","m"],"mappings":";AAIM,MAAAA,IAAYC,EAAgC,aAAa;AAAA,EAC7D,KAAK,MAAM,OAAO,qBAAO,EAAE,KAAK,CAAKC,MAAA,IAAIA,EAAE,aAAc,CAAA;AAC3D,CAAC;"}
@@ -1,24 +1,2 @@
1
- 'use strict';
2
-
3
- var core = require('@capacitor/core');
4
-
5
- const KeepAwake = core.registerPlugin('KeepAwake', {
6
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.KeepAwakeWeb()),
7
- });
8
-
9
- class KeepAwakeWeb extends core.WebPlugin {
10
- dontAllowSleep() {
11
- throw new Error('Method not implemented for Web.');
12
- }
13
- allowSleep() {
14
- throw new Error('Method not implemented for Web.');
15
- }
16
- }
17
-
18
- var web = /*#__PURE__*/Object.freeze({
19
- __proto__: null,
20
- KeepAwakeWeb: KeepAwakeWeb
21
- });
22
-
23
- exports.KeepAwake = KeepAwake;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@capacitor/core"),t=r.registerPlugin("KeepAwake",{web:()=>Promise.resolve().then(()=>require("./web-BNfo7bz7.js")).then(e=>new e.KeepAwakeWeb)});exports.KeepAwake=t;
24
2
  //# sourceMappingURL=plugin.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst KeepAwake = registerPlugin('KeepAwake', {\n web: () => import('./web').then(m => new m.KeepAwakeWeb()),\n});\nexport * from './definitions';\nexport { KeepAwake };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class KeepAwakeWeb extends WebPlugin {\n dontAllowSleep() {\n throw new Error('Method not implemented for Web.');\n }\n allowSleep() {\n throw new Error('Method not implemented for Web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;AAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;AAC9D,CAAC;;ACFM,MAAM,YAAY,SAASC,cAAS,CAAC;AAC5C,IAAI,cAAc,GAAG;AACrB,QAAQ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;AAC1D;AACA,IAAI,UAAU,GAAG;AACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;AAC1D;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nconst KeepAwake = registerPlugin<KeepAwakePlugin>('KeepAwake', {\n web: () => import('./web').then(m => new m.KeepAwakeWeb()),\n});\n\nexport * from './definitions';\nexport { KeepAwake };\n"],"names":["KeepAwake","registerPlugin","m"],"mappings":"mHAIMA,EAAYC,iBAAgC,YAAa,CAC7D,IAAK,IAAM,QAAO,QAAA,EAAA,KAAA,IAAA,QAAA,mBAAO,GAAE,KAAUC,GAAA,IAAIA,EAAE,YAAc,CAC3D,CAAC"}
package/dist/plugin.js CHANGED
@@ -1,27 +1,2 @@
1
- var capacitorKeepAwake = (function (exports, core) {
2
- 'use strict';
3
-
4
- const KeepAwake = core.registerPlugin('KeepAwake', {
5
- web: () => Promise.resolve().then(function () { return web; }).then(m => new m.KeepAwakeWeb()),
6
- });
7
-
8
- class KeepAwakeWeb extends core.WebPlugin {
9
- dontAllowSleep() {
10
- throw new Error('Method not implemented for Web.');
11
- }
12
- allowSleep() {
13
- throw new Error('Method not implemented for Web.');
14
- }
15
- }
16
-
17
- var web = /*#__PURE__*/Object.freeze({
18
- __proto__: null,
19
- KeepAwakeWeb: KeepAwakeWeb
20
- });
21
-
22
- exports.KeepAwake = KeepAwake;
23
-
24
- return exports;
25
-
26
- })({}, capacitorExports);
1
+ var capacitorKeepAwake=function(e,t){"use strict";const r=t.registerPlugin("KeepAwake",{web:()=>Promise.resolve().then(()=>l).then(o=>new o.KeepAwakeWeb)});class n extends t.WebPlugin{dontAllowSleep(){throw new Error("Method not implemented for Web.")}allowSleep(){throw new Error("Method not implemented for Web.")}}const l=Object.freeze(Object.defineProperty({__proto__:null,KeepAwakeWeb:n},Symbol.toStringTag,{value:"Module"}));return e.KeepAwake=r,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({},capacitorExports);
27
2
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst KeepAwake = registerPlugin('KeepAwake', {\n web: () => import('./web').then(m => new m.KeepAwakeWeb()),\n});\nexport * from './definitions';\nexport { KeepAwake };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class KeepAwakeWeb extends WebPlugin {\n dontAllowSleep() {\n throw new Error('Method not implemented for Web.');\n }\n allowSleep() {\n throw new Error('Method not implemented for Web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAC9D,CAAC;;ICFM,MAAM,YAAY,SAASC,cAAS,CAAC;IAC5C,IAAI,cAAc,GAAG;IACrB,QAAQ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;IAC1D;IACA,IAAI,UAAU,GAAG;IACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;IAC1D;IACA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["../src/index.ts","../src/web.ts"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nconst KeepAwake = registerPlugin<KeepAwakePlugin>('KeepAwake', {\n web: () => import('./web').then(m => new m.KeepAwakeWeb()),\n});\n\nexport * from './definitions';\nexport { KeepAwake };\n","import { WebPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nexport class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin {\n dontAllowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n allowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n \n}\n"],"names":["KeepAwake","registerPlugin","web","m","KeepAwakeWeb","WebPlugin"],"mappings":"kDAIM,MAAAA,EAAYC,iBAAgC,YAAa,CAC7D,IAAK,IAAM,QAAA,QAAA,EAAA,KAAA,IAAAC,CAAA,EAAgB,KAAUC,GAAA,IAAIA,EAAE,YAAc,CAC3D,CAAC,ECFM,MAAMC,UAAqBC,EAAAA,SAAqC,CACrE,gBAAuD,CAC/C,MAAA,IAAI,MAAM,iCAAiC,CAAA,CAEnD,YAAmD,CAC3C,MAAA,IAAI,MAAM,iCAAiC,CAAA,CAGrD"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@capacitor/core");class o extends e.WebPlugin{dontAllowSleep(){throw new Error("Method not implemented for Web.")}allowSleep(){throw new Error("Method not implemented for Web.")}}exports.KeepAwakeWeb=o;
2
+ //# sourceMappingURL=web-BNfo7bz7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-BNfo7bz7.js","sources":["../src/web.ts"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nexport class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin {\n dontAllowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n allowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n \n}\n"],"names":["KeepAwakeWeb","WebPlugin"],"mappings":"mHAIO,MAAMA,UAAqBC,EAAAA,SAAqC,CACrE,gBAAuD,CAC/C,MAAA,IAAI,MAAM,iCAAiC,CAAA,CAEnD,YAAmD,CAC3C,MAAA,IAAI,MAAM,iCAAiC,CAAA,CAGrD"}
@@ -0,0 +1,13 @@
1
+ import { WebPlugin as e } from "@capacitor/core";
2
+ class t extends e {
3
+ dontAllowSleep() {
4
+ throw new Error("Method not implemented for Web.");
5
+ }
6
+ allowSleep() {
7
+ throw new Error("Method not implemented for Web.");
8
+ }
9
+ }
10
+ export {
11
+ t as KeepAwakeWeb
12
+ };
13
+ //# sourceMappingURL=web-CFH8HkZO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-CFH8HkZO.mjs","sources":["../src/web.ts"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nexport class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin {\n dontAllowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n allowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n \n}\n"],"names":["KeepAwakeWeb","WebPlugin"],"mappings":";AAIO,MAAMA,UAAqBC,EAAqC;AAAA,EACrE,iBAAuD;AAC/C,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAAA;AAAA,EAEnD,aAAmD;AAC3C,UAAA,IAAI,MAAM,iCAAiC;AAAA,EAAA;AAGrD;"}
@@ -1,13 +1,12 @@
1
1
  import Foundation
2
+ import UIKit
2
3
 
3
4
  @objc public class KeepAwake: NSObject {
4
- @objc public func dontAllowSleep() -> String {
5
- print("Sleep Disabled",terminator: "\n")
5
+ @objc public func dontAllowSleep() -> Bool {
6
6
  UIApplication.shared.isIdleTimerDisabled = true
7
7
  return false
8
8
  }
9
- @objc public func allowSleep() -> String {
10
- print("Sleep Enabled",terminator: "\n")
9
+ @objc public func allowSleep() -> Bool {
11
10
  UIApplication.shared.isIdleTimerDisabled = false
12
11
  return true
13
12
  }
@@ -18,12 +18,12 @@ public class KeepAwakePlugin: CAPPlugin, CAPBridgedPlugin {
18
18
 
19
19
  @objc func dontAllowSleep(_ call: CAPPluginCall) {
20
20
  call.resolve([
21
- "isAllowedSleep": implementation.dontAllowSleep()
21
+ "isAllowdSleep": implementation.dontAllowSleep()
22
22
  ])
23
23
  }
24
24
  @objc func allowSleep(_ call: CAPPluginCall) {
25
25
  call.resolve([
26
- "isAllowedSleep": implementation.allowSleep()
26
+ "isAllowdSleep": implementation.allowSleep()
27
27
  ])
28
28
  }
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gachlab/capacitor-keep-awake-plugin",
3
- "version": "1.1.0",
3
+ "version": "2.0.1",
4
4
  "description": "A plugin to keep awake the device screen",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -40,9 +40,10 @@
40
40
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
41
41
  "swiftlint": "node-swiftlint",
42
42
  "docgen": "docgen --api KeepAwakePlugin --output-readme README.md --output-json dist/docs.json",
43
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
43
+ "build": "npm run clean && vite build && npm run generate-types",
44
+ "generate-types": "echo 'export interface KeepAwakePlugin { dontAllowSleep(): Promise<{ isAllowdSleep: boolean }>; allowSleep(): Promise<{ isAllowdSleep: boolean }>; } declare const KeepAwake: KeepAwakePlugin; export { KeepAwake };' > dist/esm/index.d.ts",
44
45
  "clean": "rimraf ./dist",
45
- "watch": "tsc --watch",
46
+ "watch": "vite build --watch",
46
47
  "prepublishOnly": "npm run build"
47
48
  },
48
49
  "devDependencies": {
@@ -57,9 +58,10 @@
57
58
  "prettier": "^3.4.2",
58
59
  "prettier-plugin-java": "^2.6.6",
59
60
  "rimraf": "^6.0.1",
60
- "rollup": "^4.30.1",
61
61
  "swiftlint": "^2.0.0",
62
- "typescript": "~4.1.5"
62
+ "typescript": "~4.1.5",
63
+ "vite": "^5.4.19",
64
+ "vite-plugin-dts": "^3.9.1"
63
65
  },
64
66
  "peerDependencies": {
65
67
  "@capacitor/core": ">=7.0.0"
package/dist/docs.json DELETED
@@ -1,35 +0,0 @@
1
- {
2
- "api": {
3
- "name": "KeepAwakePlugin",
4
- "slug": "keepawakeplugin",
5
- "docs": "",
6
- "tags": [],
7
- "methods": [
8
- {
9
- "name": "dontAllowSleep",
10
- "signature": "() => Promise<{ isAllowdSleep: boolean; }>",
11
- "parameters": [],
12
- "returns": "Promise<{ isAllowdSleep: boolean; }>",
13
- "tags": [],
14
- "docs": "",
15
- "complexTypes": [],
16
- "slug": "dontallowsleep"
17
- },
18
- {
19
- "name": "allowSleep",
20
- "signature": "() => Promise<{ isAllowdSleep: boolean; }>",
21
- "parameters": [],
22
- "returns": "Promise<{ isAllowdSleep: boolean; }>",
23
- "tags": [],
24
- "docs": "",
25
- "complexTypes": [],
26
- "slug": "allowsleep"
27
- }
28
- ],
29
- "properties": []
30
- },
31
- "interfaces": [],
32
- "enums": [],
33
- "typeAliases": [],
34
- "pluginConfigs": []
35
- }
@@ -1,8 +0,0 @@
1
- export interface KeepAwakePlugin {
2
- dontAllowSleep(): Promise<{
3
- isAllowdSleep: boolean;
4
- }>;
5
- allowSleep(): Promise<{
6
- isAllowdSleep: boolean;
7
- }>;
8
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=definitions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface KeepAwakePlugin {\n dontAllowSleep(): Promise<{ isAllowdSleep: boolean }>;\n allowSleep(): Promise<{ isAllowdSleep: boolean }>;\n}\n"]}
package/dist/esm/web.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import { WebPlugin } from '@capacitor/core';
2
- import type { KeepAwakePlugin } from './definitions';
3
- export declare class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin {
4
- dontAllowSleep(): Promise<{
5
- isAllowdSleep: boolean;
6
- }>;
7
- allowSleep(): Promise<{
8
- isAllowdSleep: boolean;
9
- }>;
10
- }
package/dist/esm/web.js DELETED
@@ -1,10 +0,0 @@
1
- import { WebPlugin } from '@capacitor/core';
2
- export class KeepAwakeWeb extends WebPlugin {
3
- dontAllowSleep() {
4
- throw new Error('Method not implemented for Web.');
5
- }
6
- allowSleep() {
7
- throw new Error('Method not implemented for Web.');
8
- }
9
- }
10
- //# sourceMappingURL=web.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,cAAc;QACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,UAAU;QACR,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;CAEF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { KeepAwakePlugin } from './definitions';\n\nexport class KeepAwakeWeb extends WebPlugin implements KeepAwakePlugin {\n dontAllowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n allowSleep(): Promise<{ isAllowdSleep: boolean; }> {\n throw new Error('Method not implemented for Web.');\n }\n \n}\n"]}