Explorar o código

refactor: export ready promise directly

Gerald %!s(int64=6) %!d(string=hai) anos
pai
achega
4a058169c1

+ 1 - 5
src/common/options.js

@@ -28,12 +28,8 @@ function updateOptions(data) {
   hooks.fire(data);
 }
 
-function onReady(cb) {
-  ready.then(cb);
-}
-
 export default {
-  ready: onReady,
+  ready,
   get: getOption,
   set: setOption,
   update: updateOptions,

+ 1 - 1
src/common/ui/setting-check.vue

@@ -35,7 +35,7 @@ export default {
     },
   },
   created() {
-    options.ready(() => {
+    options.ready.then(() => {
       this.value = options.get(this.name);
       this.revoke = hookSetting(this.name, (value) => {
         this.value = value;

+ 1 - 1
src/confirm/index.js

@@ -9,7 +9,7 @@ import './style.css';
 Vue.prototype.i18n = i18n;
 document.title = `${i18n('labelInstall')} - ${i18n('extName')}`;
 
-options.ready(() => {
+options.ready.then(() => {
   const el = document.createElement('div');
   document.body.appendChild(el);
   new Vue({

+ 1 - 1
src/options/index.js

@@ -22,7 +22,7 @@ initialize();
 
 function initialize() {
   initMain();
-  options.ready(() => {
+  options.ready.then(() => {
     const el = document.createElement('div');
     document.body.appendChild(el);
     new Vue({

+ 1 - 1
src/options/views/feature.vue

@@ -18,7 +18,7 @@ options.hook((data) => {
     Vue.set(store, 'features', features);
   }
 });
-options.ready(() => reset('sync'));
+options.ready.then(() => reset('sync'));
 
 function reset(version) {
   if (objectGet(store, 'features.version') !== version) {

+ 1 - 1
src/options/views/tab-installed.vue

@@ -143,7 +143,7 @@ const filters = {
 hookSetting('filters.sort', (value) => {
   filters.sort.set(value);
 });
-options.ready(() => {
+options.ready.then(() => {
   filters.sort.set(options.get('filters.sort'));
 });
 

+ 1 - 1
src/options/views/tab-settings/index.vue

@@ -139,7 +139,7 @@ export default {
   },
   created() {
     this.revokers = [];
-    options.ready(() => {
+    options.ready.then(() => {
       items.forEach((item) => {
         const { name, key, normalize } = item;
         settings[name] = normalize(options.get(key || name));