Skip to content

Commit

Permalink
🐎 Lazy load model and views
Browse files Browse the repository at this point in the history
Closes #430
  • Loading branch information
abe33 committed Dec 17, 2015
1 parent c3fec44 commit e0b1127
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ Object.keys(require.cache).filter((p) => {

import {Emitter, CompositeDisposable} from 'atom'
import include from './decorators/include'
import Minimap from './minimap'
import MinimapElement from './minimap-element'
import PluginManagement from './mixins/plugin-management'
import MinimapPluginGeneratorElement from './minimap-plugin-generator-element'

let Minimap, MinimapElement, MinimapPluginGeneratorElement

/**
* The `Minimap` package provides an eagle-eye view of text buffers.
Expand Down Expand Up @@ -91,6 +90,9 @@ class Main {
activate () {
if (this.active) { return }

if (!Minimap) { Minimap = require('./minimap') }
if (!MinimapElement) { MinimapElement = require('./minimap-element') }

MinimapElement.registerViewProvider(Minimap)

this.subscriptionsOfCommands = atom.commands.add('atom-workspace', {
Expand Down Expand Up @@ -167,6 +169,9 @@ class Main {
* @param {string} template the name of the template to use
*/
generatePlugin (template) {
if (!MinimapPluginGeneratorElement) {
MinimapPluginGeneratorElement = require('./minimap-plugin-generator-element')
}
var view = new MinimapPluginGeneratorElement()
view.template = template
view.attach()
Expand Down

0 comments on commit e0b1127

Please sign in to comment.