| 12345678910111213141516171819202122232425262728293031323334 |
- // lockScreen.js
- (function() {
- // 始终使用顶层窗口的命名空间
- var targetWindow = window.top || window;
- targetWindow.SS = targetWindow.SS || {};
-
- targetWindow.SS.lockScreenService = {
- _homeInstance: null,
-
- init(homeInstance) {
- this._homeInstance = homeInstance;
- },
-
- get isLocked() {
- return this._homeInstance?.isLockScreen || false;
- },
-
- async lock() {
- if(!this._homeInstance) {
- console.error('LockScreenService: home instance not initialized');
- return;
- }
- return this._homeInstance.lockScreenFun();
- },
-
- async unlock(password) {
- if(!this._homeInstance) {
- console.error('LockScreenService: home instance not initialized');
- return;
- }
- return this._homeInstance.unlockSessionByPassword(password);
- }
- };
- })();
|