Rename 'window' module to 'browser_window' module. Fix #3.
This commit is contained in:
parent
f477ec09c0
commit
072ac8ba0b
7 changed files with 15 additions and 15 deletions
2
atom.gyp
2
atom.gyp
|
@ -11,10 +11,10 @@
|
||||||
'coffee_sources': [
|
'coffee_sources': [
|
||||||
'browser/api/lib/app.coffee',
|
'browser/api/lib/app.coffee',
|
||||||
'browser/api/lib/atom_delegate.coffee',
|
'browser/api/lib/atom_delegate.coffee',
|
||||||
|
'browser/api/lib/browser_window.coffee',
|
||||||
'browser/api/lib/dialog.coffee',
|
'browser/api/lib/dialog.coffee',
|
||||||
'browser/api/lib/ipc.coffee',
|
'browser/api/lib/ipc.coffee',
|
||||||
'browser/api/lib/menu.coffee',
|
'browser/api/lib/menu.coffee',
|
||||||
'browser/api/lib/window.coffee',
|
|
||||||
'browser/atom/atom.coffee',
|
'browser/atom/atom.coffee',
|
||||||
'browser/atom/objects_registry.coffee',
|
'browser/atom/objects_registry.coffee',
|
||||||
'browser/atom/rpc_server.coffee',
|
'browser/atom/rpc_server.coffee',
|
||||||
|
|
|
@ -586,7 +586,7 @@ void Window::Initialize(v8::Handle<v8::Object> target) {
|
||||||
|
|
||||||
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(Window::New);
|
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(Window::New);
|
||||||
t->InstanceTemplate()->SetInternalFieldCount(1);
|
t->InstanceTemplate()->SetInternalFieldCount(1);
|
||||||
t->SetClassName(v8::String::NewSymbol("Window"));
|
t->SetClassName(v8::String::NewSymbol("BrowserWindow"));
|
||||||
|
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "destroy", Destroy);
|
NODE_SET_PROTOTYPE_METHOD(t, "destroy", Destroy);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "close", Close);
|
NODE_SET_PROTOTYPE_METHOD(t, "close", Close);
|
||||||
|
@ -639,7 +639,7 @@ void Window::Initialize(v8::Handle<v8::Object> target) {
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "reload", Reload);
|
NODE_SET_PROTOTYPE_METHOD(t, "reload", Reload);
|
||||||
NODE_SET_PROTOTYPE_METHOD(t, "reloadIgnoringCache", ReloadIgnoringCache);
|
NODE_SET_PROTOTYPE_METHOD(t, "reloadIgnoringCache", ReloadIgnoringCache);
|
||||||
|
|
||||||
target->Set(v8::String::NewSymbol("Window"), t->GetFunction());
|
target->Set(v8::String::NewSymbol("BrowserWindow"), t->GetFunction());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
6
browser/api/lib/browser_window.coffee
Normal file
6
browser/api/lib/browser_window.coffee
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
EventEmitter = require('events').EventEmitter
|
||||||
|
|
||||||
|
BrowserWindow = process.atomBinding('window').BrowserWindow
|
||||||
|
BrowserWindow.prototype.__proto__ = EventEmitter.prototype
|
||||||
|
|
||||||
|
module.exports = BrowserWindow
|
|
@ -1,8 +1,8 @@
|
||||||
binding = process.atomBinding 'dialog'
|
binding = process.atomBinding 'dialog'
|
||||||
|
BrowserWindow = require 'browser_window'
|
||||||
CallbacksRegistry = require 'callbacks_registry'
|
CallbacksRegistry = require 'callbacks_registry'
|
||||||
EventEmitter = require('events').EventEmitter
|
EventEmitter = require('events').EventEmitter
|
||||||
ipc = require 'ipc'
|
ipc = require 'ipc'
|
||||||
Window = require 'window'
|
|
||||||
|
|
||||||
FileDialog = binding.FileDialog
|
FileDialog = binding.FileDialog
|
||||||
FileDialog.prototype.__proto__ = EventEmitter.prototype
|
FileDialog.prototype.__proto__ = EventEmitter.prototype
|
||||||
|
@ -34,7 +34,7 @@ validateOptions = (options) ->
|
||||||
true
|
true
|
||||||
|
|
||||||
selectFileWrap = (window, options, callback, type, title) ->
|
selectFileWrap = (window, options, callback, type, title) ->
|
||||||
throw new TypeError('Need Window object') unless window.constructor is Window
|
throw new TypeError('Need BrowserWindow object') unless window.constructor is BrowserWindow
|
||||||
|
|
||||||
options = {} unless options?
|
options = {} unless options?
|
||||||
options.type = type
|
options.type = type
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
EventEmitter = require('events').EventEmitter
|
EventEmitter = require('events').EventEmitter
|
||||||
Window = require 'window'
|
BrowserWindow = require 'browser_window'
|
||||||
|
|
||||||
Menu = process.atomBinding('menu').Menu
|
Menu = process.atomBinding('menu').Menu
|
||||||
Menu::__proto__ = EventEmitter.prototype
|
Menu::__proto__ = EventEmitter.prototype
|
||||||
|
|
||||||
popup = Menu::popup
|
popup = Menu::popup
|
||||||
Menu::popup = (window) ->
|
Menu::popup = (window) ->
|
||||||
throw new TypeError('Invalid window') unless window?.constructor is Window
|
throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow
|
||||||
|
|
||||||
popup.call this, window
|
popup.call this, window
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
EventEmitter = require('events').EventEmitter
|
|
||||||
|
|
||||||
Window = process.atomBinding('window').Window
|
|
||||||
Window.prototype.__proto__ = EventEmitter.prototype
|
|
||||||
|
|
||||||
module.exports = Window
|
|
|
@ -2,7 +2,7 @@ var app = require('app');
|
||||||
var delegate = require('atom_delegate');
|
var delegate = require('atom_delegate');
|
||||||
var ipc = require('ipc');
|
var ipc = require('ipc');
|
||||||
var Menu = require('menu');
|
var Menu = require('menu');
|
||||||
var Window = require('window');
|
var BrowserWindow = require('browser_window');
|
||||||
|
|
||||||
var mainWindow = null;
|
var mainWindow = null;
|
||||||
var menu = null;
|
var menu = null;
|
||||||
|
@ -13,7 +13,7 @@ app.on('window-all-closed', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
delegate.browserMainParts.preMainMessageLoopRun = function() {
|
delegate.browserMainParts.preMainMessageLoopRun = function() {
|
||||||
mainWindow = new Window({ width: 800, height: 600 });
|
mainWindow = new BrowserWindow({ width: 800, height: 600 });
|
||||||
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
mainWindow.loadUrl('file://' + __dirname + '/index.html');
|
||||||
|
|
||||||
mainWindow.on('page-title-updated', function(event, title) {
|
mainWindow.on('page-title-updated', function(event, title) {
|
||||||
|
|
Loading…
Reference in a new issue